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

Method initData

src/data/SeriesData.ts:527–563  ·  view source on GitHub ↗

* Initialize from data * @param data source or data or data store. * @param nameList The name of a datum is used on data diff and * default label/tooltip. * A name can be specified in encode.itemName, * or dataItem.name (only for series option data),

(
        data: Source | OptionSourceData | DataStore | DataProvider,
        nameList?: string[],
        dimValueGetter?: DimValueGetter
    )

Source from the content-addressed store, hash-verified

525 * or provided in nameList from outside.
526 */
527 initData(
528 data: Source | OptionSourceData | DataStore | DataProvider,
529 nameList?: string[],
530 dimValueGetter?: DimValueGetter
531 ): void {
532 let store: DataStore;
533 if (data instanceof DataStore) {
534 store = data;
535 }
536
537 if (!store) {
538 const dimensions = this.dimensions;
539 const provider = (isSourceInstance(data) || zrUtil.isArrayLike(data))
540 ? new DefaultDataProvider(data as Source | OptionSourceData, dimensions.length)
541 : data as DataProvider;
542 store = new DataStore();
543 const dimensionInfos: DataStoreDimensionDefine[] = map(dimensions, dimName => ({
544 type: this._dimInfos[dimName].type,
545 property: dimName
546 }));
547 store.initData(provider, dimensionInfos, dimValueGetter);
548 }
549
550 this._store = store;
551
552 // Reset
553 this._nameList = (nameList || []).slice();
554 this._idList = [];
555 this._nameRepeatCount = {};
556
557 this._doInit(0, store.count());
558
559 // Cache summary info for fast visit. See "dimensionHelper".
560 // Needs to be initialized after store is prepared.
561 this._dimSummary = summarizeDimensions(this, this._schema);
562 this.userOutput = this._dimSummary.userOutput;
563 }
564
565 /**
566 * Caution: Can be only called on raw data (before `this._indices` created).

Callers 10

testArrayRowsInSourceFunction · 0.95
getInitialDataMethod · 0.95
createGraphFromNodeEdgeFunction · 0.95
createSeriesDataSimplyFunction · 0.95
createSeriesDataFunction · 0.95
_updateCategoriesDataMethod · 0.95
getInitialDataMethod · 0.95
createListFunction · 0.95
createDataFunction · 0.95
createTreeMethod · 0.95

Calls 4

_doInitMethod · 0.95
isSourceInstanceFunction · 0.90
summarizeDimensionsFunction · 0.90
countMethod · 0.65

Tested by 1

testArrayRowsInSourceFunction · 0.76