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

formatPrefix vs format handling of parentheses #142

Open
laventnc opened this issue Oct 13, 2023 · 0 comments
Open

formatPrefix vs format handling of parentheses #142

laventnc opened this issue Oct 13, 2023 · 0 comments

Comments

@laventnc
Copy link

When using 'formatPrefix' (which is preferred because it treats the precision as the number of digits past the decimal) it places the si prefix outside of the parentheses.

'format' handles this correctly, although it requires us to calculate the number of significant digits to the left of the decimal to arrive at similar functionality.

see:

const val = -694712
d3.formatPrefix("($.0~", val)(val)
// ($695)k
d3.format("($.3s")(val)
// ($695k)
@laventnc laventnc changed the title formatPrefix vs format handling of parenthesis formatPrefix vs format handling of parentheses Oct 16, 2023
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