susielu / d3-legend

A reusable d3 legend component.
http://d3-legend.susielu.com/
Apache License 2.0
727 stars 104 forks source link

ENH: labelFormat to support numeraljs format #80

Closed tejesh0 closed 6 years ago

tejesh0 commented 6 years ago

Numeraljs library has to be installed by the developer just like d3.

susielu commented 6 years ago

This is already available if you pass a custom function into labels, you would just do something like this:

var legend = d3.legendColor()
    .labels(({i, generatedLabels}) => numeral(d).format("0a"))
    .useClass(true)
    .scale(thresholdScale)