From 41d01f0555e24f407202e47da7f5db700214e21b Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 4 May 2020 14:25:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96numericFormatter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/XCharts/CHANGELOG.md | 2 +- Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Assets/XCharts/CHANGELOG.md b/Assets/XCharts/CHANGELOG.md index ba2dd34f..e9569cab 100644 --- a/Assets/XCharts/CHANGELOG.md +++ b/Assets/XCharts/CHANGELOG.md @@ -1,7 +1,7 @@ # 更新日志 -* (2020.04.28) 增加`numericFormatter`参数可配置数值格式化显示,去掉`forceENotation`参数 +* (2020.05.04) 增加`numericFormatter`参数可配置数值格式化显示,去掉`forceENotation`参数 * (2020.04.28) 增加`自由锚点`支持,任意对齐方式 * (2020.04.23) 优化`ScatterChart`的`Tooltip`显示效果 * (2020.04.23) 增加`Tooltip`的`formatter`对`{.}`、`{c:0}`、`{c1:1}`的支持 diff --git a/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs b/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs index 260f5cde..63091abe 100644 --- a/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs +++ b/Assets/XCharts/Runtime/Component/Sub/AxisLabel.cs @@ -264,10 +264,7 @@ namespace XCharts content = m_Formatter.Replace("{value:f1}", ChartCached.FloatToStr(value, string.Empty, 1)); else if (content.Contains("{value}")) { - if (value - (int)value == 0) - content = m_Formatter.Replace("{value}", ChartCached.IntToStr((int)value)); - else - content = m_Formatter.Replace("{value}", ChartCached.FloatToStr(value, string.Empty, 1)); + content = m_Formatter.Replace("{value}", ChartCached.NumberToStr((int)value, numericFormatter)); } content = content.Replace("\\n", "\n");