[API][chart] RemoveAllSerie()

This commit is contained in:
monitor1394
2022-08-15 08:21:28 +08:00
parent 99dc2af42a
commit 990c6dad90
4 changed files with 26 additions and 11 deletions

View File

@@ -176,7 +176,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
| `CanMultipleComponent()` |public bool CanMultipleComponent(Type type)</br> |
| `ClampInChart()` |public void ClampInChart(ref Vector3 pos)</br> |
| `ClampInGrid()` |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)</br> |
| `ClearData()` |public virtual void ClearData()</br>Remove all series and legend data. |
| `ClearData()` |public virtual void ClearData()</br>Clear all components and series data. Note: serie only empties the data and does not remove serie. |
| `ClickLegendButton()` |public void ClickLegendButton(int legendIndex, string legendName, bool show)</br>点击图例按钮 |
| `CovertSerie()` |public bool CovertSerie(Serie serie, Type type)</br> |
| `CovertXYAxis()` |public void CovertXYAxis(int index)</br>转换X轴和Y轴的配置 |
@@ -244,12 +244,13 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
| `RefreshTopPainter()` |public void RefreshTopPainter()</br> |
| `RefreshUpperPainter()` |public void RefreshUpperPainter()</br> |
| `RemoveAllChartComponent()` |public void RemoveAllChartComponent()</br> |
| `RemoveAllSerie()` |public virtual void RemoveAllSerie()</br>Remove all of them Serie. This interface is used when Serie needs to be removed only, and RemoveData() is generally used in other cases. |
| `RemoveChartComponent()` |public bool RemoveChartComponent(MainComponent component)</br> |
| `RemoveChartComponent()` |public bool RemoveChartComponent(Type type, int index = 0)</br> |
| `RemoveChartComponent<T>()` |public bool RemoveChartComponent<T>(int index = 0)</br> |
| `RemoveChartComponents()` |public int RemoveChartComponents(Type type)</br> |
| `RemoveChartComponents<T>()` |public int RemoveChartComponents<T>()</br> |
| `RemoveData()` |public virtual void RemoveData()</br>Remove all data from series and legend. |
| `RemoveData()` |public virtual void RemoveData()</br>Empty all component data and remove all series. Use the chart again and again to tell the truth. Note: The component only clears the data part, and the parameters are retained and not reset. |
| `RemoveData()` |public virtual void RemoveData(string serieName)</br>Remove legend and serie by name. |
| `RemoveSerie()` |public void RemoveSerie(int serieIndex)</br> |
| `RemoveSerie()` |public void RemoveSerie(Serie serie)</br> |

View File

@@ -176,7 +176,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
| `CanMultipleComponent()` |public bool CanMultipleComponent(Type type)</br> |
| `ClampInChart()` |public void ClampInChart(ref Vector3 pos)</br> |
| `ClampInGrid()` |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)</br> |
| `ClearData()` |public virtual void ClearData()</br>It just emptying all of serie's data without emptying the list of series. |
| `ClearData()` |public virtual void ClearData()</br>清空所有组件和Serie的数据。注意Serie只是清空数据不会移除Serie |
| `ClickLegendButton()` |public void ClickLegendButton(int legendIndex, string legendName, bool show)</br>点击图例按钮 |
| `CovertSerie()` |public bool CovertSerie(Serie serie, Type type)</br> |
| `CovertXYAxis()` |public void CovertXYAxis(int index)</br>转换X轴和Y轴的配置 |
@@ -244,12 +244,13 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
| `RefreshTopPainter()` |public void RefreshTopPainter()</br> |
| `RefreshUpperPainter()` |public void RefreshUpperPainter()</br> |
| `RemoveAllChartComponent()` |public void RemoveAllChartComponent()</br> |
| `RemoveAllSerie()` |public virtual void RemoveAllSerie()</br>移除所有的Serie。当确认只需要移除Serie时使用该接口其他情况下一般用RemoveData()。 |
| `RemoveChartComponent()` |public bool RemoveChartComponent(MainComponent component)</br> |
| `RemoveChartComponent()` |public bool RemoveChartComponent(Type type, int index = 0)</br> |
| `RemoveChartComponent<T>()` |public bool RemoveChartComponent<T>(int index = 0)</br> |
| `RemoveChartComponents()` |public int RemoveChartComponents(Type type)</br> |
| `RemoveChartComponents<T>()` |public int RemoveChartComponents<T>()</br> |
| `RemoveData()` |public virtual void RemoveData()</br>The series list is also cleared. |
| `RemoveData()` |public virtual void RemoveData()</br>清空所有组件数据并移除所有Serie。一般在图表重新初始化时使用。 注意:组件只清空数据部分,参数会保留不会被重置。 |
| `RemoveData()` |public virtual void RemoveData(string serieName)</br>清除指定系列名称的数据。 |
| `RemoveSerie()` |public void RemoveSerie(int serieIndex)</br> |
| `RemoveSerie()` |public void RemoveSerie(Serie serie)</br> |

View File

@@ -172,9 +172,8 @@ namespace XCharts.Runtime
}
/// <summary>
/// Remove all series and legend data.
/// |It just emptying all of serie's data without emptying the list of series.
/// |清除所有数据,系列中只是移除数据,列表会保留。
/// Clear all components and series data. Note: serie only empties the data and does not remove serie.
/// |清空所有组件和Serie的数据。注意Serie只是清空数据不会移除Serie
/// </summary>
public virtual void ClearData()
{
@@ -187,9 +186,10 @@ namespace XCharts.Runtime
}
/// <summary>
/// Remove all data from series and legend.
/// |The series list is also cleared.
/// |清所有系列和图例数据,系列的列表也会被清除
/// Empty all component data and remove all series. Use the chart again and again to tell the truth.
/// Note: The component only clears the data part, and the parameters are retained and not reset.
/// |清所有组件数据并移除所有Serie。一般在图表重新初始化时使用
/// 注意:组件只清空数据部分,参数会保留不会被重置。
/// </summary>
public virtual void RemoveData()
{
@@ -201,6 +201,19 @@ namespace XCharts.Runtime
RefreshChart();
}
/// <summary>
/// Remove all of them Serie. This interface is used when Serie needs to be removed only, and RemoveData() is generally used in other cases.
/// |移除所有的Serie。当确认只需要移除Serie时使用该接口其他情况下一般用RemoveData()。
/// </summary>
[Since("v3.2.0")]
public virtual void RemoveAllSerie()
{
m_Series.Clear();
m_SerieHandlers.Clear();
m_CheckAnimation = false;
RefreshChart();
}
/// <summary>
/// Remove legend and serie by name.
/// |清除指定系列名称的数据。

View File

@@ -212,12 +212,12 @@ namespace XCharts.Runtime
chart.chartMinAnchor, chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
m_SerieLabelRoot.hideFlags = chart.chartHideFlags;
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
//ChartHelper.DestroyAllChildren(m_SerieLabelRoot.transform);
int count = 0;
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
for (int j = 0; j < serie.data.Count; j++)
{
var serieData = serie.data[j];
serieData.index = j;
serieData.labelObject = null;
if (AddSerieLabel(m_SerieLabelRoot, serieData, ref count))
{