reactjs / react-chartjs

common react charting components using chart.js
MIT License
2.93k stars 301 forks source link

Doughnut's color, label do not change when receiving new props data #55

Open baohuy91 opened 8 years ago

baohuy91 commented 8 years ago

When I add new data for Doughnut chart, the value changes but not the label or color. Checking the code, it seems like the only change is value

if (name === 'PolarArea' || name === 'Pie' || name === 'Doughnut') {
    nextProps.data.forEach(function(segment, segmentIndex) {
      if (!chart.segments[segmentIndex]) {
        chart.addData(segment);
      } else {
        chart.segments[segmentIndex].value = segment.value;
      }
    });
  }

I don't want to use redraw because of ugly animation.