增加用代码添加动态正弦曲线的示例

This commit is contained in:
monitor1394
2019-07-19 23:17:06 +08:00
parent 6269c941b7
commit 1576308254
5 changed files with 131235 additions and 47328 deletions

View File

@@ -1,4 +1,5 @@
using UnityEngine;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
using System;
@@ -170,6 +171,29 @@ namespace XCharts
RefreshChart();
}
/// <summary>
/// Add a (x,y) data to serie
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="xValue">x data</param>
/// <param name="yValue">y data</param>
public virtual void AddXYData(string serieName, float xValue, float yValue)
{
m_Series.AddXYData(serieName, xValue, yValue, m_MaxCacheDataNumber);
RefreshChart();
}
/// <summary>
/// Add a (x,y) data to serie
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <param name="xValue">x data</param>
/// <param name="yValue">y data</param>
public virtual void AddXYData(int serieIndex, float xValue, float yValue)
{
m_Series.AddXYData(serieIndex, xValue, yValue, m_MaxCacheDataNumber);
RefreshChart();
}
/// <summary>
/// Update serie data by serie name.
/// </summary>

View File

@@ -151,6 +151,16 @@ namespace XCharts
return serie;
}
public Serie AddXYData(string serieName, float xValue, float yValue, int maxDataNumber = 0)
{
var serie = GetSerie(serieName);
if (serie != null)
{
serie.AddXYData(xValue, yValue, maxDataNumber);
}
return serie;
}
public Serie AddXYData(int index, float xValue, float yValue, int maxDataNumber = 0)
{
var serie = GetSerie(index);