mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 12:08:46 +00:00
修复Pie在设置ItemStyle的opacity时颜色不对的问题 (#309)
This commit is contained in:
@@ -73,6 +73,8 @@ slug: /changelog
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2024.03.19) 修复`Pie`在设置`ItemStyle`的`opacity`时颜色不对的问题 (#309)
|
||||||
|
|
||||||
## v3.10.2
|
## v3.10.2
|
||||||
|
|
||||||
* (2024.03.11) 发布`v3.10.2`版本
|
* (2024.03.11) 发布`v3.10.2`版本
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
var style = GetItemStyle(serie, serieData, SerieState.Normal);
|
var style = GetItemStyle(serie, serieData, SerieState.Normal);
|
||||||
GetColor(ref color, style.color, style.color, style.opacity, theme, index, opacity);
|
GetColor(ref color, style.color, style.color, style.opacity, theme, index, opacity);
|
||||||
GetColor(ref toColor, style.toColor, color, style.opacity, theme, index, opacity);
|
GetColor(ref toColor, style.toColor, color, style.opacity, theme, index, opacity, true);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case SerieState.Emphasis:
|
case SerieState.Emphasis:
|
||||||
@@ -342,7 +342,7 @@ namespace XCharts.Runtime
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetColor(ref color, stateStyle.itemStyle.color, stateStyle.itemStyle.color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
GetColor(ref color, stateStyle.itemStyle.color, stateStyle.itemStyle.color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
||||||
GetColor(ref toColor, stateStyle.itemStyle.toColor, color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
GetColor(ref toColor, stateStyle.itemStyle.toColor, color, stateStyle.itemStyle.opacity, theme, index, opacity, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
var style = GetItemStyle(serie, serieData, SerieState.Normal);
|
var style = GetItemStyle(serie, serieData, SerieState.Normal);
|
||||||
GetColor(ref color, style.color, style.color, style.opacity, theme, index, opacity);
|
GetColor(ref color, style.color, style.color, style.opacity, theme, index, opacity);
|
||||||
GetColor(ref toColor, style.toColor, color, style.opacity, theme, index, opacity);
|
GetColor(ref toColor, style.toColor, color, style.opacity, theme, index, opacity, true);
|
||||||
backgroundColor = style.backgroundColor;
|
backgroundColor = style.backgroundColor;
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
@@ -383,7 +383,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
backgroundColor = stateStyle.itemStyle.backgroundColor;
|
backgroundColor = stateStyle.itemStyle.backgroundColor;
|
||||||
GetColor(ref color, stateStyle.itemStyle.color, stateStyle.itemStyle.color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
GetColor(ref color, stateStyle.itemStyle.color, stateStyle.itemStyle.color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
||||||
GetColor(ref toColor, stateStyle.itemStyle.toColor, color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
GetColor(ref toColor, stateStyle.itemStyle.toColor, color, stateStyle.itemStyle.opacity, theme, index, opacity, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,7 +580,7 @@ namespace XCharts.Runtime
|
|||||||
innerFill = areaStyle.innerFill;
|
innerFill = areaStyle.innerFill;
|
||||||
toTop = areaStyle.toTop;
|
toTop = areaStyle.toTop;
|
||||||
GetColor(ref color, areaStyle.color, serie.itemStyle.color, areaStyle.opacity, theme, index);
|
GetColor(ref color, areaStyle.color, serie.itemStyle.color, areaStyle.opacity, theme, index);
|
||||||
GetColor(ref toColor, areaStyle.toColor, color, areaStyle.opacity, theme, index);
|
GetColor(ref toColor, areaStyle.toColor, color, areaStyle.opacity, theme, index, true);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case SerieState.Emphasis:
|
case SerieState.Emphasis:
|
||||||
@@ -606,7 +606,7 @@ namespace XCharts.Runtime
|
|||||||
innerFill = stateStyle.areaStyle.innerFill;
|
innerFill = stateStyle.areaStyle.innerFill;
|
||||||
toTop = stateStyle.areaStyle.toTop;
|
toTop = stateStyle.areaStyle.toTop;
|
||||||
GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index);
|
GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index);
|
||||||
GetColor(ref toColor, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index);
|
GetColor(ref toColor, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index, true, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -646,10 +646,14 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
|
public static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
|
||||||
float opacity, ThemeStyle theme, int colorIndex, bool setOpacity = true)
|
float opacity, ThemeStyle theme, int colorIndex, bool setOpacity = true, bool resetOpacity = false)
|
||||||
{
|
{
|
||||||
if (!ChartHelper.IsClearColor(checkColor)) color = checkColor;
|
if (!ChartHelper.IsClearColor(checkColor)) color = checkColor;
|
||||||
else if (!ChartHelper.IsClearColor(itemColor)) color = itemColor;
|
else if (!ChartHelper.IsClearColor(itemColor))
|
||||||
|
{
|
||||||
|
color = itemColor;
|
||||||
|
if (resetOpacity) opacity = 1;
|
||||||
|
}
|
||||||
if (ChartHelper.IsClearColor(color) && colorIndex >= 0) color = theme.GetColor(colorIndex);
|
if (ChartHelper.IsClearColor(color) && colorIndex >= 0) color = theme.GetColor(colorIndex);
|
||||||
if (setOpacity) ChartHelper.SetColorOpacity(ref color, opacity);
|
if (setOpacity) ChartHelper.SetColorOpacity(ref color, opacity);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user