mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 07:20:08 +00:00
0.2版本,重构代码,增加Editor
This commit is contained in:
28
Demo/Scripts/Demo_Test.cs
Normal file
28
Demo/Scripts/Demo_Test.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XCharts;
|
||||
|
||||
public class Demo_Test : MonoBehaviour
|
||||
{
|
||||
private CoordinateChart chart;
|
||||
private float time;
|
||||
private int count;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponentInChildren<CoordinateChart>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time >= 1)
|
||||
{
|
||||
time = 0;
|
||||
count++;
|
||||
chart.UpdateData(0, Random.Range(60, 150));
|
||||
chart.AddXAxisData("time" + count);
|
||||
chart.AddData(0, Random.Range(60, 150));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user