Closed ivan-aksamentov closed 4 years ago
I'll pick this up, looks like d3 already has everything we need.
After some back and forth with libraries we ended up with numeral
library.
numeral
seems to be an abandoned library (last updated 3 years ago). And in particular there is a crash if you add numeralLocale
for Polish, eve though polish locale seems to be present in numeral
.
I found that numbro
is a spiritual suceessor (originally a fork) to numeral
with an old interface that is similar and a v2 interface with improvements. Many more locales also.
https://github.com/BenjaminVanRyseghem/numbro
http://numbrojs.com/
I reopen this for someone to pick up.
Alrighty, I'll do a swap for numbro now.
Only just got back around to this. Replace numeral with numbro. By default, French, German, and Portuguese locales use the same abbreviations as English.
I am using fr-Fr, de-De, and pt-Pt for locales. Some of the language variations use other endings if that would be preferred: see https://github.com/BenjaminVanRyseghem/numbro/blob/develop/languages/fr-CA.js.
🙋 Feature Request
🔦 Context
Currently the numbers in plot tooltips, and possibly in other places are displayed as raw values. for example:
which is completely unreadable.
😯 Describe the feature
We need to display those in a human-friendly manner
💻 Examples
See above
💁 Possible Solution
[ ] Wee need to preserve a number of significant digits (non-zeroes). I think d3 formatting library can do this pretty well.
[ ] Would be nice to also internationalize these strings.
[ ] !!!! Under no circumstances the actual runtime numbers should be rounded, converted or affected in any other way, only modify the displayed strings.
[ ] Optionally, please also add a global toggle, that switches between raw and human-friendly display (no need to add a widget, just make it so that a boolean can be passed in)
Related: https://github.com/neherlab/covid19_scenarios/issues/56