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

Method _getUniformDataChanges

src/core/core.controller.js:581–604  ·  view source on GitHub ↗

* @private

()

Source from the content-addressed store, hash-verified

579 * @private
580 */
581 _getUniformDataChanges() {
582 const _dataChanges = this._dataChanges;
583 if (!_dataChanges || !_dataChanges.length) {
584 return;
585 }
586
587 this._dataChanges = [];
588 const datasetCount = this.data.datasets.length;
589 const makeSet = (idx) => new Set(
590 _dataChanges
591 .filter(c => c[0] === idx)
592 .map((c, i) => i + ',' + c.splice(1).join(','))
593 );
594
595 const changeSet = makeSet(0);
596 for (let i = 1; i < datasetCount; i++) {
597 if (!setsEqual(changeSet, makeSet(i))) {
598 return;
599 }
600 }
601 return Array.from(changeSet)
602 .map(c => c.split(','))
603 .map(a => ({method: a[1], start: +a[2], count: +a[3]}));
604 }
605
606 /**
607 * Updates the chart layout unless a plugin returns `false` to the `beforeLayout`

Callers 1

_updateHiddenIndicesMethod · 0.95

Calls 1

setsEqualFunction · 0.85

Tested by

no test coverage detected