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

Method _doInit

src/data/SeriesData.ts:622–673  ·  view source on GitHub ↗
(start: number, end: number)

Source from the content-addressed store, hash-verified

620 }
621
622 private _doInit(start: number, end: number): void {
623 if (start >= end) {
624 return;
625 }
626
627 const store = this._store;
628 const provider = store.getProvider();
629
630 this._updateOrdinalMeta();
631
632 const nameList = this._nameList;
633 const idList = this._idList;
634 const sourceFormat = provider.getSource().sourceFormat;
635 const isFormatOriginal = sourceFormat === SOURCE_FORMAT_ORIGINAL;
636
637 // Each data item is value
638 // [1, 2]
639 // 2
640 // Bar chart, line chart which uses category axis
641 // only gives the 'y' value. 'x' value is the indices of category
642 // Use a tempValue to normalize the value to be a (x, y) value
643 // If dataItem is {name: ...} or {id: ...}, it has highest priority.
644 // This kind of ids and names are always stored `_nameList` and `_idList`.
645 if (isFormatOriginal && !provider.pure) {
646 const sharedDataItem = [] as OptionDataItem;
647 for (let idx = start; idx < end; idx++) {
648 // NOTICE: Try not to write things into dataItem
649 const dataItem = provider.getItem(idx, sharedDataItem);
650 if (!this.hasItemOption && isDataItemOption(dataItem)) {
651 this.hasItemOption = true;
652 }
653 if (dataItem) {
654 const itemName = (dataItem as any).name;
655 if (nameList[idx] == null && itemName != null) {
656 nameList[idx] = convertOptionIdName(itemName, null);
657 }
658 const itemId = (dataItem as any).id;
659 if (idList[idx] == null && itemId != null) {
660 idList[idx] = convertOptionIdName(itemId, null);
661 }
662 }
663 }
664 }
665
666 if (this._shouldMakeIdFromName()) {
667 for (let idx = start; idx < end; idx++) {
668 makeIdFromName(this, idx);
669 }
670 }
671
672 prepareInvertedIndex(this);
673 }
674
675 /**
676 * Optimize for the scenario that data is filtered by a given extent.

Callers 2

initDataMethod · 0.95
appendDataMethod · 0.95

Calls 7

_updateOrdinalMetaMethod · 0.95
_shouldMakeIdFromNameMethod · 0.95
isDataItemOptionFunction · 0.90
convertOptionIdNameFunction · 0.90
getProviderMethod · 0.80
getSourceMethod · 0.65
getItemMethod · 0.65

Tested by

no test coverage detected