qauMaWeb/node_modules/.cache/babel-loader/135ee0b3d6d3a867361bb6019ca...

1 line
29 KiB
JSON

{"ast":null,"code":"import \"core-js/modules/es.array.slice.js\";\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 * 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*/\nimport { each, map } from 'zrender/lib/core/util.js';\nimport { linearMap, getPixelPrecision, round } from '../util/number.js';\nimport { createAxisTicks, createAxisLabels, calculateCategoryInterval } from './axisTickLabelBuilder.js';\nvar NORMALIZED_EXTENT = [0, 1];\n/**\r\n * Base class of Axis.\r\n */\n\nvar Axis =\n/** @class */\nfunction () {\n function Axis(dim, scale, extent) {\n this.onBand = false;\n this.inverse = false;\n this.dim = dim;\n this.scale = scale;\n this._extent = extent || [0, 0];\n }\n /**\r\n * If axis extent contain given coord\r\n */\n\n\n Axis.prototype.contain = function (coord) {\n var extent = this._extent;\n var min = Math.min(extent[0], extent[1]);\n var max = Math.max(extent[0], extent[1]);\n return coord >= min && coord <= max;\n };\n /**\r\n * If axis extent contain given data\r\n */\n\n\n Axis.prototype.containData = function (data) {\n return this.scale.contain(data);\n };\n /**\r\n * Get coord extent.\r\n */\n\n\n Axis.prototype.getExtent = function () {\n return this._extent.slice();\n };\n /**\r\n * Get precision used for formatting\r\n */\n\n\n Axis.prototype.getPixelPrecision = function (dataExtent) {\n return getPixelPrecision(dataExtent || this.scale.getExtent(), this._extent);\n };\n /**\r\n * Set coord extent\r\n */\n\n\n Axis.prototype.setExtent = function (start, end) {\n var extent = this._extent;\n extent[0] = start;\n extent[1] = end;\n };\n /**\r\n * Convert data to coord. Data is the rank if it has an ordinal scale\r\n */\n\n\n Axis.prototype.dataToCoord = function (data, clamp) {\n var extent = this._extent;\n var scale = this.scale;\n data = scale.normalize(data);\n\n if (this.onBand && scale.type === 'ordinal') {\n extent = extent.slice();\n fixExtentWithBands(extent, scale.count());\n }\n\n return linearMap(data, NORMALIZED_EXTENT, extent, clamp);\n };\n /**\r\n * Convert coord to data. Data is the rank if it has an ordinal scale\r\n */\n\n\n Axis.prototype.coordToData = function (coord, clamp) {\n var extent = this._extent;\n var scale = this.scale;\n\n if (this.onBand && scale.type === 'ordinal') {\n extent = extent.slice();\n fixExtentWithBands(extent, scale.count());\n }\n\n var t = linearMap(coord, extent, NORMALIZED_EXTENT, clamp);\n return this.scale.scale(t);\n };\n /**\r\n * Convert pixel point to data in axis\r\n */\n\n\n Axis.prototype.pointToData = function (point, clamp) {\n // Should be implemented in derived class if necessary.\n return;\n };\n /**\r\n * Different from `zrUtil.map(axis.getTicks(), axis.dataToCoord, axis)`,\r\n * `axis.getTicksCoords` considers `onBand`, which is used by\r\n * `boundaryGap:true` of category axis and splitLine and splitArea.\r\n * @param opt.tickModel default: axis.model.getModel('axisTick')\r\n * @param opt.clamp If `true`, the first and the last\r\n * tick must be at the axis end points. Otherwise, clip ticks\r\n * that outside the axis extent.\r\n */\n\n\n Axis.prototype.getTicksCoords = function (opt) {\n opt = opt || {};\n var tickModel = opt.tickModel || this.getTickModel();\n var result = createAxisTicks(this, tickModel);\n var ticks = result.ticks;\n var ticksCoords = map(ticks, function (tickVal) {\n return {\n coord: this.dataToCoord(this.scale.type === 'ordinal' ? this.scale.getRawOrdinalNumber(tickVal) : tickVal),\n tickValue: tickVal\n };\n }, this);\n var alignWithLabel = tickModel.get('alignWithLabel');\n fixOnBandTicksCoords(this, ticksCoords, alignWithLabel, opt.clamp);\n return ticksCoords;\n };\n\n Axis.prototype.getMinorTicksCoords = function () {\n if (this.scale.type === 'ordinal') {\n // Category axis doesn't support minor ticks\n return [];\n }\n\n var minorTickModel = this.model.getModel('minorTick');\n var splitNumber = minorTickModel.get('splitNumber'); // Protection.\n\n if (!(splitNumber > 0 && splitNumber < 100)) {\n splitNumber = 5;\n }\n\n var minorTicks = this.scale.getMinorTicks(splitNumber);\n var minorTicksCoords = map(minorTicks, function (minorTicksGroup) {\n return map(minorTicksGroup, function (minorTick) {\n return {\n coord: this.dataToCoord(minorTick),\n tickValue: minorTick\n };\n }, this);\n }, this);\n return minorTicksCoords;\n };\n\n Axis.prototype.getViewLabels = function () {\n return createAxisLabels(this).labels;\n };\n\n Axis.prototype.getLabelModel = function () {\n return this.model.getModel('axisLabel');\n };\n /**\r\n * Notice here we only get the default tick model. For splitLine\r\n * or splitArea, we should pass the splitLineModel or splitAreaModel\r\n * manually when calling `getTicksCoords`.\r\n * In GL, this method may be overrided to:\r\n * `axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));`\r\n */\n\n\n Axis.prototype.getTickModel = function () {\n return this.model.getModel('axisTick');\n };\n /**\r\n * Get width of band\r\n */\n\n\n Axis.prototype.getBandWidth = function () {\n var axisExtent = this._extent;\n var dataExtent = this.scale.getExtent();\n var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); // Fix #2728, avoid NaN when only one data.\n\n len === 0 && (len = 1);\n var size = Math.abs(axisExtent[1] - axisExtent[0]);\n return Math.abs(size) / len;\n };\n /**\r\n * Only be called in category axis.\r\n * Can be overrided, consider other axes like in 3D.\r\n * @return Auto interval for cateogry axis tick and label\r\n */\n\n\n Axis.prototype.calculateCategoryInterval = function () {\n return calculateCategoryInterval(this);\n };\n\n return Axis;\n}();\n\nfunction fixExtentWithBands(extent, nTick) {\n var size = extent[1] - extent[0];\n var len = nTick;\n var margin = size / len / 2;\n extent[0] += margin;\n extent[1] -= margin;\n} // If axis has labels [1, 2, 3, 4]. Bands on the axis are\n// |---1---|---2---|---3---|---4---|.\n// So the displayed ticks and splitLine/splitArea should between\n// each data item, otherwise cause misleading (e.g., split tow bars\n// of a single data item when there are two bar series).\n// Also consider if tickCategoryInterval > 0 and onBand, ticks and\n// splitLine/spliteArea should layout appropriately corresponding\n// to displayed labels. (So we should not use `getBandWidth` in this\n// case).\n\n\nfunction fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) {\n var ticksLen = ticksCoords.length;\n\n if (!axis.onBand || alignWithLabel || !ticksLen) {\n return;\n }\n\n var axisExtent = axis.getExtent();\n var last;\n var diffSize;\n\n if (ticksLen === 1) {\n ticksCoords[0].coord = axisExtent[0];\n last = ticksCoords[1] = {\n coord: axisExtent[0]\n };\n } else {\n var crossLen = ticksCoords[ticksLen - 1].tickValue - ticksCoords[0].tickValue;\n var shift_1 = (ticksCoords[ticksLen - 1].coord - ticksCoords[0].coord) / crossLen;\n each(ticksCoords, function (ticksItem) {\n ticksItem.coord -= shift_1 / 2;\n });\n var dataExtent = axis.scale.getExtent();\n diffSize = 1 + dataExtent[1] - ticksCoords[ticksLen - 1].tickValue;\n last = {\n coord: ticksCoords[ticksLen - 1].coord + shift_1 * diffSize\n };\n ticksCoords.push(last);\n }\n\n var inverse = axisExtent[0] > axisExtent[1]; // Handling clamp.\n\n if (littleThan(ticksCoords[0].coord, axisExtent[0])) {\n clamp ? ticksCoords[0].coord = axisExtent[0] : ticksCoords.shift();\n }\n\n if (clamp && littleThan(axisExtent[0], ticksCoords[0].coord)) {\n ticksCoords.unshift({\n coord: axisExtent[0]\n });\n }\n\n if (littleThan(axisExtent[1], last.coord)) {\n clamp ? last.coord = axisExtent[1] : ticksCoords.pop();\n }\n\n if (clamp && littleThan(last.coord, axisExtent[1])) {\n ticksCoords.push({\n coord: axisExtent[1]\n });\n }\n\n function littleThan(a, b) {\n // Avoid rounding error cause calculated tick coord different with extent.\n // It may cause an extra unecessary tick added.\n a = round(a);\n b = round(b);\n return inverse ? a > b : a < b;\n }\n}\n\nexport default Axis;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/coord/Axis.js"],"names":["each","map","linearMap","getPixelPrecision","round","createAxisTicks","createAxisLabels","calculateCategoryInterval","NORMALIZED_EXTENT","Axis","dim","scale","extent","onBand","inverse","_extent","prototype","contain","coord","min","Math","max","containData","data","getExtent","slice","dataExtent","setExtent","start","end","dataToCoord","clamp","normalize","type","fixExtentWithBands","count","coordToData","t","pointToData","point","getTicksCoords","opt","tickModel","getTickModel","result","ticks","ticksCoords","tickVal","getRawOrdinalNumber","tickValue","alignWithLabel","get","fixOnBandTicksCoords","getMinorTicksCoords","minorTickModel","model","getModel","splitNumber","minorTicks","getMinorTicks","minorTicksCoords","minorTicksGroup","minorTick","getViewLabels","labels","getLabelModel","getBandWidth","axisExtent","len","size","abs","nTick","margin","axis","ticksLen","length","last","diffSize","crossLen","shift_1","ticksItem","push","littleThan","shift","unshift","pop","a","b"],"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;A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,UAAU,CAACN,IAAI,CAAC1D,KAAN,EAAaiD,UAAU,CAAC,CAAD,CAAvB,CAAvB,EAAoD;AAClDrB,IAAAA,WAAW,CAACmC,IAAZ,CAAiB;AACf/D,MAAAA,KAAK,EAAEiD,UAAU,CAAC,CAAD;AADF,KAAjB;AAGD;;AAED,WAASe,UAAT,CAAoBI,CAApB,EAAuBC,CAAvB,EAA0B;AACxB;AACA;AACAD,IAAAA,CAAC,GAAGlF,KAAK,CAACkF,CAAD,CAAT;AACAC,IAAAA,CAAC,GAAGnF,KAAK,CAACmF,CAAD,CAAT;AACA,WAAOzE,OAAO,GAAGwE,CAAC,GAAGC,CAAP,GAAWD,CAAC,GAAGC,CAA7B;AACD;AACF;;AAED,eAAe9E,IAAf","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\nimport { each, map } from 'zrender/lib/core/util.js';\r\nimport { linearMap, getPixelPrecision, round } from '../util/number.js';\r\nimport { createAxisTicks, createAxisLabels, calculateCategoryInterval } from './axisTickLabelBuilder.js';\r\nvar NORMALIZED_EXTENT = [0, 1];\r\n/**\r\n * Base class of Axis.\r\n */\r\n\r\nvar Axis =\r\n/** @class */\r\nfunction () {\r\n function Axis(dim, scale, extent) {\r\n this.onBand = false;\r\n this.inverse = false;\r\n this.dim = dim;\r\n this.scale = scale;\r\n this._extent = extent || [0, 0];\r\n }\r\n /**\r\n * If axis extent contain given coord\r\n */\r\n\r\n\r\n Axis.prototype.contain = function (coord) {\r\n var extent = this._extent;\r\n var min = Math.min(extent[0], extent[1]);\r\n var max = Math.max(extent[0], extent[1]);\r\n return coord >= min && coord <= max;\r\n };\r\n /**\r\n * If axis extent contain given data\r\n */\r\n\r\n\r\n Axis.prototype.containData = function (data) {\r\n return this.scale.contain(data);\r\n };\r\n /**\r\n * Get coord extent.\r\n */\r\n\r\n\r\n Axis.prototype.getExtent = function () {\r\n return this._extent.slice();\r\n };\r\n /**\r\n * Get precision used for formatting\r\n */\r\n\r\n\r\n Axis.prototype.getPixelPrecision = function (dataExtent) {\r\n return getPixelPrecision(dataExtent || this.scale.getExtent(), this._extent);\r\n };\r\n /**\r\n * Set coord extent\r\n */\r\n\r\n\r\n Axis.prototype.setExtent = function (start, end) {\r\n var extent = this._extent;\r\n extent[0] = start;\r\n extent[1] = end;\r\n };\r\n /**\r\n * Convert data to coord. Data is the rank if it has an ordinal scale\r\n */\r\n\r\n\r\n Axis.prototype.dataToCoord = function (data, clamp) {\r\n var extent = this._extent;\r\n var scale = this.scale;\r\n data = scale.normalize(data);\r\n\r\n if (this.onBand && scale.type === 'ordinal') {\r\n extent = extent.slice();\r\n fixExtentWithBands(extent, scale.count());\r\n }\r\n\r\n return linearMap(data, NORMALIZED_EXTENT, extent, clamp);\r\n };\r\n /**\r\n * Convert coord to data. Data is the rank if it has an ordinal scale\r\n */\r\n\r\n\r\n Axis.prototype.coordToData = function (coord, clamp) {\r\n var extent = this._extent;\r\n var scale = this.scale;\r\n\r\n if (this.onBand && scale.type === 'ordinal') {\r\n extent = extent.slice();\r\n fixExtentWithBands(extent, scale.count());\r\n }\r\n\r\n var t = linearMap(coord, extent, NORMALIZED_EXTENT, clamp);\r\n return this.scale.scale(t);\r\n };\r\n /**\r\n * Convert pixel point to data in axis\r\n */\r\n\r\n\r\n Axis.prototype.pointToData = function (point, clamp) {\r\n // Should be implemented in derived class if necessary.\r\n return;\r\n };\r\n /**\r\n * Different from `zrUtil.map(axis.getTicks(), axis.dataToCoord, axis)`,\r\n * `axis.getTicksCoords` considers `onBand`, which is used by\r\n * `boundaryGap:true` of category axis and splitLine and splitArea.\r\n * @param opt.tickModel default: axis.model.getModel('axisTick')\r\n * @param opt.clamp If `true`, the first and the last\r\n * tick must be at the axis end points. Otherwise, clip ticks\r\n * that outside the axis extent.\r\n */\r\n\r\n\r\n Axis.prototype.getTicksCoords = function (opt) {\r\n opt = opt || {};\r\n var tickModel = opt.tickModel || this.getTickModel();\r\n var result = createAxisTicks(this, tickModel);\r\n var ticks = result.ticks;\r\n var ticksCoords = map(ticks, function (tickVal) {\r\n return {\r\n coord: this.dataToCoord(this.scale.type === 'ordinal' ? this.scale.getRawOrdinalNumber(tickVal) : tickVal),\r\n tickValue: tickVal\r\n };\r\n }, this);\r\n var alignWithLabel = tickModel.get('alignWithLabel');\r\n fixOnBandTicksCoords(this, ticksCoords, alignWithLabel, opt.clamp);\r\n return ticksCoords;\r\n };\r\n\r\n Axis.prototype.getMinorTicksCoords = function () {\r\n if (this.scale.type === 'ordinal') {\r\n // Category axis doesn't support minor ticks\r\n return [];\r\n }\r\n\r\n var minorTickModel = this.model.getModel('minorTick');\r\n var splitNumber = minorTickModel.get('splitNumber'); // Protection.\r\n\r\n if (!(splitNumber > 0 && splitNumber < 100)) {\r\n splitNumber = 5;\r\n }\r\n\r\n var minorTicks = this.scale.getMinorTicks(splitNumber);\r\n var minorTicksCoords = map(minorTicks, function (minorTicksGroup) {\r\n return map(minorTicksGroup, function (minorTick) {\r\n return {\r\n coord: this.dataToCoord(minorTick),\r\n tickValue: minorTick\r\n };\r\n }, this);\r\n }, this);\r\n return minorTicksCoords;\r\n };\r\n\r\n Axis.prototype.getViewLabels = function () {\r\n return createAxisLabels(this).labels;\r\n };\r\n\r\n Axis.prototype.getLabelModel = function () {\r\n return this.model.getModel('axisLabel');\r\n };\r\n /**\r\n * Notice here we only get the default tick model. For splitLine\r\n * or splitArea, we should pass the splitLineModel or splitAreaModel\r\n * manually when calling `getTicksCoords`.\r\n * In GL, this method may be overrided to:\r\n * `axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));`\r\n */\r\n\r\n\r\n Axis.prototype.getTickModel = function () {\r\n return this.model.getModel('axisTick');\r\n };\r\n /**\r\n * Get width of band\r\n */\r\n\r\n\r\n Axis.prototype.getBandWidth = function () {\r\n var axisExtent = this._extent;\r\n var dataExtent = this.scale.getExtent();\r\n var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); // Fix #2728, avoid NaN when only one data.\r\n\r\n len === 0 && (len = 1);\r\n var size = Math.abs(axisExtent[1] - axisExtent[0]);\r\n return Math.abs(size) / len;\r\n };\r\n /**\r\n * Only be called in category axis.\r\n * Can be overrided, consider other axes like in 3D.\r\n * @return Auto interval for cateogry axis tick and label\r\n */\r\n\r\n\r\n Axis.prototype.calculateCategoryInterval = function () {\r\n return calculateCategoryInterval(this);\r\n };\r\n\r\n return Axis;\r\n}();\r\n\r\nfunction fixExtentWithBands(extent, nTick) {\r\n var size = extent[1] - extent[0];\r\n var len = nTick;\r\n var margin = size / len / 2;\r\n extent[0] += margin;\r\n extent[1] -= margin;\r\n} // If axis has labels [1, 2, 3, 4]. Bands on the axis are\r\n// |---1---|---2---|---3---|---4---|.\r\n// So the displayed ticks and splitLine/splitArea should between\r\n// each data item, otherwise cause misleading (e.g., split tow bars\r\n// of a single data item when there are two bar series).\r\n// Also consider if tickCategoryInterval > 0 and onBand, ticks and\r\n// splitLine/spliteArea should layout appropriately corresponding\r\n// to displayed labels. (So we should not use `getBandWidth` in this\r\n// case).\r\n\r\n\r\nfunction fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) {\r\n var ticksLen = ticksCoords.length;\r\n\r\n if (!axis.onBand || alignWithLabel || !ticksLen) {\r\n return;\r\n }\r\n\r\n var axisExtent = axis.getExtent();\r\n var last;\r\n var diffSize;\r\n\r\n if (ticksLen === 1) {\r\n ticksCoords[0].coord = axisExtent[0];\r\n last = ticksCoords[1] = {\r\n coord: axisExtent[0]\r\n };\r\n } else {\r\n var crossLen = ticksCoords[ticksLen - 1].tickValue - ticksCoords[0].tickValue;\r\n var shift_1 = (ticksCoords[ticksLen - 1].coord - ticksCoords[0].coord) / crossLen;\r\n each(ticksCoords, function (ticksItem) {\r\n ticksItem.coord -= shift_1 / 2;\r\n });\r\n var dataExtent = axis.scale.getExtent();\r\n diffSize = 1 + dataExtent[1] - ticksCoords[ticksLen - 1].tickValue;\r\n last = {\r\n coord: ticksCoords[ticksLen - 1].coord + shift_1 * diffSize\r\n };\r\n ticksCoords.push(last);\r\n }\r\n\r\n var inverse = axisExtent[0] > axisExtent[1]; // Handling clamp.\r\n\r\n if (littleThan(ticksCoords[0].coord, axisExtent[0])) {\r\n clamp ? ticksCoords[0].coord = axisExtent[0] : ticksCoords.shift();\r\n }\r\n\r\n if (clamp && littleThan(axisExtent[0], ticksCoords[0].coord)) {\r\n ticksCoords.unshift({\r\n coord: axisExtent[0]\r\n });\r\n }\r\n\r\n if (littleThan(axisExtent[1], last.coord)) {\r\n clamp ? last.coord = axisExtent[1] : ticksCoords.pop();\r\n }\r\n\r\n if (clamp && littleThan(last.coord, axisExtent[1])) {\r\n ticksCoords.push({\r\n coord: axisExtent[1]\r\n });\r\n }\r\n\r\n function littleThan(a, b) {\r\n // Avoid rounding error cause calculated tick coord different with extent.\r\n // It may cause an extra unecessary tick added.\r\n a = round(a);\r\n b = round(b);\r\n return inverse ? a > b : a < b;\r\n }\r\n}\r\n\r\nexport default Axis;"]},"metadata":{},"sourceType":"module"}