mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 21:40:41 +00:00
完善数据操作接口
This commit is contained in:
34
Demo/Scripts/Demo_PieChart.cs
Normal file
34
Demo/Scripts/Demo_PieChart.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
public class Demo_PieChart : MonoBehaviour
|
||||
{
|
||||
private PieChart chart;
|
||||
private float time;
|
||||
private int count = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
chart = transform.GetComponent<PieChart>();
|
||||
chart.ClearData();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if(time > 1 )
|
||||
{
|
||||
time = 0;
|
||||
if(count < 5)
|
||||
{
|
||||
chart.AddData("time" + count, Random.Range(10, 100));
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = count % 5;
|
||||
chart.UpdateData("time" + index, Random.Range(10, 100));
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user