From 1b5f3d9fc1dfbcb70faf5ca73e38f8e717b5ebd5 Mon Sep 17 00:00:00 2001 From: Jacob Rapoport Date: Mon, 11 Nov 2019 18:21:30 -0800 Subject: [PATCH] support standard c# string formatters on axis labels --- Runtime/Component/Sub/AxisLabel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Runtime/Component/Sub/AxisLabel.cs b/Runtime/Component/Sub/AxisLabel.cs index b575257b..1fbd86a4 100644 --- a/Runtime/Component/Sub/AxisLabel.cs +++ b/Runtime/Component/Sub/AxisLabel.cs @@ -162,7 +162,7 @@ namespace XCharts else return ChartCached.FloatToStr(value, 1); } - else + else if (m_Formatter.Contains("{value")) { var content = m_Formatter; if (content.Contains("{value:f2}")) @@ -181,6 +181,8 @@ namespace XCharts content = content.Replace("\\n", "\n"); content = content.Replace("
", "\n"); return content; + } else { + return value.ToString(m_Formatter); } } }