mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
增加RingChart环形图
This commit is contained in:
50
Runtime/Helper/SerieHelper.cs
Normal file
50
Runtime/Helper/SerieHelper.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
internal static class SerieHelper
|
||||
{
|
||||
internal static Color GetItemBackgroundColor(Serie serie, ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
if (serie.itemStyle.backgroundColor != Color.clear)
|
||||
{
|
||||
var color = serie.itemStyle.backgroundColor;
|
||||
if (highlight) color *= color;
|
||||
color.a *= serie.itemStyle.opacity;
|
||||
return color;
|
||||
}
|
||||
else
|
||||
{
|
||||
var color = (Color)theme.GetColor(index);
|
||||
if (highlight) color *= color;
|
||||
color.a = 0.2f;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Color GetItemColor(Serie serie, ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
if (serie.itemStyle.color != Color.clear)
|
||||
{
|
||||
var color = serie.itemStyle.color;
|
||||
if (highlight) color *= color;
|
||||
color.a *= serie.itemStyle.opacity;
|
||||
return color;
|
||||
}
|
||||
else
|
||||
{
|
||||
var color = (Color)theme.GetColor(index);
|
||||
if (highlight) color *= color;
|
||||
color.a *= serie.itemStyle.opacity;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user