diff --git a/lib/core.js b/lib/core.js index 08a2f17..a2ee2ea 100644 --- a/lib/core.js +++ b/lib/core.js @@ -42,8 +42,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(); } }; @@ -95,7 +97,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 { @@ -121,4 +125,3 @@ var addData = function(nextProps, chart, setIndex, pointIndex) { }); chart.addData(values, nextProps.data.labels[setIndex]); }; -