From 0fb1cab302ed8eb03735ec6f3734b245ce1ed5bc Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 11 Mar 2024 07:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`Legend`=E7=9A=84`formatter`?= =?UTF-8?q?=E5=9C=A8=E8=AE=BE=E7=BD=AE`{d}`=E9=80=9A=E9=85=8D=E7=AC=A6?= =?UTF-8?q?=E6=97=B6=E6=98=BE=E7=A4=BA=E5=8F=AF=E8=83=BD=E4=B8=8D=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=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/Helper/FormatterHelper.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 5b6661d2..f55222af 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -72,6 +72,7 @@ slug: /changelog ## master +* (2024.03.11) 修复`Legend`的`formatter`在设置`{d}`通配符时显示可能不匹配的问题 * (2024.03.08) 修复`Tooltip`的`title`从旧版本升级后可能不显示的问题 ## v3.10.1 diff --git a/Runtime/Helper/FormatterHelper.cs b/Runtime/Helper/FormatterHelper.cs index 43fbd35c..6a9ac8ad 100644 --- a/Runtime/Helper/FormatterHelper.cs +++ b/Runtime/Helper/FormatterHelper.cs @@ -189,7 +189,7 @@ namespace XCharts.Runtime if (isPercent) { var total = serie.GetDataTotal(dimensionIndex, serie.GetSerieData(bIndex)); - var percent = total == 0 ? 0 : value / serie.yTotal * 100; + var percent = total == 0 ? 0 : value / total * 100; content = content.Replace(old, ChartCached.FloatToStr(percent, numericFormatter)); } else if (isTotal)