1 line
36 KiB
JSON
1 line
36 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.fill.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 * 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 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/qingge-Market/qingge-vue/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","emphasisModel","model","add","setItemGraphicEl","focus","getAdjacentDataIndices","eachNode","node","layout","itemModel","dragX","dragY","rect","Rect","z2","labelFetcher","labelDataIndex","defaultText","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,oBAAxB,QAAoD,2BAApD;AACA,SAASC,SAAT,QAA0B,0BAA1B;AACA,SAASC,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AwMc;;;AAGd,SAASuI,mBAAT,CAA6BzB,IAA7B,EAAmCvE,WAAnC,EAAgDoG,EAAhD,EAAoD;AAClD,MAAIC,MAAM,GAAG,IAAIjJ,OAAO,CAACoH,IAAZ,CAAiB;AAC5BxF,IAAAA,KAAK,EAAE;AACLgC,MAAAA,CAAC,EAAEuD,IAAI,CAACvD,CAAL,GAAS,EADP;AAELC,MAAAA,CAAC,EAAEsD,IAAI,CAACtD,CAAL,GAAS,EAFP;AAGLT,MAAAA,KAAK,EAAE,CAHF;AAILC,MAAAA,MAAM,EAAE8D,IAAI,CAAC9D,MAAL,GAAc;AAJjB;AADqB,GAAjB,CAAb;AAQArD,EAAAA,OAAO,CAACkJ,SAAR,CAAkBD,MAAlB,EAA0B;AACxBrH,IAAAA,KAAK,EAAE;AACLwB,MAAAA,KAAK,EAAE+D,IAAI,CAAC/D,KAAL,GAAa;AADf;AADiB,GAA1B,EAIGR,WAJH,EAIgBoG,EAJhB;AAKA,SAAOC,MAAP;AACD;;AAED,eAAe5G,UAAf","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 { __extends } from \"tslib\";\r\nimport * as graphic from '../../util/graphic.js';\r\nimport { enterEmphasis, leaveEmphasis, toggleHoverEmphasis, setStatesStylesFromModel } from '../../util/states.js';\r\nimport ChartView from '../../view/Chart.js';\r\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\r\nimport { getECData } from '../../util/innerStore.js';\r\nimport { isString } from 'zrender/lib/core/util.js';\r\n\r\nvar SankeyPathShape =\r\n/** @class */\r\nfunction () {\r\n function SankeyPathShape() {\r\n this.x1 = 0;\r\n this.y1 = 0;\r\n this.x2 = 0;\r\n this.y2 = 0;\r\n this.cpx1 = 0;\r\n this.cpy1 = 0;\r\n this.cpx2 = 0;\r\n this.cpy2 = 0;\r\n this.extent = 0;\r\n }\r\n\r\n return SankeyPathShape;\r\n}();\r\n\r\nvar SankeyPath =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(SankeyPath, _super);\r\n\r\n function SankeyPath(opts) {\r\n return _super.call(this, opts) || this;\r\n }\r\n\r\n SankeyPath.prototype.getDefaultShape = function () {\r\n return new SankeyPathShape();\r\n };\r\n\r\n SankeyPath.prototype.buildPath = function (ctx, shape) {\r\n var extent = shape.extent;\r\n ctx.moveTo(shape.x1, shape.y1);\r\n ctx.bezierCurveTo(shape.cpx1, shape.cpy1, shape.cpx2, shape.cpy2, shape.x2, shape.y2);\r\n\r\n if (shape.orient === 'vertical') {\r\n ctx.lineTo(shape.x2 + extent, shape.y2);\r\n ctx.bezierCurveTo(shape.cpx2 + extent, shape.cpy2, shape.cpx1 + extent, shape.cpy1, shape.x1 + extent, shape.y1);\r\n } else {\r\n ctx.lineTo(shape.x2, shape.y2 + extent);\r\n ctx.bezierCurveTo(shape.cpx2, shape.cpy2 + extent, shape.cpx1, shape.cpy1 + extent, shape.x1, shape.y1 + extent);\r\n }\r\n\r\n ctx.closePath();\r\n };\r\n\r\n SankeyPath.prototype.highlight = function () {\r\n enterEmphasis(this);\r\n };\r\n\r\n SankeyPath.prototype.downplay = function () {\r\n leaveEmphasis(this);\r\n };\r\n\r\n return SankeyPath;\r\n}(graphic.Path);\r\n\r\nvar SankeyView =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(SankeyView, _super);\r\n\r\n function SankeyView() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n\r\n _this.type = SankeyView.type;\r\n _this._focusAdjacencyDisabled = false;\r\n return _this;\r\n }\r\n\r\n SankeyView.prototype.render = function (seriesModel, ecModel, api) {\r\n var sankeyView = this;\r\n var graph = seriesModel.getGraph();\r\n var group = this.group;\r\n var layoutInfo = seriesModel.layoutInfo; // view width\r\n\r\n var width = layoutInfo.width; // view height\r\n\r\n var height = layoutInfo.height;\r\n var nodeData = seriesModel.getData();\r\n var edgeData = seriesModel.getData('edge');\r\n var orient = seriesModel.get('orient');\r\n this._model = seriesModel;\r\n group.removeAll();\r\n group.x = layoutInfo.x;\r\n group.y = layoutInfo.y; // generate a bezire Curve for each edge\r\n\r\n graph.eachEdge(function (edge) {\r\n var curve = new SankeyPath();\r\n var ecData = getECData(curve);\r\n ecData.dataIndex = edge.dataIndex;\r\n ecData.seriesIndex = seriesModel.seriesIndex;\r\n ecData.dataType = 'edge';\r\n var edgeModel = edge.getModel();\r\n var lineStyleModel = edgeModel.getModel('lineStyle');\r\n var curvature = lineStyleModel.get('curveness');\r\n var n1Layout = edge.node1.getLayout();\r\n var node1Model = edge.node1.getModel();\r\n var dragX1 = node1Model.get('localX');\r\n var dragY1 = node1Model.get('localY');\r\n var n2Layout = edge.node2.getLayout();\r\n var node2Model = edge.node2.getModel();\r\n var dragX2 = node2Model.get('localX');\r\n var dragY2 = node2Model.get('localY');\r\n var edgeLayout = edge.getLayout();\r\n var x1;\r\n var y1;\r\n var x2;\r\n var y2;\r\n var cpx1;\r\n var cpy1;\r\n var cpx2;\r\n var cpy2;\r\n curve.shape.extent = Math.max(1, edgeLayout.dy);\r\n curve.shape.orient = orient;\r\n\r\n if (orient === 'vertical') {\r\n x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + edgeLayout.sy;\r\n y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + n1Layout.dy;\r\n x2 = (dragX2 != null ? dragX2 * width : n2Layout.x) + edgeLayout.ty;\r\n y2 = dragY2 != null ? dragY2 * height : n2Layout.y;\r\n cpx1 = x1;\r\n cpy1 = y1 * (1 - curvature) + y2 * curvature;\r\n cpx2 = x2;\r\n cpy2 = y1 * curvature + y2 * (1 - curvature);\r\n } else {\r\n x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + n1Layout.dx;\r\n y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + edgeLayout.sy;\r\n x2 = dragX2 != null ? dragX2 * width : n2Layout.x;\r\n y2 = (dragY2 != null ? dragY2 * height : n2Layout.y) + edgeLayout.ty;\r\n cpx1 = x1 * (1 - curvature) + x2 * curvature;\r\n cpy1 = y1;\r\n cpx2 = x1 * curvature + x2 * (1 - curvature);\r\n cpy2 = y2;\r\n }\r\n\r\n curve.setShape({\r\n x1: x1,\r\n y1: y1,\r\n x2: x2,\r\n y2: y2,\r\n cpx1: cpx1,\r\n cpy1: cpy1,\r\n cpx2: cpx2,\r\n cpy2: cpy2\r\n });\r\n curve.useStyle(lineStyleModel.getItemStyle()); // Special color, use source node color or target node color\r\n\r\n switch (curve.style.fill) {\r\n case 'source':\r\n curve.style.fill = edge.node1.getVisual('color');\r\n curve.style.decal = edge.node1.getVisual('style').decal;\r\n break;\r\n\r\n case 'target':\r\n curve.style.fill = edge.node2.getVisual('color');\r\n curve.style.decal = edge.node2.getVisual('style').decal;\r\n break;\r\n\r\n case 'gradient':\r\n var sourceColor = edge.node1.getVisual('color');\r\n var targetColor = edge.node2.getVisual('color');\r\n\r\n if (isString(sourceColor) && isString(targetColor)) {\r\n curve.style.fill = new graphic.LinearGradient(0, 0, +(orient === 'horizontal'), +(orient === 'vertical'), [{\r\n color: sourceColor,\r\n offset: 0\r\n }, {\r\n color: targetColor,\r\n offset: 1\r\n }]);\r\n }\r\n\r\n }\r\n\r\n var emphasisModel = edgeModel.getModel('emphasis');\r\n setStatesStylesFromModel(curve, edgeModel, 'lineStyle', function (model) {\r\n return model.getItemStyle();\r\n });\r\n group.add(curve);\r\n edgeData.setItemGraphicEl(edge.dataIndex, curve);\r\n var focus = emphasisModel.get('focus');\r\n toggleHoverEmphasis(curve, focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\r\n getECData(curve).dataType = 'edge';\r\n }); // Generate a rect for each node\r\n\r\n graph.eachNode(function (node) {\r\n var layout = node.getLayout();\r\n var itemModel = node.getModel();\r\n var dragX = itemModel.get('localX');\r\n var dragY = itemModel.get('localY');\r\n var emphasisModel = itemModel.getModel('emphasis');\r\n var rect = new graphic.Rect({\r\n shape: {\r\n x: dragX != null ? dragX * width : layout.x,\r\n y: dragY != null ? dragY * height : layout.y,\r\n width: layout.dx,\r\n height: layout.dy\r\n },\r\n style: itemModel.getModel('itemStyle').getItemStyle(),\r\n z2: 10\r\n });\r\n setLabelStyle(rect, getLabelStatesModels(itemModel), {\r\n labelFetcher: seriesModel,\r\n labelDataIndex: node.dataIndex,\r\n defaultText: node.id\r\n });\r\n rect.disableLabelAnimation = true;\r\n rect.setStyle('fill', node.getVisual('color'));\r\n rect.setStyle('decal', node.getVisual('style').decal);\r\n setStatesStylesFromModel(rect, itemModel);\r\n group.add(rect);\r\n nodeData.setItemGraphicEl(node.dataIndex, rect);\r\n getECData(rect).dataType = 'node';\r\n var focus = emphasisModel.get('focus');\r\n toggleHoverEmphasis(rect, focus === 'adjacency' ? node.getAdjacentDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\r\n });\r\n nodeData.eachItemGraphicEl(function (el, dataIndex) {\r\n var itemModel = nodeData.getItemModel(dataIndex);\r\n\r\n if (itemModel.get('draggable')) {\r\n el.drift = function (dx, dy) {\r\n sankeyView._focusAdjacencyDisabled = true;\r\n this.shape.x += dx;\r\n this.shape.y += dy;\r\n this.dirty();\r\n api.dispatchAction({\r\n type: 'dragNode',\r\n seriesId: seriesModel.id,\r\n dataIndex: nodeData.getRawIndex(dataIndex),\r\n localX: this.shape.x / width,\r\n localY: this.shape.y / height\r\n });\r\n };\r\n\r\n el.ondragend = function () {\r\n sankeyView._focusAdjacencyDisabled = false;\r\n };\r\n\r\n el.draggable = true;\r\n el.cursor = 'move';\r\n }\r\n });\r\n\r\n if (!this._data && seriesModel.isAnimationEnabled()) {\r\n group.setClipPath(createGridClipShape(group.getBoundingRect(), seriesModel, function () {\r\n group.removeClipPath();\r\n }));\r\n }\r\n\r\n this._data = seriesModel.getData();\r\n };\r\n\r\n SankeyView.prototype.dispose = function () {};\r\n\r\n SankeyView.type = 'sankey';\r\n return SankeyView;\r\n}(ChartView); // Add animation to the view\r\n\r\n\r\nfunction createGridClipShape(rect, seriesModel, cb) {\r\n var rectEl = new graphic.Rect({\r\n shape: {\r\n x: rect.x - 10,\r\n y: rect.y - 10,\r\n width: 0,\r\n height: rect.height + 20\r\n }\r\n });\r\n graphic.initProps(rectEl, {\r\n shape: {\r\n width: rect.width + 20\r\n }\r\n }, seriesModel, cb);\r\n return rectEl;\r\n}\r\n\r\nexport default SankeyView;"]},"metadata":{},"sourceType":"module"} |