MCPcopy
hub / github.com/chartjs/Chart.js / _updateDatasets

Method _updateDatasets

src/core/core.controller.js:648–662  ·  src/core/core.controller.js::Chart._updateDatasets

* Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate` * hook, in which case, plugins will not be called on `afterDatasetsUpdate`. * @private

(mode)

Source from the content-addressed store, hash-verified

646 * @private
647 */
648 _updateDatasets(mode) {
649 if (this.notifyPlugins(class="st">'beforeDatasetsUpdate', {mode, cancelable: true}) === false) {
650 return;
651 }
652
653 for (let i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {
654 this.getDatasetMeta(i).controller.configure();
655 }
656
657 for (let i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {
658 this._updateDataset(i, isFunction(mode) ? mode({datasetIndex: i}) : mode);
659 }
660
661 this.notifyPlugins(class="st">'afterDatasetsUpdate', {mode});
662 }
663
664 /**
665 * Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`

Callers 1

updateMethod · 0.95

Calls 5

notifyPluginsMethod · 0.95
getDatasetMetaMethod · 0.95
_updateDatasetMethod · 0.95
isFunctionFunction · 0.85
configureMethod · 0.65

Tested by

no test coverage detected