codesuki / react-d3-components

D3 Components for React
http://codesuki.github.io/react-d3-components/example.html
MIT License
1.63k stars 206 forks source link

Title and labels #136

Closed diversos closed 6 years ago

diversos commented 6 years ago

I feel like this might be a simple thing, but I can't seem to find the way to add a title and labels to my charts. For the labels I only really need the color matching the data.label being used, or the color and a custom label, idk how you'd do it. Thanks in advance.

codesuki commented 6 years ago

I would make a custom color scale var colorScale = d3.scale.category20(); and pass it to the chart <BarChart colorScale={colorScale} ... /> From that I would not which colors are used and could make a normal HTML labels.

Hope that helps.