mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 18:30:14 +00:00
整理显示10000数据的demo
This commit is contained in:
@@ -20,22 +20,24 @@ public class Demo_LargeData : MonoBehaviour
|
|||||||
timeNow = System.DateTime.Now;
|
timeNow = System.DateTime.Now;
|
||||||
chart.ClearAxisData();
|
chart.ClearAxisData();
|
||||||
chart.series.ClearData();
|
chart.series.ClearData();
|
||||||
chart.maxCacheDataNumber = maxCacheDataNumber;
|
chart.maxCacheDataNumber = 0;
|
||||||
timeNow = timeNow.AddSeconds(-maxCacheDataNumber);
|
chart.title.text = maxCacheDataNumber + "数据";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (initCount < maxCacheDataNumber)
|
if (initCount < maxCacheDataNumber)
|
||||||
{
|
{
|
||||||
int count = (int)(maxCacheDataNumber / initDataTime * Time.deltaTime);
|
for (int i = 0; i < 10; i++)
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
timeNow = timeNow.AddSeconds(1);
|
|
||||||
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
|
||||||
chart.AddData(0, UnityEngine.Random.Range(60, 150));
|
|
||||||
initCount++;
|
initCount++;
|
||||||
if (initCount > maxCacheDataNumber) break;
|
if (initCount > maxCacheDataNumber) break;
|
||||||
|
chart.title.text = initCount+"数据";
|
||||||
|
timeNow = timeNow.AddSeconds(1);
|
||||||
|
float xvalue = Mathf.PI / 180 * initCount;
|
||||||
|
float yvalue = Mathf.Sin(xvalue);
|
||||||
|
chart.AddData(0, 15 + yvalue * 2);
|
||||||
|
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -81,7 +81,6 @@ namespace XCharts
|
|||||||
/// <param name="height">height</param>
|
/// <param name="height">height</param>
|
||||||
public virtual void SetSize(float width, float height)
|
public virtual void SetSize(float width, float height)
|
||||||
{
|
{
|
||||||
Debug.LogError("setsize:" + m_CheckWidth + "," + m_CheckHeight + "," + width + height);
|
|
||||||
m_ChartWidth = width;
|
m_ChartWidth = width;
|
||||||
m_ChartHeight = height;
|
m_ChartHeight = height;
|
||||||
m_CheckWidth = width;
|
m_CheckWidth = width;
|
||||||
|
|||||||
Reference in New Issue
Block a user