1 line
23 KiB
JSON
1 line
23 KiB
JSON
{"ast":null,"code":"/*\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*/\n\n/**\r\n * AUTO-GENERATED FILE. DO NOT MODIFY.\r\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*/\n\n/**\r\n * Single coordinates system.\r\n */\nimport SingleAxis from './SingleAxis.js';\nimport * as axisHelper from '../axisHelper.js';\nimport { getLayoutRect } from '../../util/layout.js';\nimport { each } from 'zrender/lib/core/util.js';\nexport var singleDimensions = ['single'];\n/**\r\n * Create a single coordinates system.\r\n */\n\nvar Single =\n/** @class */\nfunction () {\n function Single(axisModel, ecModel, api) {\n this.type = 'single';\n this.dimension = 'single';\n /**\r\n * Add it just for draw tooltip.\r\n */\n\n this.dimensions = singleDimensions;\n this.axisPointerEnabled = true;\n this.model = axisModel;\n\n this._init(axisModel, ecModel, api);\n }\n /**\r\n * Initialize single coordinate system.\r\n */\n\n\n Single.prototype._init = function (axisModel, ecModel, api) {\n var dim = this.dimension;\n var axis = new SingleAxis(dim, axisHelper.createScaleByModel(axisModel), [0, 0], axisModel.get('type'), axisModel.get('position'));\n var isCategory = axis.type === 'category';\n axis.onBand = isCategory && axisModel.get('boundaryGap');\n axis.inverse = axisModel.get('inverse');\n axis.orient = axisModel.get('orient');\n axisModel.axis = axis;\n axis.model = axisModel;\n axis.coordinateSystem = this;\n this._axis = axis;\n };\n /**\r\n * Update axis scale after data processed\r\n */\n\n\n Single.prototype.update = function (ecModel, api) {\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem === this) {\n var data_1 = seriesModel.getData();\n each(data_1.mapDimensionsAll(this.dimension), function (dim) {\n this._axis.scale.unionExtentFromData(data_1, dim);\n }, this);\n axisHelper.niceScaleExtent(this._axis.scale, this._axis.model);\n }\n }, this);\n };\n /**\r\n * Resize the single coordinate system.\r\n */\n\n\n Single.prototype.resize = function (axisModel, api) {\n this._rect = getLayoutRect({\n left: axisModel.get('left'),\n top: axisModel.get('top'),\n right: axisModel.get('right'),\n bottom: axisModel.get('bottom'),\n width: axisModel.get('width'),\n height: axisModel.get('height')\n }, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n this._adjustAxis();\n };\n\n Single.prototype.getRect = function () {\n return this._rect;\n };\n\n Single.prototype._adjustAxis = function () {\n var rect = this._rect;\n var axis = this._axis;\n var isHorizontal = axis.isHorizontal();\n var extent = isHorizontal ? [0, rect.width] : [0, rect.height];\n var idx = axis.reverse ? 1 : 0;\n axis.setExtent(extent[idx], extent[1 - idx]);\n\n this._updateAxisTransform(axis, isHorizontal ? rect.x : rect.y);\n };\n\n Single.prototype._updateAxisTransform = function (axis, coordBase) {\n var axisExtent = axis.getExtent();\n var extentSum = axisExtent[0] + axisExtent[1];\n var isHorizontal = axis.isHorizontal();\n axis.toGlobalCoord = isHorizontal ? function (coord) {\n return coord + coordBase;\n } : function (coord) {\n return extentSum - coord + coordBase;\n };\n axis.toLocalCoord = isHorizontal ? function (coord) {\n return coord - coordBase;\n } : function (coord) {\n return extentSum - coord + coordBase;\n };\n };\n /**\r\n * Get axis.\r\n */\n\n\n Single.prototype.getAxis = function () {\n return this._axis;\n };\n /**\r\n * Get axis, add it just for draw tooltip.\r\n */\n\n\n Single.prototype.getBaseAxis = function () {\n return this._axis;\n };\n\n Single.prototype.getAxes = function () {\n return [this._axis];\n };\n\n Single.prototype.getTooltipAxes = function () {\n return {\n baseAxes: [this.getAxis()],\n // Empty otherAxes\n otherAxes: []\n };\n };\n /**\r\n * If contain point.\r\n */\n\n\n Single.prototype.containPoint = function (point) {\n var rect = this.getRect();\n var axis = this.getAxis();\n var orient = axis.orient;\n\n if (orient === 'horizontal') {\n return axis.contain(axis.toLocalCoord(point[0])) && point[1] >= rect.y && point[1] <= rect.y + rect.height;\n } else {\n return axis.contain(axis.toLocalCoord(point[1])) && point[0] >= rect.y && point[0] <= rect.y + rect.height;\n }\n };\n\n Single.prototype.pointToData = function (point) {\n var axis = this.getAxis();\n return [axis.coordToData(axis.toLocalCoord(point[axis.orient === 'horizontal' ? 0 : 1]))];\n };\n /**\r\n * Convert the series data to concrete point.\r\n * Can be [val] | val\r\n */\n\n\n Single.prototype.dataToPoint = function (val) {\n var axis = this.getAxis();\n var rect = this.getRect();\n var pt = [];\n var idx = axis.orient === 'horizontal' ? 0 : 1;\n\n if (val instanceof Array) {\n val = val[0];\n }\n\n pt[idx] = axis.toGlobalCoord(axis.dataToCoord(+val));\n pt[1 - idx] = idx === 0 ? rect.y + rect.height / 2 : rect.x + rect.width / 2;\n return pt;\n };\n\n Single.prototype.convertToPixel = function (ecModel, finder, value) {\n var coordSys = getCoordSys(finder);\n return coordSys === this ? this.dataToPoint(value) : null;\n };\n\n Single.prototype.convertFromPixel = function (ecModel, finder, pixel) {\n var coordSys = getCoordSys(finder);\n return coordSys === this ? this.pointToData(pixel) : null;\n };\n\n return Single;\n}();\n\nfunction getCoordSys(finder) {\n var seriesModel = finder.seriesModel;\n var singleModel = finder.singleAxisModel;\n return singleModel && singleModel.coordinateSystem || seriesModel && seriesModel.coordinateSystem;\n}\n\nexport default Single;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/coord/single/Single.js"],"names":["SingleAxis","axisHelper","getLayoutRect","each","singleDimensions","Single","axisModel","ecModel","api","type","dimension","dimensions","axisPointerEnabled","model","_init","prototype","dim","axis","createScaleByModel","get","isCategory","onBand","inverse","orient","coordinateSystem","_axis","update","eachSeries","seriesModel","data_1","getData","mapDimensionsAll","scale","unionExtentFromData","niceScaleExtent","resize","_rect","left","top","right","bottom","width","height","getWidth","getHeight","_adjustAxis","getRect","rect","isHorizontal","extent","idx","reverse","setExtent","_updateAxisTransform","x","y","coordBase","axisExtent","getExtent","extentSum","toGlobalCoord","coord","toLocalCoord","getAxis","getBaseAxis","getAxes","getTooltipAxes","baseAxes","otherAxes","containPoint","point","contain","pointToData","coordToData","dataToPoint","val","pt","Array","dataToCoord","convertToPixel","finder","value","coordSys","getCoordSys","convertFromPixel","pixel","singleModel","singleAxisModel"],"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;;AAEA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,iBAAvB;AACA,OAAO,KAAKC,UAAZ,MAA4B,kBAA5B;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,IAAT,QAAqB,0BAArB;AACA,OAAO,IAAIC,gBAAgB,GAAG,CAAC,QAAD,CAAvB;AACP;AACA;AACA;;AAEA,IA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jC,IAAI,CAAC2C,aAAL,CAAmB3C,IAAI,CAAC6D,WAAL,CAAiB,CAACH,GAAlB,CAAnB,CAAV;AACAC,IAAAA,EAAE,CAAC,IAAI1B,GAAL,CAAF,GAAcA,GAAG,KAAK,CAAR,GAAYH,IAAI,CAACQ,CAAL,GAASR,IAAI,CAACL,MAAL,GAAc,CAAnC,GAAuCK,IAAI,CAACO,CAAL,GAASP,IAAI,CAACN,KAAL,GAAa,CAA3E;AACA,WAAOmC,EAAP;AACD,GAbD;;AAeAvE,EAAAA,MAAM,CAACU,SAAP,CAAiBgE,cAAjB,GAAkC,UAAUxE,OAAV,EAAmByE,MAAnB,EAA2BC,KAA3B,EAAkC;AAClE,QAAIC,QAAQ,GAAGC,WAAW,CAACH,MAAD,CAA1B;AACA,WAAOE,QAAQ,KAAK,IAAb,GAAoB,KAAKR,WAAL,CAAiBO,KAAjB,CAApB,GAA8C,IAArD;AACD,GAHD;;AAKA5E,EAAAA,MAAM,CAACU,SAAP,CAAiBqE,gBAAjB,GAAoC,UAAU7E,OAAV,EAAmByE,MAAnB,EAA2BK,KAA3B,EAAkC;AACpE,QAAIH,QAAQ,GAAGC,WAAW,CAACH,MAAD,CAA1B;AACA,WAAOE,QAAQ,KAAK,IAAb,GAAoB,KAAKV,WAAL,CAAiBa,KAAjB,CAApB,GAA8C,IAArD;AACD,GAHD;;AAKA,SAAOhF,MAAP;AACD,CAnLD,EAFA;;AAuLA,SAAS8E,WAAT,CAAqBH,MAArB,EAA6B;AAC3B,MAAIpD,WAAW,GAAGoD,MAAM,CAACpD,WAAzB;AACA,MAAI0D,WAAW,GAAGN,MAAM,CAACO,eAAzB;AACA,SAAOD,WAAW,IAAIA,WAAW,CAAC9D,gBAA3B,IAA+CI,WAAW,IAAIA,WAAW,CAACJ,gBAAjF;AACD;;AAED,eAAenB,MAAf","sourcesContent":["\r\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*/\r\n\r\n\r\n/**\r\n * AUTO-GENERATED FILE. DO NOT MODIFY.\r\n */\r\n\r\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*/\r\n\r\n/**\r\n * Single coordinates system.\r\n */\r\nimport SingleAxis from './SingleAxis.js';\r\nimport * as axisHelper from '../axisHelper.js';\r\nimport { getLayoutRect } from '../../util/layout.js';\r\nimport { each } from 'zrender/lib/core/util.js';\r\nexport var singleDimensions = ['single'];\r\n/**\r\n * Create a single coordinates system.\r\n */\r\n\r\nvar Single =\r\n/** @class */\r\nfunction () {\r\n function Single(axisModel, ecModel, api) {\r\n this.type = 'single';\r\n this.dimension = 'single';\r\n /**\r\n * Add it just for draw tooltip.\r\n */\r\n\r\n this.dimensions = singleDimensions;\r\n this.axisPointerEnabled = true;\r\n this.model = axisModel;\r\n\r\n this._init(axisModel, ecModel, api);\r\n }\r\n /**\r\n * Initialize single coordinate system.\r\n */\r\n\r\n\r\n Single.prototype._init = function (axisModel, ecModel, api) {\r\n var dim = this.dimension;\r\n var axis = new SingleAxis(dim, axisHelper.createScaleByModel(axisModel), [0, 0], axisModel.get('type'), axisModel.get('position'));\r\n var isCategory = axis.type === 'category';\r\n axis.onBand = isCategory && axisModel.get('boundaryGap');\r\n axis.inverse = axisModel.get('inverse');\r\n axis.orient = axisModel.get('orient');\r\n axisModel.axis = axis;\r\n axis.model = axisModel;\r\n axis.coordinateSystem = this;\r\n this._axis = axis;\r\n };\r\n /**\r\n * Update axis scale after data processed\r\n */\r\n\r\n\r\n Single.prototype.update = function (ecModel, api) {\r\n ecModel.eachSeries(function (seriesModel) {\r\n if (seriesModel.coordinateSystem === this) {\r\n var data_1 = seriesModel.getData();\r\n each(data_1.mapDimensionsAll(this.dimension), function (dim) {\r\n this._axis.scale.unionExtentFromData(data_1, dim);\r\n }, this);\r\n axisHelper.niceScaleExtent(this._axis.scale, this._axis.model);\r\n }\r\n }, this);\r\n };\r\n /**\r\n * Resize the single coordinate system.\r\n */\r\n\r\n\r\n Single.prototype.resize = function (axisModel, api) {\r\n this._rect = getLayoutRect({\r\n left: axisModel.get('left'),\r\n top: axisModel.get('top'),\r\n right: axisModel.get('right'),\r\n bottom: axisModel.get('bottom'),\r\n width: axisModel.get('width'),\r\n height: axisModel.get('height')\r\n }, {\r\n width: api.getWidth(),\r\n height: api.getHeight()\r\n });\r\n\r\n this._adjustAxis();\r\n };\r\n\r\n Single.prototype.getRect = function () {\r\n return this._rect;\r\n };\r\n\r\n Single.prototype._adjustAxis = function () {\r\n var rect = this._rect;\r\n var axis = this._axis;\r\n var isHorizontal = axis.isHorizontal();\r\n var extent = isHorizontal ? [0, rect.width] : [0, rect.height];\r\n var idx = axis.reverse ? 1 : 0;\r\n axis.setExtent(extent[idx], extent[1 - idx]);\r\n\r\n this._updateAxisTransform(axis, isHorizontal ? rect.x : rect.y);\r\n };\r\n\r\n Single.prototype._updateAxisTransform = function (axis, coordBase) {\r\n var axisExtent = axis.getExtent();\r\n var extentSum = axisExtent[0] + axisExtent[1];\r\n var isHorizontal = axis.isHorizontal();\r\n axis.toGlobalCoord = isHorizontal ? function (coord) {\r\n return coord + coordBase;\r\n } : function (coord) {\r\n return extentSum - coord + coordBase;\r\n };\r\n axis.toLocalCoord = isHorizontal ? function (coord) {\r\n return coord - coordBase;\r\n } : function (coord) {\r\n return extentSum - coord + coordBase;\r\n };\r\n };\r\n /**\r\n * Get axis.\r\n */\r\n\r\n\r\n Single.prototype.getAxis = function () {\r\n return this._axis;\r\n };\r\n /**\r\n * Get axis, add it just for draw tooltip.\r\n */\r\n\r\n\r\n Single.prototype.getBaseAxis = function () {\r\n return this._axis;\r\n };\r\n\r\n Single.prototype.getAxes = function () {\r\n return [this._axis];\r\n };\r\n\r\n Single.prototype.getTooltipAxes = function () {\r\n return {\r\n baseAxes: [this.getAxis()],\r\n // Empty otherAxes\r\n otherAxes: []\r\n };\r\n };\r\n /**\r\n * If contain point.\r\n */\r\n\r\n\r\n Single.prototype.containPoint = function (point) {\r\n var rect = this.getRect();\r\n var axis = this.getAxis();\r\n var orient = axis.orient;\r\n\r\n if (orient === 'horizontal') {\r\n return axis.contain(axis.toLocalCoord(point[0])) && point[1] >= rect.y && point[1] <= rect.y + rect.height;\r\n } else {\r\n return axis.contain(axis.toLocalCoord(point[1])) && point[0] >= rect.y && point[0] <= rect.y + rect.height;\r\n }\r\n };\r\n\r\n Single.prototype.pointToData = function (point) {\r\n var axis = this.getAxis();\r\n return [axis.coordToData(axis.toLocalCoord(point[axis.orient === 'horizontal' ? 0 : 1]))];\r\n };\r\n /**\r\n * Convert the series data to concrete point.\r\n * Can be [val] | val\r\n */\r\n\r\n\r\n Single.prototype.dataToPoint = function (val) {\r\n var axis = this.getAxis();\r\n var rect = this.getRect();\r\n var pt = [];\r\n var idx = axis.orient === 'horizontal' ? 0 : 1;\r\n\r\n if (val instanceof Array) {\r\n val = val[0];\r\n }\r\n\r\n pt[idx] = axis.toGlobalCoord(axis.dataToCoord(+val));\r\n pt[1 - idx] = idx === 0 ? rect.y + rect.height / 2 : rect.x + rect.width / 2;\r\n return pt;\r\n };\r\n\r\n Single.prototype.convertToPixel = function (ecModel, finder, value) {\r\n var coordSys = getCoordSys(finder);\r\n return coordSys === this ? this.dataToPoint(value) : null;\r\n };\r\n\r\n Single.prototype.convertFromPixel = function (ecModel, finder, pixel) {\r\n var coordSys = getCoordSys(finder);\r\n return coordSys === this ? this.pointToData(pixel) : null;\r\n };\r\n\r\n return Single;\r\n}();\r\n\r\nfunction getCoordSys(finder) {\r\n var seriesModel = finder.seriesModel;\r\n var singleModel = finder.singleAxisModel;\r\n return singleModel && singleModel.coordinateSystem || seriesModel && seriesModel.coordinateSystem;\r\n}\r\n\r\nexport default Single;"]},"metadata":{},"sourceType":"module"} |