mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 18:30:14 +00:00
增加动态添加数据接口AddData
This commit is contained in:
14
Demo.cs
14
Demo.cs
@@ -5,19 +5,23 @@ public class Demo : MonoBehaviour
|
||||
{
|
||||
private LineChart lineChart;
|
||||
private float time;
|
||||
private int count;
|
||||
|
||||
void Awake () {
|
||||
void Awake()
|
||||
{
|
||||
lineChart = transform.Find("line_chart").GetComponent<LineChart>();
|
||||
}
|
||||
|
||||
void Update () {
|
||||
void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time >= 1)
|
||||
{
|
||||
time = 0;
|
||||
//lineChart.AddPoint("fps", Random.Range(24.0f, 60.0f));
|
||||
//lineChart.AddPoint("rtt", Random.Range(15, 30));
|
||||
//lineChart.AddPoint("ping", Random.Range(0, 100));
|
||||
count++;
|
||||
lineChart.AddXAxisCategory("key" + count);
|
||||
lineChart.AddData("line1", "key"+count, Random.Range(24.0f, 60.0f));
|
||||
lineChart.AddData("line2", "key"+count, Random.Range(24.0f, 60.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user