增加BarChart可用ItemStylebackgroundColor设置柱条背景颜色

This commit is contained in:
monitor1394
2020-03-17 09:13:55 +08:00
parent 39a48b7773
commit 5863b2700a
3 changed files with 31 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ namespace XCharts
{
internal static class SerieHelper
{
internal static Color GetItemBackgroundColor(Serie serie, SerieData serieData, ThemeInfo theme, int index, bool highlight)
internal static Color GetItemBackgroundColor(Serie serie, SerieData serieData, ThemeInfo theme, int index, bool highlight, bool useDefault = true)
{
var itemStyle = GetItemStyle(serie, serieData);
var color = Color.clear;
@@ -32,13 +32,14 @@ namespace XCharts
color.a *= itemStyle.opacity;
return color;
}
else
else if (useDefault)
{
color = (Color)theme.GetColor(index);
if (highlight) color *= color;
color.a = 0.2f;
return color;
}
return Color.clear;
}
internal static Color GetItemColor(Serie serie, SerieData serieData, ThemeInfo theme, int index, bool highlight)