-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Description
Discussed in #3687
Originally posted by xantiva April 17, 2024
Hi @swharden,
why do you use the InvariantCulture for the TickGenerators? That's not the best solution for non-english Windows.
| public static string DefaultLabelFormatter(double value) | |
| { | |
| CultureInfo culture = CultureInfo.InvariantCulture; | |
| // if the number is round or large, use the numeric format | |
| // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#the-numeric-n-format-specifier | |
| bool isRoundNumber = (int)value == value; | |
| bool isLargeNumber = Math.Abs(value) > 1000; | |
| if (isRoundNumber || isLargeNumber) | |
| return value.ToString("N0", culture); | |
| // otherwise the number is probably small or very precise to use the general format (with slight rounding) | |
| // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#the-general-g-format-specifier | |
| string label = Math.Round(value, 10).ToString("G", culture); | |
| return label == "-0" ? "0" : label; | |
| } |
I would expect that the current ui culture is used (in the TickGenerators and all places where numbers or dates will be shown):
CultureInfo culture = CultureInfo.CurrentUICulture;Best regards,
Mike
(This is my personal github account ;) )
Hi @xantiva! 👋 Picking up here, this seems like a mistake. This section of code was likely copy/pasted from ScottPlot 4 (where it may have been a mistake there too), but is definitely worth revisiting!
Reactions are currently unavailable