react-chartjs icon indicating copy to clipboard operation
react-chartjs copied to clipboard

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

Open baohuy91 opened this issue 10 years ago • 0 comments

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.

baohuy91 avatar Oct 13 '15 05:10 baohuy91