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

Method _getUniformDataChanges

src/core/core.controller.js:660–683  ·  view source on GitHub ↗

* @private

()

Source from the content-addressed store, hash-verified

658 * @private
659 */
660 _getUniformDataChanges() {
661 const _dataChanges = this._dataChanges;
662 if (!_dataChanges || !_dataChanges.length) {
663 return;
664 }
665
666 this._dataChanges = [];
667 const datasetCount = this.data.datasets.length;
668 const makeSet = (idx) => new Set(
669 _dataChanges
670 .filter(c => c[0] === idx)
671 .map((c, i) => i + ',' + c.splice(1).join(','))
672 );
673
674 const changeSet = makeSet(0);
675 for (let i = 1; i < datasetCount; i++) {
676 if (!setsEqual(changeSet, makeSet(i))) {
677 return;
678 }
679 }
680 return Array.from(changeSet)
681 .map(c => c.split(','))
682 .map(a => ({method: a[1], start: +a[2], count: +a[3]}));
683 }
684
685 /**
686 * 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