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

Commit 750ee87

Browse files
committed
dynamically remove data from chart. Auto rotate x-scale labels.
1 parent 13fe5be commit 750ee87

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/core.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports = {
4343
dataKey = dataKey || dataKeys[chart.name];
4444
updatePoints(nextProps, chart, dataKey);
4545
chart.scale.xLabels = nextProps.data.labels;
46+
chart.scale.calculateXLabelRotation();
4647
chart.update();
4748
}
4849
};
@@ -92,6 +93,9 @@ var updatePoints = function(nextProps, chart, dataKey) {
9293
chart.segments[segmentIndex].value = segment.value;
9394
});
9495
} else {
96+
while (chart.scale.xLabels.length > nextProps.data.labels.length) {
97+
chart.removeData();
98+
}
9599
nextProps.data.datasets.forEach(function(set, setIndex) {
96100
set.data.forEach(function(val, pointIndex) {
97101
if (typeof(chart.datasets[setIndex][dataKey][pointIndex]) == "undefined") {

0 commit comments

Comments
 (0)