mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
When only the dataset array changes scales did not update correctly. This was due to the fact that the new datasets did not have scale IDs yet. By building the controllers first, the IDs are mapped if necessary. Then we can correctly update scales.
This commit is contained in:
parent
3b750e7f27
commit
d689e0fc47
@ -180,13 +180,12 @@
|
||||
|
||||
if (dataset.controller) {
|
||||
dataset.controller.updateIndex(datasetIndex);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
dataset.controller = new Chart.controllers[type](this, datasetIndex);
|
||||
|
||||
dataset.controller = new Chart.controllers[type](this, datasetIndex);
|
||||
|
||||
if (resetNewControllers) {
|
||||
dataset.controller.reset();
|
||||
if (resetNewControllers) {
|
||||
dataset.controller.reset();
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
@ -210,11 +209,11 @@
|
||||
// In case the entire data object changed
|
||||
this.tooltip._data = this.data;
|
||||
|
||||
Chart.scaleService.update(this, this.chart.width, this.chart.height);
|
||||
|
||||
// Make sure dataset controllers are updated and new controllers are reset
|
||||
this.buildOrUpdateControllers(true);
|
||||
|
||||
Chart.scaleService.update(this, this.chart.width, this.chart.height);
|
||||
|
||||
// Make sure all dataset controllers have correct meta data counts
|
||||
helpers.each(this.data.datasets, function(dataset, datasetIndex) {
|
||||
dataset.controller.buildOrUpdateElements();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user