1 line
22 KiB
JSON
1 line
22 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.function.name.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 { __extends } from \"tslib\";\nimport SeriesModel from '../../model/Series.js';\nimport createGraphFromNodeEdge from '../helper/createGraphFromNodeEdge.js';\nimport Model from '../../model/Model.js';\nimport { createTooltipMarkup } from '../../component/tooltip/tooltipMarkup.js';\n\nvar SankeySeriesModel =\n/** @class */\nfunction (_super) {\n __extends(SankeySeriesModel, _super);\n\n function SankeySeriesModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = SankeySeriesModel.type;\n return _this;\n }\n /**\r\n * Init a graph data structure from data in option series\r\n */\n\n\n SankeySeriesModel.prototype.getInitialData = function (option, ecModel) {\n var links = option.edges || option.links;\n var nodes = option.data || option.nodes;\n var levels = option.levels;\n this.levelModels = [];\n var levelModels = this.levelModels;\n\n for (var i = 0; i < levels.length; i++) {\n if (levels[i].depth != null && levels[i].depth >= 0) {\n levelModels[levels[i].depth] = new Model(levels[i], this, ecModel);\n } else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('levels[i].depth is mandatory and should be natural number');\n }\n }\n }\n\n if (nodes && links) {\n var graph = createGraphFromNodeEdge(nodes, links, this, true, beforeLink);\n return graph.data;\n }\n\n function beforeLink(nodeData, edgeData) {\n nodeData.wrapMethod('getItemModel', function (model, idx) {\n var seriesModel = model.parentModel;\n var layout = seriesModel.getData().getItemLayout(idx);\n\n if (layout) {\n var nodeDepth = layout.depth;\n var levelModel = seriesModel.levelModels[nodeDepth];\n\n if (levelModel) {\n model.parentModel = levelModel;\n }\n }\n\n return model;\n });\n edgeData.wrapMethod('getItemModel', function (model, idx) {\n var seriesModel = model.parentModel;\n var edge = seriesModel.getGraph().getEdgeByIndex(idx);\n var layout = edge.node1.getLayout();\n\n if (layout) {\n var depth = layout.depth;\n var levelModel = seriesModel.levelModels[depth];\n\n if (levelModel) {\n model.parentModel = levelModel;\n }\n }\n\n return model;\n });\n }\n };\n\n SankeySeriesModel.prototype.setNodePosition = function (dataIndex, localPosition) {\n var nodes = this.option.data || this.option.nodes;\n var dataItem = nodes[dataIndex];\n dataItem.localX = localPosition[0];\n dataItem.localY = localPosition[1];\n };\n /**\r\n * Return the graphic data structure\r\n *\r\n * @return graphic data structure\r\n */\n\n\n SankeySeriesModel.prototype.getGraph = function () {\n return this.getData().graph;\n };\n /**\r\n * Get edge data of graphic data structure\r\n *\r\n * @return data structure of list\r\n */\n\n\n SankeySeriesModel.prototype.getEdgeData = function () {\n return this.getGraph().edgeData;\n };\n\n SankeySeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {\n function noValue(val) {\n return isNaN(val) || val == null;\n } // dataType === 'node' or empty do not show tooltip by default\n\n\n if (dataType === 'edge') {\n var params = this.getDataParams(dataIndex, dataType);\n var rawDataOpt = params.data;\n var edgeValue = params.value;\n var edgeName = rawDataOpt.source + ' -- ' + rawDataOpt.target;\n return createTooltipMarkup('nameValue', {\n name: edgeName,\n value: edgeValue,\n noValue: noValue(edgeValue)\n });\n } // dataType === 'node'\n else {\n var node = this.getGraph().getNodeByIndex(dataIndex);\n var value = node.getLayout().value;\n var name_1 = this.getDataParams(dataIndex, dataType).data.name;\n return createTooltipMarkup('nameValue', {\n name: name_1 != null ? name_1 + '' : null,\n value: value,\n noValue: noValue(value)\n });\n }\n };\n\n SankeySeriesModel.prototype.optionUpdated = function () {}; // Override Series.getDataParams()\n\n\n SankeySeriesModel.prototype.getDataParams = function (dataIndex, dataType) {\n var params = _super.prototype.getDataParams.call(this, dataIndex, dataType);\n\n if (params.value == null && dataType === 'node') {\n var node = this.getGraph().getNodeByIndex(dataIndex);\n var nodeValue = node.getLayout().value;\n params.value = nodeValue;\n }\n\n return params;\n };\n\n SankeySeriesModel.type = 'series.sankey';\n SankeySeriesModel.defaultOption = {\n // zlevel: 0,\n z: 2,\n coordinateSystem: 'view',\n left: '5%',\n top: '5%',\n right: '20%',\n bottom: '5%',\n orient: 'horizontal',\n nodeWidth: 20,\n nodeGap: 8,\n draggable: true,\n layoutIterations: 32,\n label: {\n show: true,\n position: 'right',\n fontSize: 12\n },\n levels: [],\n nodeAlign: 'justify',\n lineStyle: {\n color: '#314656',\n opacity: 0.2,\n curveness: 0.5\n },\n emphasis: {\n label: {\n show: true\n },\n lineStyle: {\n opacity: 0.5\n }\n },\n select: {\n itemStyle: {\n borderColor: '#212121'\n }\n },\n animationEasing: 'linear',\n animationDuration: 1000\n };\n return SankeySeriesModel;\n}(SeriesModel);\n\nexport default SankeySeriesModel;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/chart/sankey/SankeySeries.js"],"names":["__extends","SeriesModel","createGraphFromNodeEdge","Model","createTooltipMarkup","SankeySeriesModel","_super","_this","apply","arguments","type","prototype","getInitialData","option","ecModel","links","edges","nodes","data","levels","levelModels","i","length","depth","process","env","NODE_ENV","Error","graph","beforeLink","nodeData","edgeData","wrapMethod","model","idx","seriesModel","parentModel","layout","getData","getItemLayout","nodeDepth","levelModel","edge","getGraph","getEdgeByIndex","node1","getLayout","setNodePosition","dataIndex","localPosition","dataItem","localX","localY","getEdgeData","formatTooltip","multipleSeries","dataType","noValue","val","isNaN","params","getDataParams","rawDataOpt","edgeValue","value","edgeName","source","target","name","node","getNodeByIndex","name_1","optionUpdated","call","nodeValue","defaultOption","z","coordinateSystem","left","top","right","bottom","orient","nodeWidth","nodeGap","draggable","layoutIterations","label","show","position","fontSize","nodeAlign","lineStyle","color","opacity","curveness","emphasis","select","itemStyle","borderColor","animationEasing","animationDuration"],"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,SAAT,QAA0B,OAA1B;AACA,OAAOC,WAAP,MAAwB,uBAAxB;AACA,OAAOC,uBAAP,MAAoC,sCAApC;AACA,OAAOC,KAAP,MAAkB,sBAAlB;AACA,SAASC,mBAAT,QAAoC,0CAApC;;AAEA,IAAIC,iBAAiB;AACrB;AACA,UAAUC,MAAV,EAAkB;AAChBN,EAAAA,SAAS,CAACK,iBAAD,EAAoBC,MAApB,CAAT;;AAEA,WAASD,iBAAT,GAA6B;AAC3B,QAAIE,KAAK,GAAGD,MAAM,KAAK,IAAX,IAAmBA,MAAM,CAACE,KAA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\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 { __extends } from \"tslib\";\r\nimport SeriesModel from '../../model/Series.js';\r\nimport createGraphFromNodeEdge from '../helper/createGraphFromNodeEdge.js';\r\nimport Model from '../../model/Model.js';\r\nimport { createTooltipMarkup } from '../../component/tooltip/tooltipMarkup.js';\r\n\r\nvar SankeySeriesModel =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(SankeySeriesModel, _super);\r\n\r\n function SankeySeriesModel() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n\r\n _this.type = SankeySeriesModel.type;\r\n return _this;\r\n }\r\n /**\r\n * Init a graph data structure from data in option series\r\n */\r\n\r\n\r\n SankeySeriesModel.prototype.getInitialData = function (option, ecModel) {\r\n var links = option.edges || option.links;\r\n var nodes = option.data || option.nodes;\r\n var levels = option.levels;\r\n this.levelModels = [];\r\n var levelModels = this.levelModels;\r\n\r\n for (var i = 0; i < levels.length; i++) {\r\n if (levels[i].depth != null && levels[i].depth >= 0) {\r\n levelModels[levels[i].depth] = new Model(levels[i], this, ecModel);\r\n } else {\r\n if (process.env.NODE_ENV !== 'production') {\r\n throw new Error('levels[i].depth is mandatory and should be natural number');\r\n }\r\n }\r\n }\r\n\r\n if (nodes && links) {\r\n var graph = createGraphFromNodeEdge(nodes, links, this, true, beforeLink);\r\n return graph.data;\r\n }\r\n\r\n function beforeLink(nodeData, edgeData) {\r\n nodeData.wrapMethod('getItemModel', function (model, idx) {\r\n var seriesModel = model.parentModel;\r\n var layout = seriesModel.getData().getItemLayout(idx);\r\n\r\n if (layout) {\r\n var nodeDepth = layout.depth;\r\n var levelModel = seriesModel.levelModels[nodeDepth];\r\n\r\n if (levelModel) {\r\n model.parentModel = levelModel;\r\n }\r\n }\r\n\r\n return model;\r\n });\r\n edgeData.wrapMethod('getItemModel', function (model, idx) {\r\n var seriesModel = model.parentModel;\r\n var edge = seriesModel.getGraph().getEdgeByIndex(idx);\r\n var layout = edge.node1.getLayout();\r\n\r\n if (layout) {\r\n var depth = layout.depth;\r\n var levelModel = seriesModel.levelModels[depth];\r\n\r\n if (levelModel) {\r\n model.parentModel = levelModel;\r\n }\r\n }\r\n\r\n return model;\r\n });\r\n }\r\n };\r\n\r\n SankeySeriesModel.prototype.setNodePosition = function (dataIndex, localPosition) {\r\n var nodes = this.option.data || this.option.nodes;\r\n var dataItem = nodes[dataIndex];\r\n dataItem.localX = localPosition[0];\r\n dataItem.localY = localPosition[1];\r\n };\r\n /**\r\n * Return the graphic data structure\r\n *\r\n * @return graphic data structure\r\n */\r\n\r\n\r\n SankeySeriesModel.prototype.getGraph = function () {\r\n return this.getData().graph;\r\n };\r\n /**\r\n * Get edge data of graphic data structure\r\n *\r\n * @return data structure of list\r\n */\r\n\r\n\r\n SankeySeriesModel.prototype.getEdgeData = function () {\r\n return this.getGraph().edgeData;\r\n };\r\n\r\n SankeySeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {\r\n function noValue(val) {\r\n return isNaN(val) || val == null;\r\n } // dataType === 'node' or empty do not show tooltip by default\r\n\r\n\r\n if (dataType === 'edge') {\r\n var params = this.getDataParams(dataIndex, dataType);\r\n var rawDataOpt = params.data;\r\n var edgeValue = params.value;\r\n var edgeName = rawDataOpt.source + ' -- ' + rawDataOpt.target;\r\n return createTooltipMarkup('nameValue', {\r\n name: edgeName,\r\n value: edgeValue,\r\n noValue: noValue(edgeValue)\r\n });\r\n } // dataType === 'node'\r\n else {\r\n var node = this.getGraph().getNodeByIndex(dataIndex);\r\n var value = node.getLayout().value;\r\n var name_1 = this.getDataParams(dataIndex, dataType).data.name;\r\n return createTooltipMarkup('nameValue', {\r\n name: name_1 != null ? name_1 + '' : null,\r\n value: value,\r\n noValue: noValue(value)\r\n });\r\n }\r\n };\r\n\r\n SankeySeriesModel.prototype.optionUpdated = function () {}; // Override Series.getDataParams()\r\n\r\n\r\n SankeySeriesModel.prototype.getDataParams = function (dataIndex, dataType) {\r\n var params = _super.prototype.getDataParams.call(this, dataIndex, dataType);\r\n\r\n if (params.value == null && dataType === 'node') {\r\n var node = this.getGraph().getNodeByIndex(dataIndex);\r\n var nodeValue = node.getLayout().value;\r\n params.value = nodeValue;\r\n }\r\n\r\n return params;\r\n };\r\n\r\n SankeySeriesModel.type = 'series.sankey';\r\n SankeySeriesModel.defaultOption = {\r\n // zlevel: 0,\r\n z: 2,\r\n coordinateSystem: 'view',\r\n left: '5%',\r\n top: '5%',\r\n right: '20%',\r\n bottom: '5%',\r\n orient: 'horizontal',\r\n nodeWidth: 20,\r\n nodeGap: 8,\r\n draggable: true,\r\n layoutIterations: 32,\r\n label: {\r\n show: true,\r\n position: 'right',\r\n fontSize: 12\r\n },\r\n levels: [],\r\n nodeAlign: 'justify',\r\n lineStyle: {\r\n color: '#314656',\r\n opacity: 0.2,\r\n curveness: 0.5\r\n },\r\n emphasis: {\r\n label: {\r\n show: true\r\n },\r\n lineStyle: {\r\n opacity: 0.5\r\n }\r\n },\r\n select: {\r\n itemStyle: {\r\n borderColor: '#212121'\r\n }\r\n },\r\n animationEasing: 'linear',\r\n animationDuration: 1000\r\n };\r\n return SankeySeriesModel;\r\n}(SeriesModel);\r\n\r\nexport default SankeySeriesModel;"]},"metadata":{},"sourceType":"module"} |