.dcss-format-general
Prints a number to a given count of significant digits.
Example
Result
Markup
<link rel="stylesheet" href="dcss.css">
<link rel="stylesheet" href="families/format.css">
<output class="dcss-format-general" style="--value: 3.14159; --precision: 4; --trim: 1"></output>
Notes
Set --comma, --sign, --symbol or --trim to 1 to turn that flag on. Inside an element with lang, a format prints in that language and region, from d3-format's locale table: lang="de-DE" prints 1.234,50, and --symbol: 1 adds its currency, € there. A language alone (de) or a region the table doesn't have (de-AT) prints as en-US. The table's locales are ar-AE to ar-YE, ca-ES, cs-CZ, da-DK, de-CH, de-DE, en-GB, en-IE, en-IN, es-BO, es-ES, fi-FI, fr-CA, fr-FR, he-IL, hu-HU, it-IT, ja-JP, ko-KR, mk-MK, nl-NL, pl-PL, pt-BR, pt-PT, ru-RU, sl-SI, sv-SE, uk-UA and zh-CN.
Browser support
| Browser | Support |
|---|---|
| Chrome | Yes |
| Safari | Yes |
| Firefox | Whole numbers only |
See also
d3.formatin d3’s documentation