From e07c21900909fff3c7ede0bbbabf6e86c2c270cf Mon Sep 17 00:00:00 2001 From: Tom Duncalf Date: Fri, 8 Apr 2016 15:15:46 +0100 Subject: [PATCH] Copy across the specified properties of each dataset when updating the chart - currently just hidden --- lib/core.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/core.js b/lib/core.js index 0d91e02..bbfe734 100644 --- a/lib/core.js +++ b/lib/core.js @@ -59,10 +59,18 @@ module.exports = { chart.data.labels = []; // Adds the datapoints from nextProps + var propsToCopy = ['hidden']; + nextProps.data.datasets.forEach(function(set, setIndex) { set.data.forEach(function(val, pointIndex) { chart.data.datasets[setIndex].data[pointIndex] = nextProps.data.datasets[setIndex].data[pointIndex]; }); + + propsToCopy.forEach(function(prop) { + if (nextProps.data.datasets[setIndex][prop] !== undefined) { + chart.data.datasets[setIndex][prop] = nextProps.data.datasets[setIndex][prop]; + } + }); }); // Sets the labels from nextProps @@ -118,4 +126,4 @@ module.exports = { return React.createClass(classData); } -}; \ No newline at end of file +};