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

Method _applyTransform

src/data/helper/sourceManager.ts:277–330  ·  view source on GitHub ↗
(
        upMgrList: SourceManager[]
    )

Source from the content-addressed store, hash-verified

275 }
276
277 private _applyTransform(
278 upMgrList: SourceManager[]
279 ): {
280 sourceList: Source[],
281 upstreamSignList: string[]
282 } {
283 const datasetModel = this._sourceHost as DatasetModel;
284 const transformOption = datasetModel.get('transform', true);
285 const fromTransformResult = datasetModel.get('fromTransformResult', true);
286
287 if (__DEV__) {
288 assert(fromTransformResult != null || transformOption != null);
289 }
290
291 if (fromTransformResult != null) {
292 let errMsg = '';
293 if (upMgrList.length !== 1) {
294 if (__DEV__) {
295 errMsg = 'When using `fromTransformResult`, there should be only one upstream dataset';
296 }
297 doThrow(errMsg);
298 }
299 }
300
301 let sourceList: Source[];
302 const upSourceList: Source[] = [];
303 const upstreamSignList: string[] = [];
304 each(upMgrList, upMgr => {
305 upMgr.prepareSource();
306 const upSource = upMgr.getSource(fromTransformResult || 0);
307 let errMsg = '';
308 if (fromTransformResult != null && !upSource) {
309 if (__DEV__) {
310 errMsg = 'Can not retrieve result by `fromTransformResult`: ' + fromTransformResult;
311 }
312 doThrow(errMsg);
313 }
314 upSourceList.push(upSource);
315 upstreamSignList.push(upMgr._getVersionSign());
316 });
317
318 if (transformOption) {
319 sourceList = applyDataTransform(
320 transformOption,
321 upSourceList,
322 { datasetIndex: datasetModel.componentIndex }
323 );
324 }
325 else if (fromTransformResult != null) {
326 sourceList = [cloneSourceShallow(upSourceList[0])];
327 }
328
329 return { sourceList, upstreamSignList };
330 }
331
332 private _isDirty(): boolean {
333 if (this._dirty) {

Callers 1

_createSourceMethod · 0.95

Calls 9

applyDataTransformFunction · 0.90
cloneSourceShallowFunction · 0.90
doThrowFunction · 0.85
prepareSourceMethod · 0.80
_getVersionSignMethod · 0.80
getSourceMethod · 0.65
assertFunction · 0.50
eachFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected