From 5853376a445413f8d1b6c20ed294be00bc8e9312 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 29 Jul 2024 22:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`Tooltip`=E5=9C=A8=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=B0=8F=E6=B8=B8=E6=88=8F=E5=B9=B3=E5=8F=B0=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#326)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Runtime/Internal/Utilities/ChartCached.cs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 1604a648..b3f6472b 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -75,6 +75,7 @@ slug: /changelog ## master +* (2024.07.29) 修复`Tooltip`在微信小游戏平台上报错的兼容问题 (#326) * (2024.07.27) 调整`Axis`的`AxisName`的默认位置 * (2024.07.22) 优化`Pie`的`Label`在`Tooltip`触发时的表现 * (2024.07.21) 修复`Tooltip`在开启`DataZoom`时指示内容不准确的问题 diff --git a/Runtime/Internal/Utilities/ChartCached.cs b/Runtime/Internal/Utilities/ChartCached.cs index cda8bbb8..1a07f332 100644 --- a/Runtime/Internal/Utilities/ChartCached.cs +++ b/Runtime/Internal/Utilities/ChartCached.cs @@ -12,7 +12,7 @@ namespace XCharts.Runtime private const string NUMERIC_FORMATTER_X = "X"; private const string NUMERIC_FORMATTER_x = "x"; private static readonly string s_DefaultAxis = "axis_"; - private static CultureInfo ci = new CultureInfo("en-us"); // "en-us", "zh-cn", "ar-iq", "de-de" + private static CultureInfo ci = GetDefaultCultureInfo(); // "en-us", "zh-cn", "ar-iq", "de-de" private static Dictionary s_ColorToStr = new Dictionary(100); private static Dictionary s_SerieLabelName = new Dictionary(1000); private static Dictionary s_ColorDotStr = new Dictionary(100); @@ -24,6 +24,18 @@ namespace XCharts.Runtime private static Dictionary> s_PrecisionToStr = new Dictionary>(); private static Dictionary> s_StringIntDict = new Dictionary>(); + private static CultureInfo GetDefaultCultureInfo() + { + try + { + return new CultureInfo("en-us"); + } + catch (Exception) + { + return CultureInfo.InvariantCulture; + } + } + public static string FloatToStr(double value, string numericFormatter = "F", int precision = 0) { if (precision > 0 && numericFormatter.Length == 1)