-
Notifications
You must be signed in to change notification settings - Fork 103
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
Use minus sign instead of hyphen-minus by default? #62
Comments
I came here through Altair->vega-lite->vega, asking the same question. Some more details from my post which may help:
|
(This post was cross-posted to the Observable forum.) D3 did use the minus sign originally, but people complained about that, too (e.g., #595), primarily because there was an expectation that d3.format would use the same symbol as JavaScript’s number.toString. The minus sign was thus replaced with hyphen-minus in 2.10.0 (da3131c, #756). I’m somewhat ambivalent. Both are technically correct. I’m aware that hyphen-minus is a compromise from a time where good typesetting was largely impractical for computers. As I commented on the linked issue, I don’t think it’s reasonable to expect d3.format to be compatible with JavaScript’s number coercion, since the goal of d3.format is to format numbers for human consumption instead of machines. At any rate, we should at least allow you to override the minus sign in the locale, and perhaps it is worth reverting the adoption of hyphen-minus. |
This is now available as an opt-in by specifying the locale’s |
Hi there,
I really like how your library supports a lot of locales for formatting numbers.
I was wondering if there was a way to use the correct minus sign (instead of the hyphen character) for negative numbers? If not, I’d like to suggest this as an enhancement.
A bit of background: A hyphen is usually shorter than a minus and is aligned with the lowercase letters of a font (as it is used to break words across lines). A minus sign is longer (in most cases it’ll have the width of the plus sign) and is vertically aligned slightly higher (it is aligned with the figures, which in most fonts used in websites have the height of uppercase numbers). See the attached image for a comparison of
plus
,minus
andhyphen
character.Cheers and keep up the good work 🎉
The text was updated successfully, but these errors were encountered: