2021-01-11 08:54:28 +08:00
|
|
|
|
/************************************************/
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/************************************************/
|
2019-10-22 04:09:04 +08:00
|
|
|
|
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
2020-05-15 06:52:40 +08:00
|
|
|
|
namespace XCharts.Examples
|
2019-10-22 04:09:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
[DisallowMultipleComponent]
|
|
|
|
|
|
[ExecuteInEditMode]
|
|
|
|
|
|
[RequireComponent(typeof(PieChart))]
|
2020-05-15 06:52:40 +08:00
|
|
|
|
public class Example_PieChart : MonoBehaviour
|
2019-10-22 04:09:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
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(0, Random.Range(10, 100), "time" + count);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
int index = count % 5;
|
|
|
|
|
|
chart.UpdateData(0, Random.Range(10, 100), index);
|
|
|
|
|
|
}
|
|
|
|
|
|
count++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|