MCPcopy Create free account
hub / github.com/chartjs/Chart.js / _getUniformDataChanges

Method _getUniformDataChanges

src/core/core.controller.js:585–608  ·  view source on GitHub ↗

* @private

()

Source from the content-addressed store, hash-verified

583 * @private
584 */
585 _getUniformDataChanges() {
586 const _dataChanges = this._dataChanges;
587 if (!_dataChanges || !_dataChanges.length) {
588 return;
589 }
590
591 this._dataChanges = [];
592 const datasetCount = this.data.datasets.length;
593 const makeSet = (idx) => new Set(
594 _dataChanges
595 .filter(c => c[0] === idx)
596 .map((c, i) => i + ',' + c.splice(1).join(','))
597 );
598
599 const changeSet = makeSet(0);
600 for (let i = 1; i < datasetCount; i++) {
601 if (!setsEqual(changeSet, makeSet(i))) {
602 return;
603 }
604 }
605 return Array.from(changeSet)
606 .map(c => c.split(','))
607 .map(a => ({method: a[1], start: +a[2], count: +a[3]}));
608 }
609
610 /**
611 * 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