mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 18:00:26 +00:00
优化切换主题显示效果
This commit is contained in:
17
Demo.cs
17
Demo.cs
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user