Trying to get the axis number formatting right in Plotly - all I want is to show 5 sigfigs while omitting trailing zeroes.
I’m having a hard time getting the effect described in this PR to work. https://github.com/d3/d3-format/pull/57
The syntax described in the PR isn’t in the documentation https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format
Basically - is there a way to get rid of these trailing zeroes? I need to properly display arbitrarily small numbers (e.g. 0.00123), so simple truncation won’t work - I need a true sigfig method that omits trailing zeroes
format = ".5g" f = d3.format(format); f(0.00123) ==> 0.0012300 ☹ f(40) ==> 40.000 ☹ f(5180.159999999996) ==> 5180.2 🙂 f(999999) ==> 1.0000e+6 🙂