From 77c135ee081cb924ee4d1b0cc8427bfd8fc32339 Mon Sep 17 00:00:00 2001 From: Nathan Dao Date: Wed, 3 Jun 2015 00:24:43 +0300 Subject: [PATCH] jhudson8/react-chartjs#25 addData support for round charts --- lib/core.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/core.js b/lib/core.js index 0f41a30..9479f19 100644 --- a/lib/core.js +++ b/lib/core.js @@ -90,7 +90,11 @@ var updatePoints = function(nextProps, chart, dataKey) { if (name === 'PolarArea' || name === 'Pie' || name === 'Doughnut') { nextProps.data.forEach(function(segment, segmentIndex) { - chart.segments[segmentIndex].value = segment.value; + if (!chart.segments[segmentIndex]) { + chart.addData(segment); + } else { + chart.segments[segmentIndex].value = segment.value; + } }); } else { while (chart.scale.xLabels.length > nextProps.data.labels.length) {