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

Allow SI prefixes to be set in locale. #43

Closed
wants to merge 1 commit into from

Conversation

nicksrandall
Copy link

This could serve as an escape hatch for somebody who wanted to support custom SI prefixes. This could be used to solve #33 (binary prefixes) or it could be used to support something custom like American english numbers (1,000,000,000 => 1B [billion] instead of 1G [giga]).

This could serve as an escape hatch for somebody who wanted to support custom SI prefixes. This could be used to solve d3#33 (binary prefixes) or it could be used to support something custom like American english numbers (1,000,000,000 => 1B [billion] instead of 1G [giga]).
@nicksrandall
Copy link
Author

This does however confuse the term SI prefix. Maybe a better solution would be to support more than one type of prefix.

For example, we could have:
"s" => SI Prefix
"b" => Binary Prefix
"c" => Custom prefix set via locale?

@mbostock
Copy link
Member

This wouldn’t address binary prefixes directly; binary prefixes use base two rather than base ten. For example the value 2^20 = 1,048,576 might be formatted as 1.00 Mi with a binary prefix but 1.05 M with a decimal SI prefix.

The simplicity of the implementation is attractive, but it feels wrong to overload the meaning of SI prefix since the whole idea is that SI is an international standard. Also, it’s not too hard to wrap a formatter function to replace the SI prefix with something else after formatting.

@mbostock
Copy link
Member

Closing in favor of #70. Thank you for your contribution!

@mbostock mbostock closed this Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants