Skip to content
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

Docs: what does g modifier exactly do? #67

Closed
afanasy opened this issue Dec 3, 2018 · 2 comments
Closed

Docs: what does g modifier exactly do? #67

afanasy opened this issue Dec 3, 2018 · 2 comments

Comments

@afanasy
Copy link

afanasy commented Dec 3, 2018

It's not clear from the docs, why

d3.format('')(127) //gives 127
d3.format('g')(127) //gives 127.000

?

@mbostock
Copy link
Member

mbostock commented Dec 3, 2018

Drawing from the README:

The type​ (none) is also supported as shorthand for ~g (with a default precision of 12 instead of 6)

And:

The ~ option trims insignificant trailing zeros across all format types.

The trailing zeros are therefore stripped with (none), but not g.

@mbostock mbostock closed this as completed Dec 3, 2018
@afanasy
Copy link
Author

afanasy commented Dec 3, 2018

Thanks @mbostock! I was coming from the previous 1.2 version and missed the newly added ~ option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants