Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit 7a977a6

Browse files
committed
Merge pull request #42 from dehbmarques/master
Update segment props when receive new props
2 parents eec2aee + 64720e5 commit 7a977a6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/core.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ module.exports = {
4545
} else {
4646
dataKey = dataKey || dataKeys[chart.name];
4747
updatePoints(nextProps, chart, dataKey);
48-
chart.scale.xLabels = nextProps.data.labels;
49-
chart.scale.calculateXLabelRotation();
48+
if (chart.scale) {
49+
chart.scale.xLabels = nextProps.data.labels;
50+
chart.scale.calculateXLabelRotation();
51+
}
5052
chart.update();
5153
}
5254
};
@@ -97,7 +99,9 @@ var updatePoints = function(nextProps, chart, dataKey) {
9799
if (!chart.segments[segmentIndex]) {
98100
chart.addData(segment);
99101
} else {
100-
chart.segments[segmentIndex].value = segment.value;
102+
Object.keys(segment).forEach(function (key) {
103+
chart.segments[segmentIndex][key] = segment[key];
104+
});
101105
}
102106
});
103107
} else {

0 commit comments

Comments
 (0)