From 9117a198a1504c53641c17c756fd34a34a14ef7e Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Fri, 18 Sep 2020 22:24:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0`Remove=20All=20Chart=20Objec?= =?UTF-8?q?t`=E7=A7=BB=E9=99=A4=E5=9B=BE=E8=A1=A8=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=AD=90=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG-EN.md | 1 + CHANGELOG.md | 1 + Editor/BaseChartEditor.cs | 4 ++++ Runtime/API/BaseGraph_API.cs | 8 ++++++++ Runtime/Internal/CoordinateChart.cs | 1 - 5 files changed, 14 insertions(+), 1 deletion(-) 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); } }