MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / summarizeDimensions

Function summarizeDimensions

libs/echarts/echarts-en.simple.js:29746–29837  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

29744]);
29745
29746function summarizeDimensions(data) {
29747 var summary = {};
29748 var encode = summary.encode = {};
29749 var notExtraCoordDimMap = createHashMap();
29750 var defaultedLabel = [];
29751 var defaultedTooltip = [];
29752
29753 // See the comment of `List.js#userOutput`.
29754 var userOutput = summary.userOutput = {
29755 dimensionNames: data.dimensions.slice(),
29756 encode: {}
29757 };
29758
29759 each$1(data.dimensions, function (dimName) {
29760 var dimItem = data.getDimensionInfo(dimName);
29761
29762 var coordDim = dimItem.coordDim;
29763 if (coordDim) {
29764 if (__DEV__) {
29765 assert$1(OTHER_DIMENSIONS.get(coordDim) == null);
29766 }
29767
29768 var coordDimIndex = dimItem.coordDimIndex;
29769 getOrCreateEncodeArr(encode, coordDim)[coordDimIndex] = dimName;
29770
29771 if (!dimItem.isExtraCoord) {
29772 notExtraCoordDimMap.set(coordDim, 1);
29773
29774 // Use the last coord dim (and label friendly) as default label,
29775 // because when dataset is used, it is hard to guess which dimension
29776 // can be value dimension. If both show x, y on label is not look good,
29777 // and conventionally y axis is focused more.
29778 if (mayLabelDimType(dimItem.type)) {
29779 defaultedLabel[0] = dimName;
29780 }
29781
29782 // User output encode do not contain generated coords.
29783 // And it only has index. User can use index to retrieve value from the raw item array.
29784 getOrCreateEncodeArr(userOutput.encode, coordDim)[coordDimIndex] = dimItem.index;
29785 }
29786 if (dimItem.defaultTooltip) {
29787 defaultedTooltip.push(dimName);
29788 }
29789 }
29790
29791 OTHER_DIMENSIONS.each(function (v, otherDim) {
29792 var encodeArr = getOrCreateEncodeArr(encode, otherDim);
29793
29794 var dimIndex = dimItem.otherDims[otherDim];
29795 if (dimIndex != null && dimIndex !== false) {
29796 encodeArr[dimIndex] = dimItem.name;
29797 }
29798 });
29799 });
29800
29801 var dataDimsOnCoord = [];
29802 var encodeFirstDimNotExtra = {};
29803

Callers 1

ListFunction · 0.70

Calls 8

pushMethod · 0.80
createHashMapFunction · 0.70
each$1Function · 0.70
assert$1Function · 0.70
getOrCreateEncodeArrFunction · 0.70
mayLabelDimTypeFunction · 0.70
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected