.dcss-precision-round
Tells you how many significant digits a rounded format needs for steps of a given size, up to a given value.
Example
Result
Markup
<link rel="stylesheet" href="dcss.css">
<link rel="stylesheet" href="families/array.css">
<link rel="stylesheet" href="families/format.css">
<div class="dcss-precision-round" style="--step: 0.01; --max: 1.01">
<output class="dcss-format-fixed" style="--value: var(--dcss-precision-round); --precision: 0"></output>
</div>
Browser support
| Browser | Support |
|---|---|
| Chrome | Yes |
| Safari | Yes |
| Firefox | Whole numbers only |
See also
d3.precisionRoundin d3’s documentation