2019-05-15 09:44:18 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using XCharts;
|
|
|
|
|
|
|
2019-05-17 04:57:46 +08:00
|
|
|
|
[DisallowMultipleComponent]
|
|
|
|
|
|
[ExecuteInEditMode]
|
|
|
|
|
|
[RequireComponent(typeof(PieChart))]
|
2019-05-15 09:44:18 +08:00
|
|
|
|
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;
|
2019-06-21 09:34:33 +08:00
|
|
|
|
if (time > 1)
|
2019-05-15 09:44:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
time = 0;
|
2019-06-21 09:34:33 +08:00
|
|
|
|
if (count < 5)
|
2019-05-15 09:44:18 +08:00
|
|
|
|
{
|
2019-07-28 00:44:53 +08:00
|
|
|
|
chart.AddData(0, Random.Range(10, 100), "time" + count);
|
2019-05-15 09:44:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
int index = count % 5;
|
2019-07-28 00:44:53 +08:00
|
|
|
|
chart.UpdateData(0, Random.Range(10, 100),index);
|
2019-05-15 09:44:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
count++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|