MCPcopy
hub / github.com/apache/echarts / each

Method each

src/data/DataStore.ts:1100–1133  ·  view source on GitHub ↗

* Data iteration * @param ctx default this * @example * list.each(0, function (x, idx) {}); * list.each([0, 1], function (x, y, idx) {}); * list.each(function (idx) {})

(dims: DimensionIndex[], cb: EachCb)

Source from the content-addressed store, hash-verified

1098 * list.each(function (idx) {})
1099 */
1100 each(dims: DimensionIndex[], cb: EachCb): void {
1101 if (!this._count) {
1102 return;
1103 }
1104 const dimSize = dims.length;
1105 const chunks = this._chunks;
1106
1107 for (let i = 0, len = this.count(); i < len; i++) {
1108 const rawIdx = this.getRawIndex(i);
1109 // Simple optimization
1110 switch (dimSize) {
1111 case 0:
1112 (cb as EachCb0)(i);
1113 break;
1114 case 1:
1115 (cb as EachCb1)(chunks[dims[0]][rawIdx], i);
1116 break;
1117 case 2:
1118 (cb as EachCb2)(
1119 chunks[dims[0]][rawIdx], chunks[dims[1]][rawIdx], i
1120 );
1121 break;
1122 default:
1123 let k = 0;
1124 const value = [];
1125 for (; k < dimSize; k++) {
1126 value[k] = chunks[dims[k]][rawIdx];
1127 }
1128 // Index
1129 value[k] = i;
1130 (cb as EachCb).apply(null, value);
1131 }
1132 }
1133 }
1134
1135 getDataExtent(
1136 dim: DimensionIndex,

Callers 15

getMedianMethod · 0.95
dat.gui.min.jsFile · 0.45
dFunction · 0.45
pFunction · 0.45
IFunction · 0.45
zFunction · 0.45
EFunction · 0.45
bFunction · 0.45
updateRendererSelectorFunction · 0.45
updatePageFunction · 0.45
jquery.min.jsFile · 0.45
GFunction · 0.45

Calls 2

countMethod · 0.95
getRawIndexMethod · 0.65

Tested by

no test coverage detected