1 line
36 KiB
JSON
1 line
36 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.fill.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 { __extends } from \"tslib\";\nimport * as graphic from '../../util/graphic.js';\nimport { enterEmphasis, leaveEmphasis, toggleHoverEmphasis, setStatesStylesFromModel } from '../../util/states.js';\nimport ChartView from '../../view/Chart.js';\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { isString } from 'zrender/lib/core/util.js';\n\nvar SankeyPathShape =\n/** @class */\nfunction () {\n function SankeyPathShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.cpx1 = 0;\n this.cpy1 = 0;\n this.cpx2 = 0;\n this.cpy2 = 0;\n this.extent = 0;\n }\n\n return SankeyPathShape;\n}();\n\nvar SankeyPath =\n/** @class */\nfunction (_super) {\n __extends(SankeyPath, _super);\n\n function SankeyPath(opts) {\n return _super.call(this, opts) || this;\n }\n\n SankeyPath.prototype.getDefaultShape = function () {\n return new SankeyPathShape();\n };\n\n SankeyPath.prototype.buildPath = function (ctx, shape) {\n var extent = shape.extent;\n ctx.moveTo(shape.x1, shape.y1);\n ctx.bezierCurveTo(shape.cpx1, shape.cpy1, shape.cpx2, shape.cpy2, shape.x2, shape.y2);\n\n if (shape.orient === 'vertical') {\n ctx.lineTo(shape.x2 + extent, shape.y2);\n ctx.bezierCurveTo(shape.cpx2 + extent, shape.cpy2, shape.cpx1 + extent, shape.cpy1, shape.x1 + extent, shape.y1);\n } else {\n ctx.lineTo(shape.x2, shape.y2 + extent);\n ctx.bezierCurveTo(shape.cpx2, shape.cpy2 + extent, shape.cpx1, shape.cpy1 + extent, shape.x1, shape.y1 + extent);\n }\n\n ctx.closePath();\n };\n\n SankeyPath.prototype.highlight = function () {\n enterEmphasis(this);\n };\n\n SankeyPath.prototype.downplay = function () {\n leaveEmphasis(this);\n };\n\n return SankeyPath;\n}(graphic.Path);\n\nvar SankeyView =\n/** @class */\nfunction (_super) {\n __extends(SankeyView, _super);\n\n function SankeyView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = SankeyView.type;\n _this._focusAdjacencyDisabled = false;\n return _this;\n }\n\n SankeyView.prototype.render = function (seriesModel, ecModel, api) {\n var sankeyView = this;\n var graph = seriesModel.getGraph();\n var group = this.group;\n var layoutInfo = seriesModel.layoutInfo; // view width\n\n var width = layoutInfo.width; // view height\n\n var height = layoutInfo.height;\n var nodeData = seriesModel.getData();\n var edgeData = seriesModel.getData('edge');\n var orient = seriesModel.get('orient');\n this._model = seriesModel;\n group.removeAll();\n group.x = layoutInfo.x;\n group.y = layoutInfo.y; // generate a bezire Curve for each edge\n\n graph.eachEdge(function (edge) {\n var curve = new SankeyPath();\n var ecData = getECData(curve);\n ecData.dataIndex = edge.dataIndex;\n ecData.seriesIndex = seriesModel.seriesIndex;\n ecData.dataType = 'edge';\n var edgeModel = edge.getModel();\n var lineStyleModel = edgeModel.getModel('lineStyle');\n var curvature = lineStyleModel.get('curveness');\n var n1Layout = edge.node1.getLayout();\n var node1Model = edge.node1.getModel();\n var dragX1 = node1Model.get('localX');\n var dragY1 = node1Model.get('localY');\n var n2Layout = edge.node2.getLayout();\n var node2Model = edge.node2.getModel();\n var dragX2 = node2Model.get('localX');\n var dragY2 = node2Model.get('localY');\n var edgeLayout = edge.getLayout();\n var x1;\n var y1;\n var x2;\n var y2;\n var cpx1;\n var cpy1;\n var cpx2;\n var cpy2;\n curve.shape.extent = Math.max(1, edgeLayout.dy);\n curve.shape.orient = orient;\n\n if (orient === 'vertical') {\n x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + edgeLayout.sy;\n y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + n1Layout.dy;\n x2 = (dragX2 != null ? dragX2 * width : n2Layout.x) + edgeLayout.ty;\n y2 = dragY2 != null ? dragY2 * height : n2Layout.y;\n cpx1 = x1;\n cpy1 = y1 * (1 - curvature) + y2 * curvature;\n cpx2 = x2;\n cpy2 = y1 * curvature + y2 * (1 - curvature);\n } else {\n x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + n1Layout.dx;\n y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + edgeLayout.sy;\n x2 = dragX2 != null ? dragX2 * width : n2Layout.x;\n y2 = (dragY2 != null ? dragY2 * height : n2Layout.y) + edgeLayout.ty;\n cpx1 = x1 * (1 - curvature) + x2 * curvature;\n cpy1 = y1;\n cpx2 = x1 * curvature + x2 * (1 - curvature);\n cpy2 = y2;\n }\n\n curve.setShape({\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2,\n cpx1: cpx1,\n cpy1: cpy1,\n cpx2: cpx2,\n cpy2: cpy2\n });\n curve.useStyle(lineStyleModel.getItemStyle()); // Special color, use source node color or target node color\n\n switch (curve.style.fill) {\n case 'source':\n curve.style.fill = edge.node1.getVisual('color');\n curve.style.decal = edge.node1.getVisual('style').decal;\n break;\n\n case 'target':\n curve.style.fill = edge.node2.getVisual('color');\n curve.style.decal = edge.node2.getVisual('style').decal;\n break;\n\n case 'gradient':\n var sourceColor = edge.node1.getVisual('color');\n var targetColor = edge.node2.getVisual('color');\n\n if (isString(sourceColor) && isString(targetColor)) {\n curve.style.fill = new graphic.LinearGradient(0, 0, +(orient === 'horizontal'), +(orient === 'vertical'), [{\n color: sourceColor,\n offset: 0\n }, {\n color: targetColor,\n offset: 1\n }]);\n }\n\n }\n\n setLabelStyle(curve, getLabelStatesModels(edgeModel, 'edgeLabel'), {\n labelFetcher: seriesModel,\n labelDataIndex: edge.dataIndex,\n defaultText: \"\" + edgeModel.get('value')\n });\n curve.setTextConfig({\n position: 'inside'\n });\n var emphasisModel = edgeModel.getModel('emphasis');\n setStatesStylesFromModel(curve, edgeModel, 'lineStyle', function (model) {\n return model.getItemStyle();\n });\n group.add(curve);\n edgeData.setItemGraphicEl(edge.dataIndex, curve);\n var focus = emphasisModel.get('focus');\n toggleHoverEmphasis(curve, focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n getECData(curve).dataType = 'edge';\n }); // Generate a rect for each node\n\n graph.eachNode(function (node) {\n var layout = node.getLayout();\n var itemModel = node.getModel();\n var dragX = itemModel.get('localX');\n var dragY = itemModel.get('localY');\n var emphasisModel = itemModel.getModel('emphasis');\n var rect = new graphic.Rect({\n shape: {\n x: dragX != null ? dragX * width : layout.x,\n y: dragY != null ? dragY * height : layout.y,\n width: layout.dx,\n height: layout.dy\n },\n style: itemModel.getModel('itemStyle').getItemStyle(),\n z2: 10\n });\n setLabelStyle(rect, getLabelStatesModels(itemModel), {\n labelFetcher: seriesModel,\n labelDataIndex: node.dataIndex,\n defaultText: node.id\n });\n rect.disableLabelAnimation = true;\n rect.setStyle('fill', node.getVisual('color'));\n rect.setStyle('decal', node.getVisual('style').decal);\n setStatesStylesFromModel(rect, itemModel);\n group.add(rect);\n nodeData.setItemGraphicEl(node.dataIndex, rect);\n getECData(rect).dataType = 'node';\n var focus = emphasisModel.get('focus');\n toggleHoverEmphasis(rect, focus === 'adjacency' ? node.getAdjacentDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n });\n nodeData.eachItemGraphicEl(function (el, dataIndex) {\n var itemModel = nodeData.getItemModel(dataIndex);\n\n if (itemModel.get('draggable')) {\n el.drift = function (dx, dy) {\n sankeyView._focusAdjacencyDisabled = true;\n this.shape.x += dx;\n this.shape.y += dy;\n this.dirty();\n api.dispatchAction({\n type: 'dragNode',\n seriesId: seriesModel.id,\n dataIndex: nodeData.getRawIndex(dataIndex),\n localX: this.shape.x / width,\n localY: this.shape.y / height\n });\n };\n\n el.ondragend = function () {\n sankeyView._focusAdjacencyDisabled = false;\n };\n\n el.draggable = true;\n el.cursor = 'move';\n }\n });\n\n if (!this._data && seriesModel.isAnimationEnabled()) {\n group.setClipPath(createGridClipShape(group.getBoundingRect(), seriesModel, function () {\n group.removeClipPath();\n }));\n }\n\n this._data = seriesModel.getData();\n };\n\n SankeyView.prototype.dispose = function () {};\n\n SankeyView.type = 'sankey';\n return SankeyView;\n}(ChartView); // Add animation to the view\n\n\nfunction createGridClipShape(rect, seriesModel, cb) {\n var rectEl = new graphic.Rect({\n shape: {\n x: rect.x - 10,\n y: rect.y - 10,\n width: 0,\n height: rect.height + 20\n }\n });\n graphic.initProps(rectEl, {\n shape: {\n width: rect.width + 20\n }\n }, seriesModel, cb);\n return rectEl;\n}\n\nexport default SankeyView;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/echarts/lib/chart/sankey/SankeyView.js"],"names":["__extends","graphic","enterEmphasis","leaveEmphasis","toggleHoverEmphasis","setStatesStylesFromModel","ChartView","setLabelStyle","getLabelStatesModels","getECData","isString","SankeyPathShape","x1","y1","x2","y2","cpx1","cpy1","cpx2","cpy2","extent","SankeyPath","_super","opts","call","prototype","getDefaultShape","buildPath","ctx","shape","moveTo","bezierCurveTo","orient","lineTo","closePath","highlight","downplay","Path","SankeyView","_this","apply","arguments","type","_focusAdjacencyDisabled","render","seriesModel","ecModel","api","sankeyView","graph","getGraph","group","layoutInfo","width","height","nodeData","getData","edgeData","get","_model","removeAll","x","y","eachEdge","edge","curve","ecData","dataIndex","seriesIndex","dataType","edgeModel","getModel","lineStyleModel","curvature","n1Layout","node1","getLayout","node1Model","dragX1","dragY1","n2Layout","node2","node2Model","dragX2","dragY2","edgeLayout","Math","max","dy","sy","ty","dx","setShape","useStyle","getItemStyle","style","fill","getVisual","decal","sourceColor","targetColor","LinearGradient","color","offset","labelFetcher","labelDataIndex","defaultText","setTextConfig","position","emphasisModel","model","add","setItemGraphicEl","focus","getAdjacentDataIndices","eachNode","node","layout","itemModel","dragX","dragY","rect","Rect","z2","id","disableLabelAnimation","setStyle","eachItemGraphicEl","el","getItemModel","drift","dirty","dispatchAction","seriesId","getRawIndex","localX","localY","ondragend","draggable","cursor","_data","isAnimationEnabled","setClipPath","createGridClipShape","getBoundingRect","removeClipPath","dispose","cb","rectEl","initProps"],"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,OAAO,KAAKC,OAAZ,MAAyB,uBAAzB;AACA,SAASC,aAAT,EAAwBC,aAAxB,EAAuCC,mBAAvC,EAA4DC,wBAA5D,QAA4F,sBAA5F;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,SAASC,aAAT,EAAwBC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AAA,KAAK,CAAC2F,WAAN,CAAkBC,mBAAmB,CAAC5F,KAAK,CAAC6F,eAAN,EAAD,EAA0BnG,WAA1B,EAAuC,YAAY;AACtFM,QAAAA,KAAK,CAAC8F,cAAN;AACD,OAFoC,CAArC;AAGD;;AAED,SAAKL,KAAL,GAAa/F,WAAW,CAACW,OAAZ,EAAb;AACD,GA7LD;;AA+LAlB,EAAAA,UAAU,CAACb,SAAX,CAAqByH,OAArB,GAA+B,YAAY,CAAE,CAA7C;;AAEA5G,EAAAA,UAAU,CAACI,IAAX,GAAkB,QAAlB;AACA,SAAOJ,UAAP;AACD,CA9MD,CA8MEhC,SA9MF,CAFA,C,CAgNc;;;AAGd,SAASyI,mBAAT,CAA6BtB,IAA7B,EAAmC5E,WAAnC,EAAgDsG,EAAhD,EAAoD;AAClD,MAAIC,MAAM,GAAG,IAAInJ,OAAO,CAACyH,IAAZ,CAAiB;AAC5B7F,IAAAA,KAAK,EAAE;AACLgC,MAAAA,CAAC,EAAE4D,IAAI,CAAC5D,CAAL,GAAS,EADP;AAELC,MAAAA,CAAC,EAAE2D,IAAI,CAAC3D,CAAL,GAAS,EAFP;AAGLT,MAAAA,KAAK,EAAE,CAHF;AAILC,MAAAA,MAAM,EAAEmE,IAAI,CAACnE,MAAL,GAAc;AAJjB;AADqB,GAAjB,CAAb;AAQArD,EAAAA,OAAO,CAACoJ,SAAR,CAAkBD,MAAlB,EAA0B;AACxBvH,IAAAA,KAAK,EAAE;AACLwB,MAAAA,KAAK,EAAEoE,IAAI,CAACpE,KAAL,GAAa;AADf;AADiB,GAA1B,EAIGR,WAJH,EAIgBsG,EAJhB;AAKA,SAAOC,MAAP;AACD;;AAED,eAAe9G,UAAf","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 { __extends } from \"tslib\";\nimport * as graphic from '../../util/graphic.js';\nimport { enterEmphasis, leaveEmphasis, toggleHoverEmphasis, setStatesStylesFromModel } from '../../util/states.js';\nimport ChartView from '../../view/Chart.js';\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { isString } from 'zrender/lib/core/util.js';\n\nvar SankeyPathShape =\n/** @class */\nfunction () {\n function SankeyPathShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.cpx1 = 0;\n this.cpy1 = 0;\n this.cpx2 = 0;\n this.cpy2 = 0;\n this.extent = 0;\n }\n\n return SankeyPathShape;\n}();\n\nvar SankeyPath =\n/** @class */\nfunction (_super) {\n __extends(SankeyPath, _super);\n\n function SankeyPath(opts) {\n return _super.call(this, opts) || this;\n }\n\n SankeyPath.prototype.getDefaultShape = function () {\n return new SankeyPathShape();\n };\n\n SankeyPath.prototype.buildPath = function (ctx, shape) {\n var extent = shape.extent;\n ctx.moveTo(shape.x1, shape.y1);\n ctx.bezierCurveTo(shape.cpx1, shape.cpy1, shape.cpx2, shape.cpy2, shape.x2, shape.y2);\n\n if (shape.orient === 'vertical') {\n ctx.lineTo(shape.x2 + extent, shape.y2);\n ctx.bezierCurveTo(shape.cpx2 + extent, shape.cpy2, shape.cpx1 + extent, shape.cpy1, shape.x1 + extent, shape.y1);\n } else {\n ctx.lineTo(shape.x2, shape.y2 + extent);\n ctx.bezierCurveTo(shape.cpx2, shape.cpy2 + extent, shape.cpx1, shape.cpy1 + extent, shape.x1, shape.y1 + extent);\n }\n\n ctx.closePath();\n };\n\n SankeyPath.prototype.highlight = function () {\n enterEmphasis(this);\n };\n\n SankeyPath.prototype.downplay = function () {\n leaveEmphasis(this);\n };\n\n return SankeyPath;\n}(graphic.Path);\n\nvar SankeyView =\n/** @class */\nfunction (_super) {\n __extends(SankeyView, _super);\n\n function SankeyView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = SankeyView.type;\n _this._focusAdjacencyDisabled = false;\n return _this;\n }\n\n SankeyView.prototype.render = function (seriesModel, ecModel, api) {\n var sankeyView = this;\n var graph = seriesModel.getGraph();\n var group = this.group;\n var layoutInfo = seriesModel.layoutInfo; // view width\n\n var width = layoutInfo.width; // view height\n\n var height = layoutInfo.height;\n var nodeData = seriesModel.getData();\n var edgeData = seriesModel.getData('edge');\n var orient = seriesModel.get('orient');\n this._model = seriesModel;\n group.removeAll();\n group.x = layoutInfo.x;\n group.y = layoutInfo.y; // generate a bezire Curve for each edge\n\n graph.eachEdge(function (edge) {\n var curve = new SankeyPath();\n var ecData = getECData(curve);\n ecData.dataIndex = edge.dataIndex;\n ecData.seriesIndex = seriesModel.seriesIndex;\n ecData.dataType = 'edge';\n var edgeModel = edge.getModel();\n var lineStyleModel = edgeModel.getModel('lineStyle');\n var curvature = lineStyleModel.get('curveness');\n var n1Layout = edge.node1.getLayout();\n var node1Model = edge.node1.getModel();\n var dragX1 = node1Model.get('localX');\n var dragY1 = node1Model.get('localY');\n var n2Layout = edge.node2.getLayout();\n var node2Model = edge.node2.getModel();\n var dragX2 = node2Model.get('localX');\n var dragY2 = node2Model.get('localY');\n var edgeLayout = edge.getLayout();\n var x1;\n var y1;\n var x2;\n var y2;\n var cpx1;\n var cpy1;\n var cpx2;\n var cpy2;\n curve.shape.extent = Math.max(1, edgeLayout.dy);\n curve.shape.orient = orient;\n\n if (orient === 'vertical') {\n x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + edgeLayout.sy;\n y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + n1Layout.dy;\n x2 = (dragX2 != null ? dragX2 * width : n2Layout.x) + edgeLayout.ty;\n y2 = dragY2 != null ? dragY2 * height : n2Layout.y;\n cpx1 = x1;\n cpy1 = y1 * (1 - curvature) + y2 * curvature;\n cpx2 = x2;\n cpy2 = y1 * curvature + y2 * (1 - curvature);\n } else {\n x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + n1Layout.dx;\n y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + edgeLayout.sy;\n x2 = dragX2 != null ? dragX2 * width : n2Layout.x;\n y2 = (dragY2 != null ? dragY2 * height : n2Layout.y) + edgeLayout.ty;\n cpx1 = x1 * (1 - curvature) + x2 * curvature;\n cpy1 = y1;\n cpx2 = x1 * curvature + x2 * (1 - curvature);\n cpy2 = y2;\n }\n\n curve.setShape({\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2,\n cpx1: cpx1,\n cpy1: cpy1,\n cpx2: cpx2,\n cpy2: cpy2\n });\n curve.useStyle(lineStyleModel.getItemStyle()); // Special color, use source node color or target node color\n\n switch (curve.style.fill) {\n case 'source':\n curve.style.fill = edge.node1.getVisual('color');\n curve.style.decal = edge.node1.getVisual('style').decal;\n break;\n\n case 'target':\n curve.style.fill = edge.node2.getVisual('color');\n curve.style.decal = edge.node2.getVisual('style').decal;\n break;\n\n case 'gradient':\n var sourceColor = edge.node1.getVisual('color');\n var targetColor = edge.node2.getVisual('color');\n\n if (isString(sourceColor) && isString(targetColor)) {\n curve.style.fill = new graphic.LinearGradient(0, 0, +(orient === 'horizontal'), +(orient === 'vertical'), [{\n color: sourceColor,\n offset: 0\n }, {\n color: targetColor,\n offset: 1\n }]);\n }\n\n }\n\n setLabelStyle(curve, getLabelStatesModels(edgeModel, 'edgeLabel'), {\n labelFetcher: seriesModel,\n labelDataIndex: edge.dataIndex,\n defaultText: \"\" + edgeModel.get('value')\n });\n curve.setTextConfig({\n position: 'inside'\n });\n var emphasisModel = edgeModel.getModel('emphasis');\n setStatesStylesFromModel(curve, edgeModel, 'lineStyle', function (model) {\n return model.getItemStyle();\n });\n group.add(curve);\n edgeData.setItemGraphicEl(edge.dataIndex, curve);\n var focus = emphasisModel.get('focus');\n toggleHoverEmphasis(curve, focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n getECData(curve).dataType = 'edge';\n }); // Generate a rect for each node\n\n graph.eachNode(function (node) {\n var layout = node.getLayout();\n var itemModel = node.getModel();\n var dragX = itemModel.get('localX');\n var dragY = itemModel.get('localY');\n var emphasisModel = itemModel.getModel('emphasis');\n var rect = new graphic.Rect({\n shape: {\n x: dragX != null ? dragX * width : layout.x,\n y: dragY != null ? dragY * height : layout.y,\n width: layout.dx,\n height: layout.dy\n },\n style: itemModel.getModel('itemStyle').getItemStyle(),\n z2: 10\n });\n setLabelStyle(rect, getLabelStatesModels(itemModel), {\n labelFetcher: seriesModel,\n labelDataIndex: node.dataIndex,\n defaultText: node.id\n });\n rect.disableLabelAnimation = true;\n rect.setStyle('fill', node.getVisual('color'));\n rect.setStyle('decal', node.getVisual('style').decal);\n setStatesStylesFromModel(rect, itemModel);\n group.add(rect);\n nodeData.setItemGraphicEl(node.dataIndex, rect);\n getECData(rect).dataType = 'node';\n var focus = emphasisModel.get('focus');\n toggleHoverEmphasis(rect, focus === 'adjacency' ? node.getAdjacentDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n });\n nodeData.eachItemGraphicEl(function (el, dataIndex) {\n var itemModel = nodeData.getItemModel(dataIndex);\n\n if (itemModel.get('draggable')) {\n el.drift = function (dx, dy) {\n sankeyView._focusAdjacencyDisabled = true;\n this.shape.x += dx;\n this.shape.y += dy;\n this.dirty();\n api.dispatchAction({\n type: 'dragNode',\n seriesId: seriesModel.id,\n dataIndex: nodeData.getRawIndex(dataIndex),\n localX: this.shape.x / width,\n localY: this.shape.y / height\n });\n };\n\n el.ondragend = function () {\n sankeyView._focusAdjacencyDisabled = false;\n };\n\n el.draggable = true;\n el.cursor = 'move';\n }\n });\n\n if (!this._data && seriesModel.isAnimationEnabled()) {\n group.setClipPath(createGridClipShape(group.getBoundingRect(), seriesModel, function () {\n group.removeClipPath();\n }));\n }\n\n this._data = seriesModel.getData();\n };\n\n SankeyView.prototype.dispose = function () {};\n\n SankeyView.type = 'sankey';\n return SankeyView;\n}(ChartView); // Add animation to the view\n\n\nfunction createGridClipShape(rect, seriesModel, cb) {\n var rectEl = new graphic.Rect({\n shape: {\n x: rect.x - 10,\n y: rect.y - 10,\n width: 0,\n height: rect.height + 20\n }\n });\n graphic.initProps(rectEl, {\n shape: {\n width: rect.width + 20\n }\n }, seriesModel, cb);\n return rectEl;\n}\n\nexport default SankeyView;"]},"metadata":{},"sourceType":"module"} |