Open
Description
Many d3
functions use the presence of an argument to control their behavior -- if an argument is passed, it used to update the object, and if it's missing then the current value is returned. For instance d3.scaleLinear().domain([0,1])
vs d3.scaleLinear().domain()
.
It would be handy if d3.formatLocale
could be used this same way in order to return the current locale settings (likely the defaults if the user hasn't called d3.formatDefaultLocale
) so that the user could modify just one of them before passing the updated definition list back to d3.formatLocale
. For instance,
const definition = d3.formatLocale();
definition.minus = "-" // Replace the default unicode minus character with a hyphen
// Leave everything else, such as commas and the decimal separator, as the en-US default
const formatter = d3.formatLocale(definition).format(",.2f")
Metadata
Metadata
Assignees
Labels
No labels