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

Method initData

src/data/DataStore.ts:192–234  ·  view source on GitHub ↗

* Initialize from data

(
        provider: DataProvider,
        inputDimensions: DataStoreDimensionDefine[],
        dimValueGetter?: DimValueGetter
    )

Source from the content-addressed store, hash-verified

190 * Initialize from data
191 */
192 initData(
193 provider: DataProvider,
194 inputDimensions: DataStoreDimensionDefine[],
195 dimValueGetter?: DimValueGetter
196 ): void {
197 if (__DEV__) {
198 assert(
199 isFunction(provider.getItem) && isFunction(provider.count),
200 'Invalid data provider.'
201 );
202 }
203
204 this._provider = provider;
205
206 // Clear
207 this._chunks = [];
208 this._indices = null;
209 this.getRawIndex = this._getRawIdxIdentity;
210
211 const source = provider.getSource();
212 const defaultGetter = this.defaultDimValueGetter =
213 defaultDimValueGetters[source.sourceFormat];
214 // Default dim value getter
215 this._dimValueGetter = dimValueGetter || defaultGetter;
216
217 // Reset raw extent.
218 this._rawExtent = [];
219 const willRetrieveDataByName = shouldRetrieveDataByName(source);
220 this._dimensions = map(inputDimensions, dim => {
221 if (__DEV__) {
222 if (willRetrieveDataByName) {
223 assert(dim.property != null);
224 }
225 }
226 return {
227 // Only pick these two props. Not leak other properties like orderMeta.
228 type: dim.type,
229 property: dim.property
230 };
231 });
232
233 this._initDataFromProvider(0, provider.count());
234 }
235
236 getProvider(): DataProvider {
237 return this._provider;

Callers 6

createStoreFunction · 0.95
SeriesData.test.tsFile · 0.45
createGraphFromNodeEdgeFunction · 0.45
createListFunction · 0.45
_initDataMethod · 0.45
_innerGetDataStoreMethod · 0.45

Calls 6

_initDataFromProviderMethod · 0.95
shouldRetrieveDataByNameFunction · 0.90
getSourceMethod · 0.65
countMethod · 0.65
assertFunction · 0.50
isFunctionFunction · 0.50

Tested by 1

createStoreFunction · 0.76