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

Method collectOrdinalMeta

src/data/DataStore.ts:277–309  ·  view source on GitHub ↗
(
        dimIdx: number,
        ordinalMeta: OrdinalMeta
    )

Source from the content-addressed store, hash-verified

275 }
276
277 collectOrdinalMeta(
278 dimIdx: number,
279 ordinalMeta: OrdinalMeta
280 ): void {
281 const chunk = this._chunks[dimIdx];
282 const dim = this._dimensions[dimIdx];
283 const rawExtents = this._rawExtent;
284
285 const offset = dim.ordinalOffset || 0;
286 const len = chunk.length;
287
288 if (offset === 0) {
289 // We need to reset the rawExtent if collect is from start.
290 // Because this dimension may be guessed as number and calcuating a wrong extent.
291 rawExtents[dimIdx] = initExtentForUnion();
292 }
293
294 const dimRawExtent = rawExtents[dimIdx];
295
296 // Parse from previous data offset. len may be changed after appendData
297 for (let i = offset; i < len; i++) {
298 // See also CATEGORY_AXIS_MODEL_DATA_IS_EMPTY_ARRAY.
299 const val = (chunk as any)[i] = ordinalMeta.parseAndCollect(chunk[i]);
300 if (!isNaN(val)) {
301 dimRawExtent[0] = Math.min(val, dimRawExtent[0]);
302 dimRawExtent[1] = Math.max(val, dimRawExtent[1]);
303 }
304 }
305
306 dim.ordinalMeta = ordinalMeta;
307 dim.ordinalOffset = len;
308 dim.type = 'ordinal'; // Force to be ordinal
309 }
310
311 getOrdinalMeta(dimIdx: number): OrdinalMeta {
312 const dimInfo = this._dimensions[dimIdx];

Callers 1

_updateOrdinalMetaMethod · 0.80

Calls 2

initExtentForUnionFunction · 0.90
parseAndCollectMethod · 0.80

Tested by

no test coverage detected