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

Function prepareDimensions

test/lib/ecSimpleTransform.js:135–170  ·  view source on GitHub ↗
(config, upstream, groupByDimInfo)

Source from the content-addressed store, hash-verified

133 }
134 };
135 function prepareDimensions(config, upstream, groupByDimInfo) {
136 var resultDimensionsConfig = config.resultDimensions;
137 var finalResultDimInfoList = [];
138 var collectionDimInfoList = [];
139 var gIndexInLine = 0;
140 for (var i = 0; i < resultDimensionsConfig.length; i++) {
141 var resultDimInfoConfig = resultDimensionsConfig[i];
142 var dimInfoInUpstream = upstream.getDimensionInfo(resultDimInfoConfig.from);
143 assert(dimInfoInUpstream, 'Can not find dimension by `from`: ' + resultDimInfoConfig.from);
144 var rawMethod = resultDimInfoConfig.method;
145 assert(groupByDimInfo.index !== dimInfoInUpstream.index || rawMethod == null, "Dimension " + dimInfoInUpstream.name + " is the \"groupBy\" dimension, must not have any \"method\".");
146 var method = normalizeMethod(rawMethod);
147 assert(method, 'method is required');
148 var name_1 = resultDimInfoConfig.name != null ? resultDimInfoConfig.name : dimInfoInUpstream.name;
149 var finalResultDimInfo = new ResultDimInfoInternal(finalResultDimInfoList.length, dimInfoInUpstream.index, method, name_1, hasOwn(METHOD_NEEDS_GATHER_VALUES, method));
150 finalResultDimInfoList.push(finalResultDimInfo);
151 var needCollect = false;
152 if (hasOwn(METHOD_NEEDS_COLLECT, method)) {
153 needCollect = true;
154 var collectionTargetMethods = METHOD_NEEDS_COLLECT[method];
155 for (var j = 0; j < collectionTargetMethods.length; j++) {
156 finalResultDimInfo.addCollectionInfo({
157 method: collectionTargetMethods[j],
158 indexInLine: gIndexInLine++
159 });
160 }
161 }
162 if (hasOwn(METHOD_NEEDS_GATHER_VALUES, method)) {
163 needCollect = true;
164 }
165 if (needCollect) {
166 collectionDimInfoList.push(finalResultDimInfo);
167 }
168 }
169 return { collectionDimInfoList: collectionDimInfoList, finalResultDimInfoList: finalResultDimInfoList };
170 }
171 function prepareGroupByDimInfo(config, upstream) {
172 var groupByConfig = config.groupBy;
173 var groupByDimInfo;

Callers 1

Calls 4

normalizeMethodFunction · 0.85
assertFunction · 0.70
hasOwnFunction · 0.70
getDimensionInfoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…