mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
增加API:AddData(),ClearSerieData(),ClearComponentData()
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.4.0](#v3.4.0)
|
||||
[v3.3.0](#v3.3.0)
|
||||
[v3.2.0](#v3.2.0)
|
||||
[v3.1.0](#v3.1.0)
|
||||
@@ -59,6 +60,9 @@
|
||||
|
||||
## master
|
||||
|
||||
## v3.4.0
|
||||
|
||||
* (2022.10.30) 增加`API`:`AddData()`、`ClearSerieData()`、`ClearComponentData()`
|
||||
* (2022.10.30) 增加`Axis`的`indicatorLabel`,移除`Tooltip`的`indicatorLabelStyle` (#226)
|
||||
* (2022.10.29) 增加`Serie`的`markColor`可设置标识颜色用于`Legend`和`Tooltip`的展示 (#229)
|
||||
* (2022.10.26) 增加`RadarCoord`的`startAngle`可设置`Radar`起始角度
|
||||
|
||||
@@ -159,11 +159,13 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| AddData() |public SerieData AddData(int serieIndex, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)|
|
||||
| AddData() |public SerieData AddData(int serieIndex, double xValue, double yValue, string dataName = null, string dataId = null)<br/>Add a (x,y) data to serie. |
|
||||
| AddData() |public SerieData AddData(int serieIndex, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>Add an arbitray dimension data to serie,such as (x,y,z,...). |
|
||||
| AddData() |public SerieData AddData(int serieIndex, params double[] multidimensionalData)<br/>Add an arbitray dimension data to serie,such as (x,y,z,...). |
|
||||
| AddData() |public SerieData AddData(string serieName, DateTime time, double yValue, string dataName = null, string dataId = null)<br/>Add a (time,y) data to serie. |
|
||||
| AddData() |public SerieData AddData(string serieName, double data, string dataName = null, string dataId = null)<br/>Add a data to serie. |
|
||||
| AddData() |public SerieData AddData(string serieName, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)|
|
||||
| AddData() |public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)<br/>Add a (x,y) data to serie. |
|
||||
| AddData() |public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>Add an arbitray dimension data to serie,such as (x,y,z,...). |
|
||||
| AddData() |public SerieData AddData(string serieName, params double[] multidimensionalData)<br/>Add an arbitray dimension data to serie,such as (x,y,z,...). |
|
||||
| AddSerie<T>() |public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie|
|
||||
| AddXAxisData() |public void AddXAxisData(string category, int xAxisIndex = 0)<br/>Add a category data to xAxis. |
|
||||
| AddXAxisIcon() |public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)<br/>Add an icon to xAxis. |
|
||||
@@ -181,7 +183,9 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| CanMultipleComponent() |public bool CanMultipleComponent(Type type)|
|
||||
| ClampInChart() |public void ClampInChart(ref Vector3 pos)|
|
||||
| ClampInGrid() |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)|
|
||||
| ClearComponentData() |public virtual void ClearComponentData()<br/>Clear the data of all components. |
|
||||
| ClearData() |public virtual void ClearData()<br/>Clear all components and series data. Note: serie only empties the data and does not remove serie. |
|
||||
| ClearSerieData() |public virtual void ClearSerieData()<br/>Clear the data of all series. |
|
||||
| ClickLegendButton() |public void ClickLegendButton(int legendIndex, string legendName, bool show)<br/>点击图例按钮 |
|
||||
| CovertSerie() |public bool CovertSerie(Serie serie, Type type)|
|
||||
| CovertSerie<T>() |public bool CovertSerie<T>(Serie serie) where T : Serie|
|
||||
|
||||
@@ -159,11 +159,13 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| AddData() |public SerieData AddData(int serieIndex, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)|
|
||||
| AddData() |public SerieData AddData(int serieIndex, double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到指定系列中。 |
|
||||
| AddData() |public SerieData AddData(int serieIndex, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>添加多维数据(x,y,z...)到指定的系列中。 |
|
||||
| AddData() |public SerieData AddData(int serieIndex, params double[] multidimensionalData)<br/>添加多维数据(x,y,z...)到指定的系列中。 |
|
||||
| AddData() |public SerieData AddData(string serieName, DateTime time, double yValue, string dataName = null, string dataId = null)<br/>添加(time,y)数据到指定的系列中。 |
|
||||
| AddData() |public SerieData AddData(string serieName, double data, string dataName = null, string dataId = null)<br/>If serieName doesn't exist in legend,will be add to legend. |
|
||||
| AddData() |public SerieData AddData(string serieName, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)|
|
||||
| AddData() |public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到指定系列中。 |
|
||||
| AddData() |public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>添加多维数据(x,y,z...)到指定的系列中。 |
|
||||
| AddData() |public SerieData AddData(string serieName, params double[] multidimensionalData)<br/>添加多维数据(x,y,z...)到指定的系列中。 |
|
||||
| AddSerie<T>() |public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie|
|
||||
| AddXAxisData() |public void AddXAxisData(string category, int xAxisIndex = 0)<br/>添加一个类目数据到指定的x轴。 |
|
||||
| AddXAxisIcon() |public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)<br/>添加一个图标到指定的x轴。 |
|
||||
@@ -181,7 +183,9 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| CanMultipleComponent() |public bool CanMultipleComponent(Type type)|
|
||||
| ClampInChart() |public void ClampInChart(ref Vector3 pos)|
|
||||
| ClampInGrid() |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)|
|
||||
| ClearComponentData() |public virtual void ClearComponentData()<br/>清空所有组件的数据。 |
|
||||
| ClearData() |public virtual void ClearData()<br/>清空所有组件和Serie的数据。注意:Serie只是清空数据,不会移除Serie。 |
|
||||
| ClearSerieData() |public virtual void ClearSerieData()<br/>清空所有serie的数据。 |
|
||||
| ClickLegendButton() |public void ClickLegendButton(int legendIndex, string legendName, bool show)<br/>点击图例按钮 |
|
||||
| CovertSerie() |public bool CovertSerie(Serie serie, Type type)|
|
||||
| CovertSerie<T>() |public bool CovertSerie<T>(Serie serie) where T : Serie|
|
||||
|
||||
@@ -187,9 +187,31 @@ namespace XCharts.Runtime
|
||||
/// |清空所有组件和Serie的数据。注意:Serie只是清空数据,不会移除Serie。
|
||||
/// </summary>
|
||||
public virtual void ClearData()
|
||||
{
|
||||
ClearSerieData();
|
||||
ClearComponentData();
|
||||
}
|
||||
|
||||
[Since("v3.4.0")]
|
||||
/// <summary>
|
||||
/// Clear the data of all series.
|
||||
/// |清空所有serie的数据。
|
||||
/// </summary>
|
||||
public virtual void ClearSerieData()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
serie.ClearData();
|
||||
m_CheckAnimation = false;
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
[Since("v3.4.0")]
|
||||
/// <summary>
|
||||
/// Clear the data of all components.
|
||||
/// |清空所有组件的数据。
|
||||
/// </summary>
|
||||
public virtual void ClearComponentData()
|
||||
{
|
||||
foreach (var component in m_Components)
|
||||
component.ClearData();
|
||||
m_CheckAnimation = false;
|
||||
|
||||
@@ -304,6 +304,46 @@ namespace XCharts.Runtime
|
||||
return null;
|
||||
}
|
||||
|
||||
[Since("v3.4.0")]
|
||||
/// <summary>
|
||||
/// Add an arbitray dimension data to serie,such as (x,y,z,...).
|
||||
/// |添加多维数据(x,y,z...)到指定的系列中。
|
||||
/// </summary>
|
||||
/// <param name="serieIndex">the index of serie</param>
|
||||
/// <param name="multidimensionalData">the (x,y,z,...) data</param>
|
||||
/// <returns></returns>
|
||||
public SerieData AddData(int serieIndex, params double[] multidimensionalData)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
{
|
||||
var serieData = serie.AddData(multidimensionalData);
|
||||
RefreshPainter(serie.painter);
|
||||
return serieData;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
[Since("v3.4.0")]
|
||||
/// <summary>
|
||||
/// Add an arbitray dimension data to serie,such as (x,y,z,...).
|
||||
/// |添加多维数据(x,y,z...)到指定的系列中。
|
||||
/// </summary>
|
||||
/// <param name="serieName">the name of serie</param>
|
||||
/// <param name="multidimensionalData">the (x,y,z,...) data</param>
|
||||
/// <returns></returns>
|
||||
public SerieData AddData(string serieName, params double[] multidimensionalData)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
{
|
||||
var serieData = serie.AddData(multidimensionalData);
|
||||
RefreshPainter(serie.painter);
|
||||
return serieData;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a (x,y) data to serie.
|
||||
/// |添加(x,y)数据到指定系列中。
|
||||
|
||||
@@ -1373,6 +1373,40 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加任意维数据到系列中。
|
||||
/// </summary>
|
||||
/// <param name="values">任意维数据</param>
|
||||
/// <returns></returns>
|
||||
public SerieData AddData(params double[] values)
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
string dataName = null;
|
||||
string dataId = null;
|
||||
if (values.Length == 1)
|
||||
return AddYData(values[0], dataName, dataId);
|
||||
else if (values.Length == 2)
|
||||
return AddXYData(values[0], values[1], dataName, dataId);
|
||||
else
|
||||
{
|
||||
CheckMaxCache();
|
||||
m_ShowDataDimension = values.Length;
|
||||
var serieData = SerieDataPool.Get();
|
||||
serieData.name = dataName;
|
||||
serieData.index = m_Data.Count;
|
||||
serieData.id = dataId;
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
serieData.data.Add(values[i]);
|
||||
}
|
||||
AddSerieData(serieData);
|
||||
SetVerticesDirty();
|
||||
CheckDataName(dataName);
|
||||
labelDirty = true;
|
||||
return serieData;
|
||||
}
|
||||
}
|
||||
|
||||
public SerieData AddChildData(SerieData parent, double value, string name, string id)
|
||||
{
|
||||
var serieData = new SerieData();
|
||||
|
||||
Reference in New Issue
Block a user