diff --git a/lib/core.js b/lib/core.js index a93cba1..cd90899 100644 --- a/lib/core.js +++ b/lib/core.js @@ -47,7 +47,7 @@ module.exports = { updatePoints(nextProps, chart, dataKey); if (chart.scale) { chart.scale.xLabels = nextProps.data.labels; - + if (chart.scale.calculateXLabelRotation){ chart.scale.calculateXLabelRotation(); } @@ -127,11 +127,24 @@ var updatePoints = function(nextProps, chart, dataKey) { chart.removeData(); } nextProps.data.datasets.forEach(function(set, setIndex) { + // updating properties + Object.keys(set).forEach(function (prop) { + var val = set[prop]; + if (prop === 'data') return; // skip data + chart.datasets[setIndex][prop] = val; + }); + + // updating points set.data.forEach(function(val, pointIndex) { if (typeof(chart.datasets[setIndex][dataKey][pointIndex]) == "undefined") { addData(nextProps, chart, setIndex, pointIndex); } else { chart.datasets[setIndex][dataKey][pointIndex].value = val; + // update point color if available + if (set.pointColor) { + chart.datasets[setIndex][dataKey][pointIndex].fillColor = set.pointColor; + chart.datasets[setIndex][dataKey][pointIndex].highlightFill = set.pointColor; + } } }); });