react-d3 / react-d3-basic

Basic d3 charts in React.js, only include: line, bar, pie, scatter, area charts.
http://reactd3.org/docs/basic
221 stars 117 forks source link

How to set colors on pie slices? #20

Closed dbkaplun closed 8 years ago

chilijung commented 8 years ago

hi @dbkaplun, you can setup your slices color in chartSeries props, add a key called color in the field you want to add, and also you can control your styles in style key.

here is an example: https://github.com/react-d3/react-d3-basic/blob/master/example/src/pie.jsx#L17-L49

chartSeries = [
      {
        "field": "<5",
        "name": "less than 5",
        "color": "red",
        "style": {
          "fill-opacity": .2
        }
      },...
    ]