susielu / d3-legend

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

Commas, Decimals, and SI Abbreviations in Legend Labels #22

Closed reggie3 closed 8 years ago

reggie3 commented 8 years ago

Is it currently possible to use combinations of commas, decimals, and SI abbreviations in legend text labels? For example a label like "1.3M to 2.52M" for values of 1,300,000 to 2,520,000.

susielu commented 8 years ago

Yes you can use the label format property

Documentation for one of the scales:

.labelFormat(d3.format)

Takes a d3.format and applies that styling to the legend labels. Default is set to d3.format(".01f").

Thanks, Susie

On Sat, Jan 16, 2016 at 7:30 PM, reggie3 notifications@github.com wrote:

Is it currently possible to use combinations of commas, decimals, and SI abbreviations in legend text labels? For example a label like "1.3M to 2.52M" for values of 1,300,000 to 2,520,000.

— Reply to this email directly or view it on GitHub https://github.com/susielu/d3-legend/issues/22.