Closed ramnathv closed 9 years ago
Got it, that's a good idea. It would be lovely if you could make a PR. Thanks for the feedback!
This has been added to all of the legend types. There is a new property called classPrefix it appends the prefix to all of the classes used in d3.legend: .cell, .label, .swatch, .legendCells, .legendTitle so as an example if you sent it a prefix of "blue" they would all become .bluecell, .bluelabel, .blueswatch, .bluelegendCells, .bluelegendTitle
First off, awesome work with this library. It really makes legends super easy!
One issue I ran into while using
d3-legend
was namespace clashes. For example, the labels ind3-legend
have the classlabel
, and if you use it withbootstrap
, they look really weird as the fonts are displayed at 75% of their size.One way to solve this issue would be to allow uses to specify a prefix for all classes introduced by
d3-legend
. It could default to""
to maintain backward compatibility. This way, one could specify a prefixd3-legend-
and style appropriately, without having to worry about namespace clashes.I would be happy to contribute a PR if you think this is something you would like to incorporate.