修复Tooltip在微信小游戏平台上报错的兼容问题 (#326)

This commit is contained in:
monitor1394
2024-07-29 22:51:02 +08:00
parent 1bb9b455b4
commit 5853376a44
2 changed files with 14 additions and 1 deletions

View File

@@ -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`时指示内容不准确的问题

View File

@@ -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<Color, string> s_ColorToStr = new Dictionary<Color, string>(100);
private static Dictionary<int, string> s_SerieLabelName = new Dictionary<int, string>(1000);
private static Dictionary<Color, string> s_ColorDotStr = new Dictionary<Color, string>(100);
@@ -24,6 +24,18 @@ namespace XCharts.Runtime
private static Dictionary<int, Dictionary<string, string>> s_PrecisionToStr = new Dictionary<int, Dictionary<string, string>>();
private static Dictionary<string, Dictionary<int, string>> s_StringIntDict = new Dictionary<string, Dictionary<int, string>>();
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)