diff --git a/lib/core.js b/lib/core.js index 9ef0bce..a93cba1 100644 --- a/lib/core.js +++ b/lib/core.js @@ -47,7 +47,10 @@ module.exports = { updatePoints(nextProps, chart, dataKey); if (chart.scale) { chart.scale.xLabels = nextProps.data.labels; + + if (chart.scale.calculateXLabelRotation){ chart.scale.calculateXLabelRotation(); + } } chart.update(); } @@ -108,6 +111,17 @@ var updatePoints = function(nextProps, chart, dataKey) { while(nextProps.data.length < chart.segments.length) { chart.removeData(); } + } else if (name === "Radar") { + chart.removeData(); + nextProps.data.datasets.forEach(function(set, setIndex) { + 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; + } + }); + }); } else { while (chart.scale.xLabels.length > nextProps.data.labels.length) { chart.removeData();