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

Negative values, when rounded to zero, are formatted with a plus sign. #92

Closed
mbostock opened this issue Apr 1, 2020 · 0 comments
Closed

Comments

@mbostock
Copy link
Member

mbostock commented Apr 1, 2020

For example:

d3.format("+.1%")(-0.0001) // "+0.0%"

This appears to be intentional:

// If a negative value rounds to zero during formatting, treat as positive.
if (valueNegative && +value === 0) valueNegative = false;

But this is pretty confusing, e.g. in this diverging bar chart:

Screen Shot 2020-04-01 at 11 15 23 AM

The code that does this references #42, and it’s not clear whether the fix for formatting -Infinity inadvertently broke formatting for negative near-zero values.

Fil pushed a commit that referenced this issue Jul 7, 2020
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

1 participant