MCPcopy Index your code
hub / github.com/tdewolff/minify / enableDataStack

Function enableDataStack

_benchmarks/sample_echarts.js:34514–34598  ·  view source on GitHub ↗

* Note that it is too complicated to support 3d stack by value * (have to create two-dimension inverted index), so in 3d case * we just support that stacked by index. * * @param seriesModel * @param dimensionInfoList The same as the input of .

(seriesModel, dimensionInfoList, opt)

Source from the content-addressed store, hash-verified

34512 */
34513
34514 function enableDataStack(seriesModel, dimensionInfoList, opt) {
34515 opt = opt || {};
34516 var byIndex = opt.byIndex;
34517 var stackedCoordDimension = opt.stackedCoordDimension; // Compatibal: when `stack` is set as '', do not stack.
34518
34519 var mayStack = !!(seriesModel && seriesModel.get('stack'));
34520 var stackedByDimInfo;
34521 var stackedDimInfo;
34522 var stackResultDimension;
34523 var stackedOverDimension;
34524 each(dimensionInfoList, function (dimensionInfo, index) {
34525 if (isString(dimensionInfo)) {
34526 dimensionInfoList[index] = dimensionInfo = {
34527 name: dimensionInfo
34528 };
34529 }
34530
34531 if (mayStack && !dimensionInfo.isExtraCoord) {
34532 // Find the first ordinal dimension as the stackedByDimInfo.
34533 if (!byIndex && !stackedByDimInfo && dimensionInfo.ordinalMeta) {
34534 stackedByDimInfo = dimensionInfo;
34535 } // Find the first stackable dimension as the stackedDimInfo.
34536
34537
34538 if (!stackedDimInfo && dimensionInfo.type !== 'ordinal' && dimensionInfo.type !== 'time' && (!stackedCoordDimension || stackedCoordDimension === dimensionInfo.coordDim)) {
34539 stackedDimInfo = dimensionInfo;
34540 }
34541 }
34542 });
34543
34544 if (stackedDimInfo && !byIndex && !stackedByDimInfo) {
34545 // Compatible with previous design, value axis (time axis) only stack by index.
34546 // It may make sense if the user provides elaborately constructed data.
34547 byIndex = true;
34548 } // Add stack dimension, they can be both calculated by coordinate system in `unionExtent`.
34549 // That put stack logic in List is for using conveniently in echarts extensions, but it
34550 // might not be a good way.
34551
34552
34553 if (stackedDimInfo) {
34554 // Use a weird name that not duplicated with other names.
34555 stackResultDimension = '__\0ecstackresult';
34556 stackedOverDimension = '__\0ecstackedover'; // Create inverted index to fast query index by value.
34557
34558 if (stackedByDimInfo) {
34559 stackedByDimInfo.createInvertedIndices = true;
34560 }
34561
34562 var stackedDimCoordDim_1 = stackedDimInfo.coordDim;
34563 var stackedDimType = stackedDimInfo.type;
34564 var stackedDimCoordIndex_1 = 0;
34565 each(dimensionInfoList, function (dimensionInfo) {
34566 if (dimensionInfo.coordDim === stackedDimCoordDim_1) {
34567 stackedDimCoordIndex_1++;
34568 }
34569 });
34570 dimensionInfoList.push({
34571 name: stackResultDimension,

Callers 1

createListFromArrayFunction · 0.85

Calls 2

eachFunction · 0.70
isStringFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…