From 0c92d08f0d2836d07f2849bc4b21125aa3e4fcba Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Tue, 23 Apr 2024 22:16:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`ConvertXYAxis()`=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1=E8=B0=83=E7=94=A8=E5=90=8E=E5=9B=BE=E8=A1=A8=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Runtime/Component/Axis/Axis.cs | 11 +++++++++++ Runtime/Internal/BaseChart.API.cs | 2 ++ Runtime/Internal/Basic/MainComponent.cs | 4 +++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 97e89f85..82101a24 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -73,6 +73,7 @@ slug: /changelog ## master +* (2024.04.23) 修复`ConvertXYAxis()`多次调用后图表异常的问题 * (2024.04.22) 修复`DataZoom`控制多个轴时的`GridCoord`获取可能不正确的问题 (#317) * (2024.04.22) 增加`GridCoord3D`3D坐标系 * (2024.04.15) 优化`DateTimeUtil`时间戳转`DateTime`接口时区的问题 diff --git a/Runtime/Component/Axis/Axis.cs b/Runtime/Component/Axis/Axis.cs index 696f37de..f9e6c4a9 100644 --- a/Runtime/Component/Axis/Axis.cs +++ b/Runtime/Component/Axis/Axis.cs @@ -459,6 +459,17 @@ namespace XCharts.Runtime base.SetComponentDirty(); } + /// + /// 重置状态。 + /// + public override void ResetStatus() + { + context.minValue = 0; + context.maxValue = 0; + context.destMinValue = 0; + context.destMaxValue = 0; + } + public Axis Clone() { var axis = new Axis(); diff --git a/Runtime/Internal/BaseChart.API.cs b/Runtime/Internal/BaseChart.API.cs index f61a647f..7383202d 100644 --- a/Runtime/Internal/BaseChart.API.cs +++ b/Runtime/Internal/BaseChart.API.cs @@ -532,6 +532,7 @@ namespace XCharts.Runtime xAxis.context.maxValue = 0; yAxis.context.minValue = 0; yAxis.context.maxValue = 0; + ResetChartStatus(); RefreshChart(); } } @@ -771,6 +772,7 @@ namespace XCharts.Runtime [Since("v3.10.0")] public void ResetChartStatus() { + foreach (var component in m_Components) component.ResetStatus(); foreach (var handler in m_SerieHandlers) handler.ForceUpdateSerieContext(); } } diff --git a/Runtime/Internal/Basic/MainComponent.cs b/Runtime/Internal/Basic/MainComponent.cs index 9bc4adca..ae7798b7 100644 --- a/Runtime/Internal/Basic/MainComponent.cs +++ b/Runtime/Internal/Basic/MainComponent.cs @@ -54,6 +54,8 @@ namespace XCharts.Runtime public virtual void Reset() { } + public virtual void ResetStatus() { } + public virtual void ClearData() { } public virtual void ClearDirty() @@ -120,7 +122,7 @@ namespace XCharts.Runtime internal override void SetComponent(MainComponent component) { - this.component = (T) component; + this.component = (T)component; } } } \ No newline at end of file