diff --git a/CHANGELOG-EN.md b/CHANGELOG-EN.md index e308d64e..3143d7be 100644 --- a/CHANGELOG-EN.md +++ b/CHANGELOG-EN.md @@ -1,6 +1,7 @@ # 更新日志 +* (2020.09.18) Added `Remove All Chart Object` to Remove All child nodes under the Chart (automatically reinitialized) * (2020.09.18) Fixed `SerieLabel` also displayed after hided `Serie` by clicked the legend #94 * (2020.09.18) Optimize coordinate axis calibration and text display #93 * (2020.09.17) fixed `Package` import missing `meta` file causing failure #92 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0235e5ad..a2644fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # 更新日志 +* (2020.09.18) 增加`Remove All Chart Object`移除图表下的所有子节点(会自动重新初始化) * (2020.09.18) 修复`SerieLabel`在点击图例隐藏`Serie`后还显示的问题#94 * (2020.09.18) 优化坐标轴刻度和文本显示#93 * (2020.09.17) 修复`Package`导入时缺失`meta`文件导致失败的问题#92 diff --git a/Editor/BaseChartEditor.cs b/Editor/BaseChartEditor.cs index 33ed686d..5e9c1bbb 100644 --- a/Editor/BaseChartEditor.cs +++ b/Editor/BaseChartEditor.cs @@ -116,6 +116,10 @@ namespace XCharts private void CheckWarning() { + if (GUILayout.Button("Remove All Chart Object")) + { + m_Target.RemoveChartObject(); + } if (GUILayout.Button("Check XCharts Update ")) { CheckVersionEditor.ShowWindow(); diff --git a/Runtime/API/BaseGraph_API.cs b/Runtime/API/BaseGraph_API.cs index 39178d0b..3853f2bd 100644 --- a/Runtime/API/BaseGraph_API.cs +++ b/Runtime/API/BaseGraph_API.cs @@ -134,5 +134,13 @@ namespace XCharts warningInfo = CheckHelper.CheckChart(this); return warningInfo; } + + /// + /// 移除所有图表子节点,会自动重现初始化。 + /// + public void RemoveChartObject() + { + ChartHelper.DestroyAllChildren(transform); + } } } diff --git a/Runtime/Internal/CoordinateChart.cs b/Runtime/Internal/CoordinateChart.cs index a7ffff06..a67415c7 100644 --- a/Runtime/Internal/CoordinateChart.cs +++ b/Runtime/Internal/CoordinateChart.cs @@ -1543,7 +1543,6 @@ namespace XCharts } else { - Debug.LogError("lable not show:" + i + "," + j); serieData.SetLabelActive(false); } }