From ccf815c85375680c154b01f8acf32f1f959204e6 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 7 Apr 2025 22:30:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96`Axis`=E7=9A=84`Time`?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=BD=B4=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?Custom=E5=92=8CceilRate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 2 ++ Runtime/Component/Axis/AxisHelper.cs | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index a505c119..77b0c23e 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -80,6 +80,8 @@ slug: /changelog ## master +* (2025.04.07) 修复`Gantt`甘特图在有多维数据时计算的时间区间不准确的问题 +* (2025.04.07) 优化`Axis`的`Time`时间轴支持设置Custom和ceilRate * (2025.04.07) 修复`GridCoord`在设置背景色且Serie开启Clip时会覆盖图表的问题 * (2025.04.07) 修复`Gantt`甘特图年份大于2038时显示异常的问题 * (2025.04.07) 修复`Axis`的`Time`时间轴无法显示大于2038的年份的问题 diff --git a/Runtime/Component/Axis/AxisHelper.cs b/Runtime/Component/Axis/AxisHelper.cs index 6131828a..b1883479 100644 --- a/Runtime/Component/Axis/AxisHelper.cs +++ b/Runtime/Component/Axis/AxisHelper.cs @@ -354,8 +354,8 @@ namespace XCharts.Runtime axis.splitNumber = splitNumber; return; } - if (axis.type == Axis.AxisType.Time) { } - else if (axis.minMaxType == Axis.AxisMinMaxType.Custom) + if (ceilRate == 0) ceilRate = axis.ceilRate; + if (axis.minMaxType == Axis.AxisMinMaxType.Custom) { if (axis.min != 0 || axis.max != 0) { @@ -371,13 +371,19 @@ namespace XCharts.Runtime } } } + else if (axis.type == Axis.AxisType.Time) + { + if (ceilRate != 0) + { + minValue = ChartHelper.GetMinCeilRate(minValue, ceilRate); + maxValue = ChartHelper.GetMaxCeilRate(maxValue, ceilRate); + } + } else { - if (ceilRate == 0) ceilRate = axis.ceilRate; switch (axis.minMaxType) { case Axis.AxisMinMaxType.Default: - if (minValue == 0 && maxValue == 0) { } else if (minValue > 0 && maxValue > 0) {