优化切换主题显示效果

This commit is contained in:
monitor1394
2018-10-02 08:57:47 +08:00
parent b38e758351
commit 16754d1a49
5 changed files with 72 additions and 61 deletions

17
Demo.cs
View File

@@ -4,9 +4,12 @@ using xcharts;
public class Demo : MonoBehaviour
{
public Theme theme = Theme.Dark;
private LineChart lineChart;
private float time;
private int count;
private Theme checkTheme = Theme.Dark;
void Awake()
{
@@ -34,5 +37,19 @@ public class Demo : MonoBehaviour
//lineChart.AddData("line1", "key"+count, Random.Range(24.0f, 60.0f));
//lineChart.AddData("line2", "key"+count, Random.Range(24.0f, 60.0f));
}
if(checkTheme != theme)
{
checkTheme = theme;
UpdateTheme(theme);
}
}
void UpdateTheme(Theme theme)
{
var charts = transform.Find("xchart").GetComponentsInChildren<BaseChart>();
foreach(var chart in charts)
{
chart.UpdateTheme(theme);
}
}
}