Skip to content

Use a consistent format for numbers in dl graph #1645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2019

Conversation

bryanburgers
Copy link
Contributor

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.

@bryanburgers
Copy link
Contributor Author

screen shot 2019-03-04 at 9 32 31 pm

Before (de)

screen shot 2019-03-04 at 9 29 31 pm

After (de)

screen shot 2019-03-04 at 9 30 14 pm

After (en)

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.
@bryanburgers bryanburgers force-pushed the download-graph-numbering branch from 48618a8 to b2c36a0 Compare March 5, 2019 20:19
@sgrif
Copy link
Contributor

sgrif commented Mar 7, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 7, 2019

📌 Commit b2c36a0 has been approved by sgrif

@bors
Copy link
Contributor

bors commented Mar 7, 2019

⌛ Testing commit b2c36a0 with merge 5c75b14...

bors added a commit that referenced this pull request Mar 7, 2019
Use a consistent format for numbers in dl graph

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](https://developers.google.com/chart/interactive/docs/basic_load_libs#loadwithlocale), 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.
@bors
Copy link
Contributor

bors commented Mar 7, 2019

☀️ Test successful - checks-travis
Approved by: sgrif
Pushing 5c75b14 to master...

@bors bors merged commit b2c36a0 into rust-lang:master Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inconsistent number format in Stats Overview (point . with different meaning)
3 participants