d3-format icon indicating copy to clipboard operation
d3-format copied to clipboard

Fix for issue 134

Open GlenKelley opened this issue 3 years ago • 5 comments

This fixed the issue filed in https://github.com/d3/d3-format/issues/134

This changes the behaviour from:

>formatPrefix("(~s", 1e3)(-1e3)`
(1)k

To be:

>formatPrefix("(~s", 1e3)(-1e3)`
(1k) 

A side effect of this change is we now include the unit to be included in the padding length, e.g:

>formatPrefix("(~s", 1e3)(-1e3)`
      −$42.0M

Becomes:

>formatPrefix("(~s", 1e3)(-1e3)`
     −$42.0M

GlenKelley avatar Jan 20 '23 02:01 GlenKelley

👍

treloar avatar Jan 20 '23 04:01 treloar

👍 thanks for this!

declanjscott avatar Jan 20 '23 05:01 declanjscott

Note it would be cleaner if this was supported by the formatSpecifier, but that would require extending the format regex to support fixed suffix strings.

GlenKelley avatar Jan 20 '23 05:01 GlenKelley

@mbostock What is the process for getting this change approved+merged?

GlenKelley avatar Feb 01 '23 03:02 GlenKelley

I’ll get to it eventually. I appreciate your patience.

mbostock avatar Feb 01 '23 03:02 mbostock