diff --git a/lib/core.js b/lib/core.js index cea5c05..5334e68 100644 --- a/lib/core.js +++ b/lib/core.js @@ -45,8 +45,10 @@ module.exports = { } else { dataKey = dataKey || dataKeys[chart.name]; updatePoints(nextProps, chart, dataKey); - chart.scale.xLabels = nextProps.data.labels; - chart.scale.calculateXLabelRotation(); + if (chart.scale) { + chart.scale.xLabels = nextProps.data.labels; + chart.scale.calculateXLabelRotation(); + } chart.update(); } }; @@ -97,7 +99,9 @@ var updatePoints = function(nextProps, chart, dataKey) { if (!chart.segments[segmentIndex]) { chart.addData(segment); } else { - chart.segments[segmentIndex].value = segment.value; + Object.keys(segment).forEach(function (key) { + chart.segments[segmentIndex][key] = segment[key]; + }); } }); } else {