Use a consistent format for numbers in dl graph #1645
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When formatting download numbers in the download graph, use a consistent numbering format for both raw numbers and the rolling 7-day average.
There are cases where the user's local can make inconsistent formatting. Specifically, we use
Number.prototype.toFixed
to format the rolling 7-day average, which always results in a number format that uses a decimal point (e.g. "1234.56"). However, the raw download numbers end up using the locale, which in some places can end up formatting the number with a decimal as the thousands separator ("1.234").To fix this, use google.visualization.NumberFormat for both values, so that they are always consistent.
Fixes #1628
Note that I couldn't fully test this, because even after changing my browser's language to
de
, I would still see English number formatting. I did test it by forcing the Google Visualization chart locale, but I'm still not 100% sure if the numbers will show in a German format for a German viewer.I am, however, sure that they will always show in a consistent format.