From 9d982019dd98d2ea7cad782a4adc82ec3d7a2dcb Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Sat, 23 May 2026 22:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`DataZoom`=E5=86=85=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E7=9A=84=E6=8A=98=E7=BA=BF=E5=9B=BE=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=BC=9A=E8=B6=85=E5=87=BA=E8=8C=83=E5=9B=B4=E7=9A=84=E9=97=AE?= =?UTF-8?q?=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/DataZoom/DataZoomHandler.cs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 94351edc..7d644547 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -81,6 +81,7 @@ slug: /changelog ## master +* (2026.05.23) 修复`DataZoom`内绘制的折线图可能会超出范围的问题 * (2026.05.23) 修复`Axis`的`inverse`没能正确反转的问题 * (2026.05.23) 增加`LabelStyle`的`showCondition`,`showFilter`,`showThreshold`可控制`label`显示和隐藏 * (2026.05.22) 增加`LabelStyle`的`minGap`可避免`label`过于密集 diff --git a/Runtime/Component/DataZoom/DataZoomHandler.cs b/Runtime/Component/DataZoom/DataZoomHandler.cs index adec69f8..d1b47573 100644 --- a/Runtime/Component/DataZoom/DataZoomHandler.cs +++ b/Runtime/Component/DataZoom/DataZoomHandler.cs @@ -577,12 +577,11 @@ namespace XCharts.Runtime float scaleWid = showData.Count > 1 ? dataZoom.context.width / (showData.Count - 1) : dataZoom.context.width; Vector3 lp = Vector3.zero; Vector3 np = Vector3.zero; - double minValue = 0; - double maxValue = 0; + double minValue; + double maxValue; SeriesHelper.GetYMinMaxValue(chart, 0, axis.inverse, out minValue, out maxValue, false, false); - AxisHelper.AdjustMinMaxValue(axis, ref minValue, ref maxValue, true); - - // Check if x-axis is value/time type for accurate shadow x-positioning + minValue = ChartHelper.GetMinDivisibleValue(minValue, 0); + maxValue = ChartHelper.GetMaxDivisibleValue(maxValue, 0); double xMinValue = 0; double xMaxValue = 0; bool useXValueForShadow = false; @@ -710,11 +709,11 @@ namespace XCharts.Runtime float scaleWid = dataZoom.context.height / (showData.Count - 1); Vector3 lp = Vector3.zero; Vector3 np = Vector3.zero; - double minValue = 0; - double maxValue = 0; + double minValue; + double maxValue; SeriesHelper.GetYMinMaxValue(chart, 0, axis.inverse, out minValue, out maxValue); - AxisHelper.AdjustMinMaxValue(axis, ref minValue, ref maxValue, true); - + minValue = ChartHelper.GetMinDivisibleValue(minValue, 0); + maxValue = ChartHelper.GetMaxDivisibleValue(maxValue, 0); int rate = 1; var sampleDist = serie.sampleDist < 2 ? 2 : serie.sampleDist; var maxCount = showData.Count;