| 1 |
- {"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { each, createHashMap, assert, map } from 'zrender/lib/core/util.js';\nimport { VISUAL_DIMENSIONS } from '../../util/types.js';\nvar DimensionUserOuput = /** @class */function () {\n function DimensionUserOuput(encode, dimRequest) {\n this._encode = encode;\n this._schema = dimRequest;\n }\n DimensionUserOuput.prototype.get = function () {\n return {\n // Do not generate full dimension name until fist used.\n fullDimensions: this._getFullDimensionNames(),\n encode: this._encode\n };\n };\n /**\r\n * Get all data store dimension names.\r\n * Theoretically a series data store is defined both by series and used dataset (if any).\r\n * If some dimensions are omitted for performance reason in `this.dimensions`,\r\n * the dimension name may not be auto-generated if user does not specify a dimension name.\r\n * In this case, the dimension name is `null`/`undefined`.\r\n */\n DimensionUserOuput.prototype._getFullDimensionNames = function () {\n if (!this._cachedDimNames) {\n this._cachedDimNames = this._schema ? this._schema.makeOutputDimensionNames() : [];\n }\n return this._cachedDimNames;\n };\n return DimensionUserOuput;\n}();\n;\nexport function summarizeDimensions(data, schema) {\n var summary = {};\n var encode = summary.encode = {};\n var notExtraCoordDimMap = createHashMap();\n var defaultedLabel = [];\n var defaultedTooltip = [];\n var userOutputEncode = {};\n each(data.dimensions, function (dimName) {\n var dimItem = data.getDimensionInfo(dimName);\n var coordDim = dimItem.coordDim;\n if (coordDim) {\n if (process.env.NODE_ENV !== 'production') {\n assert(VISUAL_DIMENSIONS.get(coordDim) == null);\n }\n var coordDimIndex = dimItem.coordDimIndex;\n getOrCreateEncodeArr(encode, coordDim)[coordDimIndex] = dimName;\n if (!dimItem.isExtraCoord) {\n notExtraCoordDimMap.set(coordDim, 1);\n // Use the last coord dim (and label friendly) as default label,\n // because when dataset is used, it is hard to guess which dimension\n // can be value dimension. If both show x, y on label is not look good,\n // and conventionally y axis is focused more.\n if (mayLabelDimType(dimItem.type)) {\n defaultedLabel[0] = dimName;\n }\n // User output encode do not contain generated coords.\n // And it only has index. User can use index to retrieve value from the raw item array.\n getOrCreateEncodeArr(userOutputEncode, coordDim)[coordDimIndex] = data.getDimensionIndex(dimItem.name);\n }\n if (dimItem.defaultTooltip) {\n defaultedTooltip.push(dimName);\n }\n }\n VISUAL_DIMENSIONS.each(function (v, otherDim) {\n var encodeArr = getOrCreateEncodeArr(encode, otherDim);\n var dimIndex = dimItem.otherDims[otherDim];\n if (dimIndex != null && dimIndex !== false) {\n encodeArr[dimIndex] = dimItem.name;\n }\n });\n });\n var dataDimsOnCoord = [];\n var encodeFirstDimNotExtra = {};\n notExtraCoordDimMap.each(function (v, coordDim) {\n var dimArr = encode[coordDim];\n encodeFirstDimNotExtra[coordDim] = dimArr[0];\n // Not necessary to remove duplicate, because a data\n // dim canot on more than one coordDim.\n dataDimsOnCoord = dataDimsOnCoord.concat(dimArr);\n });\n summary.dataDimsOnCoord = dataDimsOnCoord;\n summary.dataDimIndicesOnCoord = map(dataDimsOnCoord, function (dimName) {\n return data.getDimensionInfo(dimName).storeDimIndex;\n });\n summary.encodeFirstDimNotExtra = encodeFirstDimNotExtra;\n var encodeLabel = encode.label;\n // FIXME `encode.label` is not recommended, because formatter cannot be set\n // in this way. Use label.formatter instead. Maybe remove this approach someday.\n if (encodeLabel && encodeLabel.length) {\n defaultedLabel = encodeLabel.slice();\n }\n var encodeTooltip = encode.tooltip;\n if (encodeTooltip && encodeTooltip.length) {\n defaultedTooltip = encodeTooltip.slice();\n } else if (!defaultedTooltip.length) {\n defaultedTooltip = defaultedLabel.slice();\n }\n encode.defaultedLabel = defaultedLabel;\n encode.defaultedTooltip = defaultedTooltip;\n summary.userOutput = new DimensionUserOuput(userOutputEncode, schema);\n return summary;\n}\nfunction getOrCreateEncodeArr(encode, dim) {\n if (!encode.hasOwnProperty(dim)) {\n encode[dim] = [];\n }\n return encode[dim];\n}\n// FIXME:TS should be type `AxisType`\nexport function getDimensionTypeByAxis(axisType) {\n return axisType === 'category' ? 'ordinal' : axisType === 'time' ? 'time' : 'float';\n}\nfunction mayLabelDimType(dimType) {\n // In most cases, ordinal and time do not suitable for label.\n // Ordinal info can be displayed on axis. Time is too long.\n return !(dimType === 'ordinal' || dimType === 'time');\n}\n// function findTheLastDimMayLabel(data) {\n// // Get last value dim\n// let dimensions = data.dimensions.slice();\n// let valueType;\n// let valueDim;\n// while (dimensions.length && (\n// valueDim = dimensions.pop(),\n// valueType = data.getDimensionInfo(valueDim).type,\n// valueType === 'ordinal' || valueType === 'time'\n// )) {} // jshint ignore:line\n// return valueDim;\n// }","map":{"version":3,"names":["each","createHashMap","assert","map","VISUAL_DIMENSIONS","DimensionUserOuput","encode","dimRequest","_encode","_schema","prototype","get","fullDimensions","_getFullDimensionNames","_cachedDimNames","makeOutputDimensionNames","summarizeDimensions","data","schema","summary","notExtraCoordDimMap","defaultedLabel","defaultedTooltip","userOutputEncode","dimensions","dimName","dimItem","getDimensionInfo","coordDim","process","env","NODE_ENV","coordDimIndex","getOrCreateEncodeArr","isExtraCoord","set","mayLabelDimType","type","getDimensionIndex","name","defaultTooltip","push","v","otherDim","encodeArr","dimIndex","otherDims","dataDimsOnCoord","encodeFirstDimNotExtra","dimArr","concat","dataDimIndicesOnCoord","storeDimIndex","encodeLabel","label","length","slice","encodeTooltip","tooltip","userOutput","dim","hasOwnProperty","getDimensionTypeByAxis","axisType","dimType"],"sources":["E:/git/2021项目/安科院大屏/node_modules/echarts/lib/data/helper/dimensionHelper.js"],"sourcesContent":["\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { each, createHashMap, assert, map } from 'zrender/lib/core/util.js';\nimport { VISUAL_DIMENSIONS } from '../../util/types.js';\nvar DimensionUserOuput = /** @class */function () {\n function DimensionUserOuput(encode, dimRequest) {\n this._encode = encode;\n this._schema = dimRequest;\n }\n DimensionUserOuput.prototype.get = function () {\n return {\n // Do not generate full dimension name until fist used.\n fullDimensions: this._getFullDimensionNames(),\n encode: this._encode\n };\n };\n /**\r\n * Get all data store dimension names.\r\n * Theoretically a series data store is defined both by series and used dataset (if any).\r\n * If some dimensions are omitted for performance reason in `this.dimensions`,\r\n * the dimension name may not be auto-generated if user does not specify a dimension name.\r\n * In this case, the dimension name is `null`/`undefined`.\r\n */\n DimensionUserOuput.prototype._getFullDimensionNames = function () {\n if (!this._cachedDimNames) {\n this._cachedDimNames = this._schema ? this._schema.makeOutputDimensionNames() : [];\n }\n return this._cachedDimNames;\n };\n return DimensionUserOuput;\n}();\n;\nexport function summarizeDimensions(data, schema) {\n var summary = {};\n var encode = summary.encode = {};\n var notExtraCoordDimMap = createHashMap();\n var defaultedLabel = [];\n var defaultedTooltip = [];\n var userOutputEncode = {};\n each(data.dimensions, function (dimName) {\n var dimItem = data.getDimensionInfo(dimName);\n var coordDim = dimItem.coordDim;\n if (coordDim) {\n if (process.env.NODE_ENV !== 'production') {\n assert(VISUAL_DIMENSIONS.get(coordDim) == null);\n }\n var coordDimIndex = dimItem.coordDimIndex;\n getOrCreateEncodeArr(encode, coordDim)[coordDimIndex] = dimName;\n if (!dimItem.isExtraCoord) {\n notExtraCoordDimMap.set(coordDim, 1);\n // Use the last coord dim (and label friendly) as default label,\n // because when dataset is used, it is hard to guess which dimension\n // can be value dimension. If both show x, y on label is not look good,\n // and conventionally y axis is focused more.\n if (mayLabelDimType(dimItem.type)) {\n defaultedLabel[0] = dimName;\n }\n // User output encode do not contain generated coords.\n // And it only has index. User can use index to retrieve value from the raw item array.\n getOrCreateEncodeArr(userOutputEncode, coordDim)[coordDimIndex] = data.getDimensionIndex(dimItem.name);\n }\n if (dimItem.defaultTooltip) {\n defaultedTooltip.push(dimName);\n }\n }\n VISUAL_DIMENSIONS.each(function (v, otherDim) {\n var encodeArr = getOrCreateEncodeArr(encode, otherDim);\n var dimIndex = dimItem.otherDims[otherDim];\n if (dimIndex != null && dimIndex !== false) {\n encodeArr[dimIndex] = dimItem.name;\n }\n });\n });\n var dataDimsOnCoord = [];\n var encodeFirstDimNotExtra = {};\n notExtraCoordDimMap.each(function (v, coordDim) {\n var dimArr = encode[coordDim];\n encodeFirstDimNotExtra[coordDim] = dimArr[0];\n // Not necessary to remove duplicate, because a data\n // dim canot on more than one coordDim.\n dataDimsOnCoord = dataDimsOnCoord.concat(dimArr);\n });\n summary.dataDimsOnCoord = dataDimsOnCoord;\n summary.dataDimIndicesOnCoord = map(dataDimsOnCoord, function (dimName) {\n return data.getDimensionInfo(dimName).storeDimIndex;\n });\n summary.encodeFirstDimNotExtra = encodeFirstDimNotExtra;\n var encodeLabel = encode.label;\n // FIXME `encode.label` is not recommended, because formatter cannot be set\n // in this way. Use label.formatter instead. Maybe remove this approach someday.\n if (encodeLabel && encodeLabel.length) {\n defaultedLabel = encodeLabel.slice();\n }\n var encodeTooltip = encode.tooltip;\n if (encodeTooltip && encodeTooltip.length) {\n defaultedTooltip = encodeTooltip.slice();\n } else if (!defaultedTooltip.length) {\n defaultedTooltip = defaultedLabel.slice();\n }\n encode.defaultedLabel = defaultedLabel;\n encode.defaultedTooltip = defaultedTooltip;\n summary.userOutput = new DimensionUserOuput(userOutputEncode, schema);\n return summary;\n}\nfunction getOrCreateEncodeArr(encode, dim) {\n if (!encode.hasOwnProperty(dim)) {\n encode[dim] = [];\n }\n return encode[dim];\n}\n// FIXME:TS should be type `AxisType`\nexport function getDimensionTypeByAxis(axisType) {\n return axisType === 'category' ? 'ordinal' : axisType === 'time' ? 'time' : 'float';\n}\nfunction mayLabelDimType(dimType) {\n // In most cases, ordinal and time do not suitable for label.\n // Ordinal info can be displayed on axis. Time is too long.\n return !(dimType === 'ordinal' || dimType === 'time');\n}\n// function findTheLastDimMayLabel(data) {\n// // Get last value dim\n// let dimensions = data.dimensions.slice();\n// let valueType;\n// let valueDim;\n// while (dimensions.length && (\n// valueDim = dimensions.pop(),\n// valueType = data.getDimensionInfo(valueDim).type,\n// valueType === 'ordinal' || valueType === 'time'\n// )) {} // jshint ignore:line\n// return valueDim;\n// }"],"mappings":";AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,aAAa,EAAEC,MAAM,EAAEC,GAAG,QAAQ,0BAA0B;AAC3E,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,IAAIC,kBAAkB,GAAG,aAAa,YAAY;EAChD,SAASA,kBAAkBA,CAACC,MAAM,EAAEC,UAAU,EAAE;IAC9C,IAAI,CAACC,OAAO,GAAGF,MAAM;IACrB,IAAI,CAACG,OAAO,GAAGF,UAAU;EAC3B;EACAF,kBAAkB,CAACK,SAAS,CAACC,GAAG,GAAG,YAAY;IAC7C,OAAO;MACL;MACAC,cAAc,EAAE,IAAI,CAACC,sBAAsB,CAAC,CAAC;MAC7CP,MAAM,EAAE,IAAI,CAACE;IACf,CAAC;EACH,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;EACEH,kBAAkB,CAACK,SAAS,CAACG,sBAAsB,GAAG,YAAY;IAChE,IAAI,CAAC,IAAI,CAACC,eAAe,EAAE;MACzB,IAAI,CAACA,eAAe,GAAG,IAAI,CAACL,OAAO,GAAG,IAAI,CAACA,OAAO,CAACM,wBAAwB,CAAC,CAAC,GAAG,EAAE;IACpF;IACA,OAAO,IAAI,CAACD,eAAe;EAC7B,CAAC;EACD,OAAOT,kBAAkB;AAC3B,CAAC,C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CAACoD,OAAO;EAClC,IAAID,aAAa,IAAIA,aAAa,CAACF,MAAM,EAAE;IACzCjC,gBAAgB,GAAGmC,aAAa,CAACD,KAAK,CAAC,CAAC;EAC1C,CAAC,MAAM,IAAI,CAAClC,gBAAgB,CAACiC,MAAM,EAAE;IACnCjC,gBAAgB,GAAGD,cAAc,CAACmC,KAAK,CAAC,CAAC;EAC3C;EACAlD,MAAM,CAACe,cAAc,GAAGA,cAAc;EACtCf,MAAM,CAACgB,gBAAgB,GAAGA,gBAAgB;EAC1CH,OAAO,CAACwC,UAAU,GAAG,IAAItD,kBAAkB,CAACkB,gBAAgB,EAAEL,MAAM,CAAC;EACrE,OAAOC,OAAO;AAChB;AACA,SAASc,oBAAoBA,CAAC3B,MAAM,EAAEsD,GAAG,EAAE;EACzC,IAAI,CAACtD,MAAM,CAACuD,cAAc,CAACD,GAAG,CAAC,EAAE;IAC/BtD,MAAM,CAACsD,GAAG,CAAC,GAAG,EAAE;EAClB;EACA,OAAOtD,MAAM,CAACsD,GAAG,CAAC;AACpB;AACA;AACA,OAAO,SAASE,sBAAsBA,CAACC,QAAQ,EAAE;EAC/C,OAAOA,QAAQ,KAAK,UAAU,GAAG,SAAS,GAAGA,QAAQ,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;AACrF;AACA,SAAS3B,eAAeA,CAAC4B,OAAO,EAAE;EAChC;EACA;EACA,OAAO,EAAEA,OAAO,KAAK,SAAS,IAAIA,OAAO,KAAK,MAAM,CAAC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|