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

Function doGuessOrdinal

libs/echarts/echarts-en.simple.js:21117–21216  ·  view source on GitHub ↗
(
    data, sourceFormat, seriesLayoutBy, dimensionsDefine, startIndex, dimIndex
)

Source from the content-addressed store, hash-verified

21115// dimIndex may be overflow source data.
21116// return {BE_ORDINAL}
21117function doGuessOrdinal(
21118 data, sourceFormat, seriesLayoutBy, dimensionsDefine, startIndex, dimIndex
21119) {
21120 var result;
21121 // Experience value.
21122 var maxLoop = 5;
21123
21124 if (isTypedArray(data)) {
21125 return BE_ORDINAL.Not;
21126 }
21127
21128 // When sourceType is 'objectRows' or 'keyedColumns', dimensionsDefine
21129 // always exists in source.
21130 var dimName;
21131 var dimType;
21132 if (dimensionsDefine) {
21133 var dimDefItem = dimensionsDefine[dimIndex];
21134 if (isObject$1(dimDefItem)) {
21135 dimName = dimDefItem.name;
21136 dimType = dimDefItem.type;
21137 }
21138 else if (isString(dimDefItem)) {
21139 dimName = dimDefItem;
21140 }
21141 }
21142
21143 if (dimType != null) {
21144 return dimType === 'ordinal' ? BE_ORDINAL.Must : BE_ORDINAL.Not;
21145 }
21146
21147 if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {
21148 if (seriesLayoutBy === SERIES_LAYOUT_BY_ROW) {
21149 var sample = data[dimIndex];
21150 for (var i = 0; i < (sample || []).length && i < maxLoop; i++) {
21151 if ((result = detectValue(sample[startIndex + i])) != null) {
21152 return result;
21153 }
21154 }
21155 }
21156 else {
21157 for (var i = 0; i < data.length && i < maxLoop; i++) {
21158 var row = data[startIndex + i];
21159 if (row && (result = detectValue(row[dimIndex])) != null) {
21160 return result;
21161 }
21162 }
21163 }
21164 }
21165 else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {
21166 if (!dimName) {
21167 return BE_ORDINAL.Not;
21168 }
21169 for (var i = 0; i < data.length && i < maxLoop; i++) {
21170 var item = data[i];
21171 if (item && (result = detectValue(item[dimName])) != null) {
21172 return result;
21173 }
21174 }

Callers 2

guessOrdinalFunction · 0.70

Calls 6

isTypedArrayFunction · 0.70
isObject$1Function · 0.70
isStringFunction · 0.70
detectValueFunction · 0.70
getDataItemValueFunction · 0.70
isArrayFunction · 0.70

Tested by

no test coverage detected