1 line
24 KiB
JSON
1 line
24 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.number.to-fixed.js\";\n\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/*\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*/\nimport * as numberUtil from '../../util/number.js';\nimport { isDimensionStacked } from '../../data/helper/dataStackHelper.js';\nimport { indexOf, curry, clone, isArray } from 'zrender/lib/core/util.js';\nimport { parseDataValue } from '../../data/helper/dataValueHelper.js';\n\nfunction hasXOrY(item) {\n return !(isNaN(parseFloat(item.x)) && isNaN(parseFloat(item.y)));\n}\n\nfunction hasXAndY(item) {\n return !isNaN(parseFloat(item.x)) && !isNaN(parseFloat(item.y));\n}\n\nfunction markerTypeCalculatorWithExtent(markerType, data, otherDataDim, targetDataDim, otherCoordIndex, targetCoordIndex) {\n var coordArr = [];\n var stacked = isDimensionStacked(data, targetDataDim\n /* , otherDataDim */\n );\n var calcDataDim = stacked ? data.getCalculationInfo('stackResultDimension') : targetDataDim;\n var value = numCalculate(data, calcDataDim, markerType);\n var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];\n coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);\n coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);\n var coordArrValue = data.get(targetDataDim, dataIndex); // Make it simple, do not visit all stacked value to count precision.\n\n var precision = numberUtil.getPrecision(data.get(targetDataDim, dataIndex));\n precision = Math.min(precision, 20);\n\n if (precision >= 0) {\n coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);\n }\n\n return [coordArr, coordArrValue];\n} // TODO Specified percent\n\n\nvar markerTypeCalculator = {\n min: curry(markerTypeCalculatorWithExtent, 'min'),\n max: curry(markerTypeCalculatorWithExtent, 'max'),\n average: curry(markerTypeCalculatorWithExtent, 'average'),\n median: curry(markerTypeCalculatorWithExtent, 'median')\n};\n/**\n * Transform markPoint data item to format used in List by do the following\n * 1. Calculate statistic like `max`, `min`, `average`\n * 2. Convert `item.xAxis`, `item.yAxis` to `item.coord` array\n */\n\nexport function dataTransform(seriesModel, item) {\n if (!item) {\n return;\n }\n\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n var dims = coordSys && coordSys.dimensions; // 1. If not specify the position with pixel directly\n // 2. If `coord` is not a data array. Which uses `xAxis`,\n // `yAxis` to specify the coord on each dimension\n // parseFloat first because item.x and item.y can be percent string like '20%'\n\n if (!hasXAndY(item) && !isArray(item.coord) && isArray(dims)) {\n var axisInfo = getAxisInfo(item, data, coordSys, seriesModel); // Clone the option\n // Transform the properties xAxis, yAxis, radiusAxis, angleAxis, geoCoord to value\n\n item = clone(item);\n\n if (item.type && markerTypeCalculator[item.type] && axisInfo.baseAxis && axisInfo.valueAxis) {\n var otherCoordIndex = indexOf(dims, axisInfo.baseAxis.dim);\n var targetCoordIndex = indexOf(dims, axisInfo.valueAxis.dim);\n var coordInfo = markerTypeCalculator[item.type](data, axisInfo.baseDataDim, axisInfo.valueDataDim, otherCoordIndex, targetCoordIndex);\n item.coord = coordInfo[0]; // Force to use the value of calculated value.\n // let item use the value without stack.\n\n item.value = coordInfo[1];\n } else {\n // FIXME Only has one of xAxis and yAxis.\n item.coord = [item.xAxis != null ? item.xAxis : item.radiusAxis, item.yAxis != null ? item.yAxis : item.angleAxis];\n }\n } // x y is provided\n\n\n if (item.coord == null || !isArray(dims)) {\n item.coord = [];\n } else {\n // Each coord support max, min, average\n var coord = item.coord;\n\n for (var i = 0; i < 2; i++) {\n if (markerTypeCalculator[coord[i]]) {\n coord[i] = numCalculate(data, data.mapDimension(dims[i]), coord[i]);\n }\n }\n }\n\n return item;\n}\nexport function getAxisInfo(item, data, coordSys, seriesModel) {\n var ret = {};\n\n if (item.valueIndex != null || item.valueDim != null) {\n ret.valueDataDim = item.valueIndex != null ? data.getDimension(item.valueIndex) : item.valueDim;\n ret.valueAxis = coordSys.getAxis(dataDimToCoordDim(seriesModel, ret.valueDataDim));\n ret.baseAxis = coordSys.getOtherAxis(ret.valueAxis);\n ret.baseDataDim = data.mapDimension(ret.baseAxis.dim);\n } else {\n ret.baseAxis = seriesModel.getBaseAxis();\n ret.valueAxis = coordSys.getOtherAxis(ret.baseAxis);\n ret.baseDataDim = data.mapDimension(ret.baseAxis.dim);\n ret.valueDataDim = data.mapDimension(ret.valueAxis.dim);\n }\n\n return ret;\n}\n\nfunction dataDimToCoordDim(seriesModel, dataDim) {\n var dimItem = seriesModel.getData().getDimensionInfo(dataDim);\n return dimItem && dimItem.coordDim;\n}\n/**\n * Filter data which is out of coordinateSystem range\n * [dataFilter description]\n */\n\n\nexport function dataFilter( // Currently only polar and cartesian has containData.\ncoordSys, item) {\n // Always return true if there is no coordSys\n return coordSys && coordSys.containData && item.coord && !hasXOrY(item) ? coordSys.containData(item.coord) : true;\n}\nexport function zoneFilter( // Currently only polar and cartesian has containData.\ncoordSys, item1, item2) {\n // Always return true if there is no coordSys\n return coordSys && coordSys.containZone && item1.coord && item2.coord && !hasXOrY(item1) && !hasXOrY(item2) ? coordSys.containZone(item1.coord, item2.coord) : true;\n}\nexport function createMarkerDimValueGetter(inCoordSys, dims) {\n return inCoordSys ? function (item, dimName, dataIndex, dimIndex) {\n var rawVal = dimIndex < 2 // x, y, radius, angle\n ? item.coord && item.coord[dimIndex] : item.value;\n return parseDataValue(rawVal, dims[dimIndex]);\n } : function (item, dimName, dataIndex, dimIndex) {\n return parseDataValue(item.value, dims[dimIndex]);\n };\n}\nexport function numCalculate(data, valueDataDim, type) {\n if (type === 'average') {\n var sum_1 = 0;\n var count_1 = 0;\n data.each(valueDataDim, function (val, idx) {\n if (!isNaN(val)) {\n sum_1 += val;\n count_1++;\n }\n });\n return sum_1 / count_1;\n } else if (type === 'median') {\n return data.getMedian(valueDataDim);\n } else {\n // max & min\n return data.getDataExtent(valueDataDim)[type === 'max' ? 1 : 0];\n }\n}","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/echarts/lib/component/marker/markerHelper.js"],"names":["numberUtil","isDimensionStacked","indexOf","curry","clone","isArray","parseDataValue","hasXOrY","item","isNaN","parseFloat","x","y","hasXAndY","markerTypeCalculatorWithExtent","markerType","data","otherDataDim","targetDataDim","otherCoordIndex","targetCoordIndex","coordArr","stacked","calcDataDim","getCalculationInfo","value","numCalculate","dataIndex","indicesOfNearest","get","coordArrValue","precision","getPrecision","Math","min","toFixed","markerTypeCalculator","max","average","median","dataTransform","seriesModel","getData","coordSys","coordinateSystem","dims","dimensions","coord","axisInfo","getAxisInfo","type","baseAxis","valueAxis","dim","coordInfo","baseDataDim","valueDataDim","xAxis","radiusAxis","yAxis","angleAxis","i","mapDimension","ret","valueIndex","valueDim","getDimension","getAxis","dataDimToCoordDim","getOtherAxis","getBaseAxis","dataDim","dimItem","getDimensionInfo","coordDim","dataFilter","containData","zoneFilter","item1","item2","containZone","createMarkerDimValueGetter","inCoordSys","dimName","dimIndex","rawVal","sum_1","count_1","each","val","idx","getMedian","getDataExtent"],"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,OAAO,KAAKA,UAAZ,MAA4B,sBAA5B;AACA,SAASC,kBAAT,QAAmC,sCAAnC;AACA,SAASC,OAAT,EAAkBC,KAAlB,EAAyBC,KAAzB,EAAgCC,OAAhC,QAA+C,0BAA/C;AACA,SAASC,cAAT,QAA+B,sCAA/B;;AAEA,SAASC,OAAT,CAAiBC,IAAjB,EAAuB;AACrB,SAAO,EAAEC,KAAK,CAACC,UAAU,CAACF,IAAI,CAACG,CAAN,CAAX,CAAL,IAA6BF,KAAK,CAACC,UAAU,CAACF,IAAI,CAACI,CAAN,CAAX,CAApC,CAAP;AACD;;AAED,SAASC,QAAT,CAAkBL,IAAlB,EAAwB;AACtB,SAAO,CAACC,KAAK,CAACC,UAAU,CAACF,IAAI,CAACG,CAAN,CAAX,CAAN,IAA8B,CAACF,KAAK,CAACC,UAAU,CAACF,IAAI,CAACI,CAAN,CAAX,CAA3C;AACD;;AAED,SAASE,8BAAT,CAAwCC,UAAxC,EAAoDC,IAApD,EAA0DC,YAA1D,EAAwEC,aAAxE,EAAuFC,eAAvF,EAAwGC,gBAAxG,EAA0H;AACxH,MAAIC,QAAQ,GAAG,EAAf;AACA,MAAIC,OAAO,GAAGrB,kBAAkB,CAACe,IAAD,EAAOE;AACvC;AADgC,GAAhC;AAGA,MAAIK,WAAW,GAAGD,OAAO,GAAGN,IAAI,CAACQ,kBAAL,CAAwB,sBAAxB,CAAH,GAAqDN,aAA9E;AACA,MAAIO,KAAK,GAAGC,YAAY,CAACV,IAAD,EAAOO,WAAP,EA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AAZ;AACA,QAAIC,OAAO,GAAG,CAAd;AACAvE,IAAAA,IAAI,CAACwE,IAAL,CAAUhC,YAAV,EAAwB,UAAUiC,GAAV,EAAeC,GAAf,EAAoB;AAC1C,UAAI,CAACjF,KAAK,CAACgF,GAAD,CAAV,EAAiB;AACfH,QAAAA,KAAK,IAAIG,GAAT;AACAF,QAAAA,OAAO;AACR;AACF,KALD;AAMA,WAAOD,KAAK,GAAGC,OAAf;AACD,GAVD,MAUO,IAAIrC,IAAI,KAAK,QAAb,EAAuB;AAC5B,WAAOlC,IAAI,CAAC2E,SAAL,CAAenC,YAAf,CAAP;AACD,GAFM,MAEA;AACL;AACA,WAAOxC,IAAI,CAAC4E,aAAL,CAAmBpC,YAAnB,EAAiCN,IAAI,KAAK,KAAT,GAAiB,CAAjB,GAAqB,CAAtD,CAAP;AACD;AACF","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/*\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*/\nimport * as numberUtil from '../../util/number.js';\nimport { isDimensionStacked } from '../../data/helper/dataStackHelper.js';\nimport { indexOf, curry, clone, isArray } from 'zrender/lib/core/util.js';\nimport { parseDataValue } from '../../data/helper/dataValueHelper.js';\n\nfunction hasXOrY(item) {\n return !(isNaN(parseFloat(item.x)) && isNaN(parseFloat(item.y)));\n}\n\nfunction hasXAndY(item) {\n return !isNaN(parseFloat(item.x)) && !isNaN(parseFloat(item.y));\n}\n\nfunction markerTypeCalculatorWithExtent(markerType, data, otherDataDim, targetDataDim, otherCoordIndex, targetCoordIndex) {\n var coordArr = [];\n var stacked = isDimensionStacked(data, targetDataDim\n /* , otherDataDim */\n );\n var calcDataDim = stacked ? data.getCalculationInfo('stackResultDimension') : targetDataDim;\n var value = numCalculate(data, calcDataDim, markerType);\n var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];\n coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);\n coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);\n var coordArrValue = data.get(targetDataDim, dataIndex); // Make it simple, do not visit all stacked value to count precision.\n\n var precision = numberUtil.getPrecision(data.get(targetDataDim, dataIndex));\n precision = Math.min(precision, 20);\n\n if (precision >= 0) {\n coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);\n }\n\n return [coordArr, coordArrValue];\n} // TODO Specified percent\n\n\nvar markerTypeCalculator = {\n min: curry(markerTypeCalculatorWithExtent, 'min'),\n max: curry(markerTypeCalculatorWithExtent, 'max'),\n average: curry(markerTypeCalculatorWithExtent, 'average'),\n median: curry(markerTypeCalculatorWithExtent, 'median')\n};\n/**\n * Transform markPoint data item to format used in List by do the following\n * 1. Calculate statistic like `max`, `min`, `average`\n * 2. Convert `item.xAxis`, `item.yAxis` to `item.coord` array\n */\n\nexport function dataTransform(seriesModel, item) {\n if (!item) {\n return;\n }\n\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n var dims = coordSys && coordSys.dimensions; // 1. If not specify the position with pixel directly\n // 2. If `coord` is not a data array. Which uses `xAxis`,\n // `yAxis` to specify the coord on each dimension\n // parseFloat first because item.x and item.y can be percent string like '20%'\n\n if (!hasXAndY(item) && !isArray(item.coord) && isArray(dims)) {\n var axisInfo = getAxisInfo(item, data, coordSys, seriesModel); // Clone the option\n // Transform the properties xAxis, yAxis, radiusAxis, angleAxis, geoCoord to value\n\n item = clone(item);\n\n if (item.type && markerTypeCalculator[item.type] && axisInfo.baseAxis && axisInfo.valueAxis) {\n var otherCoordIndex = indexOf(dims, axisInfo.baseAxis.dim);\n var targetCoordIndex = indexOf(dims, axisInfo.valueAxis.dim);\n var coordInfo = markerTypeCalculator[item.type](data, axisInfo.baseDataDim, axisInfo.valueDataDim, otherCoordIndex, targetCoordIndex);\n item.coord = coordInfo[0]; // Force to use the value of calculated value.\n // let item use the value without stack.\n\n item.value = coordInfo[1];\n } else {\n // FIXME Only has one of xAxis and yAxis.\n item.coord = [item.xAxis != null ? item.xAxis : item.radiusAxis, item.yAxis != null ? item.yAxis : item.angleAxis];\n }\n } // x y is provided\n\n\n if (item.coord == null || !isArray(dims)) {\n item.coord = [];\n } else {\n // Each coord support max, min, average\n var coord = item.coord;\n\n for (var i = 0; i < 2; i++) {\n if (markerTypeCalculator[coord[i]]) {\n coord[i] = numCalculate(data, data.mapDimension(dims[i]), coord[i]);\n }\n }\n }\n\n return item;\n}\nexport function getAxisInfo(item, data, coordSys, seriesModel) {\n var ret = {};\n\n if (item.valueIndex != null || item.valueDim != null) {\n ret.valueDataDim = item.valueIndex != null ? data.getDimension(item.valueIndex) : item.valueDim;\n ret.valueAxis = coordSys.getAxis(dataDimToCoordDim(seriesModel, ret.valueDataDim));\n ret.baseAxis = coordSys.getOtherAxis(ret.valueAxis);\n ret.baseDataDim = data.mapDimension(ret.baseAxis.dim);\n } else {\n ret.baseAxis = seriesModel.getBaseAxis();\n ret.valueAxis = coordSys.getOtherAxis(ret.baseAxis);\n ret.baseDataDim = data.mapDimension(ret.baseAxis.dim);\n ret.valueDataDim = data.mapDimension(ret.valueAxis.dim);\n }\n\n return ret;\n}\n\nfunction dataDimToCoordDim(seriesModel, dataDim) {\n var dimItem = seriesModel.getData().getDimensionInfo(dataDim);\n return dimItem && dimItem.coordDim;\n}\n/**\n * Filter data which is out of coordinateSystem range\n * [dataFilter description]\n */\n\n\nexport function dataFilter( // Currently only polar and cartesian has containData.\ncoordSys, item) {\n // Always return true if there is no coordSys\n return coordSys && coordSys.containData && item.coord && !hasXOrY(item) ? coordSys.containData(item.coord) : true;\n}\nexport function zoneFilter( // Currently only polar and cartesian has containData.\ncoordSys, item1, item2) {\n // Always return true if there is no coordSys\n return coordSys && coordSys.containZone && item1.coord && item2.coord && !hasXOrY(item1) && !hasXOrY(item2) ? coordSys.containZone(item1.coord, item2.coord) : true;\n}\nexport function createMarkerDimValueGetter(inCoordSys, dims) {\n return inCoordSys ? function (item, dimName, dataIndex, dimIndex) {\n var rawVal = dimIndex < 2 // x, y, radius, angle\n ? item.coord && item.coord[dimIndex] : item.value;\n return parseDataValue(rawVal, dims[dimIndex]);\n } : function (item, dimName, dataIndex, dimIndex) {\n return parseDataValue(item.value, dims[dimIndex]);\n };\n}\nexport function numCalculate(data, valueDataDim, type) {\n if (type === 'average') {\n var sum_1 = 0;\n var count_1 = 0;\n data.each(valueDataDim, function (val, idx) {\n if (!isNaN(val)) {\n sum_1 += val;\n count_1++;\n }\n });\n return sum_1 / count_1;\n } else if (type === 'median') {\n return data.getMedian(valueDataDim);\n } else {\n // max & min\n return data.getDataExtent(valueDataDim)[type === 'max' ? 1 : 0];\n }\n}"]},"metadata":{},"sourceType":"module"} |