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

Commit

Permalink
Merge pull request #42 from dehbmarques/master
Browse files Browse the repository at this point in the history
Update segment props when receive new props
  • Loading branch information
joshhornby committed Dec 5, 2015
2 parents eec2aee + 64720e5 commit 7a977a6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7a977a6

Please sign in to comment.