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GAC5D,IAAI8/B,EAAehhC,EAAOqD,OAAO,CAAC,EAAGq8B,GAErC,GAAIK,EAAS,CACX,IAAIkB,EAAclB,EAAQv7B,KACtBgrB,EAAiC,UAAhByR,GAA2BlB,EAAQgB,mBACpDlzB,EAA2B,UAAnB2hB,EAA6B7d,EAA2B,OAAnB6d,EAA0BtuB,EAAY+uB,aAAatiB,EAAM2B,SAAW3B,EAAMqC,SAASmnB,EAAUp1B,IAAI,oBAClJi/B,EAAaC,GAAelB,EAAQmB,iBAAiBrzB,EACvD,CAEA,OAAOmzB,CACT,CAEAz3B,EAAOC,QAAUtB,C","sources":["webpack://i4proportal/./node_modules/echarts/lib/chart/sunburst.js","webpack://i4proportal/./node_modules/echarts/lib/chart/sunburst/SunburstPiece.js","webpack://i4proportal/./node_modules/echarts/lib/chart/sunburst/SunburstSeries.js","webpack://i4proportal/./node_modules/echarts/lib/chart/sunburst/SunburstView.js","webpack://i4proportal/./node_modules/echarts/lib/chart/sunburst/sunburstAction.js","webpack://i4proportal/./node_modules/echarts/lib/chart/sunburst/sunburstLayout.js","webpack://i4proportal/./node_modules/echarts/lib/chart/themeRiver.js","webpack://i4proportal/./node_modules/echarts/lib/chart/themeRiver/ThemeRiverSeries.js","webpack://i4proportal/./node_modules/echarts/lib/chart/themeRiver/ThemeRiverView.js","webpack://i4proportal/./node_modules/echarts/lib/chart/themeRiver/themeRiverLayout.js","webpack://i4proportal/./node_modules/echarts/lib/chart/themeRiver/themeRiverVisual.js","webpack://i4proportal/./node_modules/echarts/lib/chart/tree.js","webpack://i4proportal/./node_modules/echarts/lib/chart/tree/TreeSeries.js","webpack://i4proportal/./node_modules/echarts/lib/chart/tree/TreeView.js","webpack://i4proportal/./node_modules/echarts/lib/chart/tree/layoutHelper.js","webpack://i4proportal/./node_modules/echarts/lib/chart/tree/traversalHelper.js","webpack://i4proportal/./node_modules/echarts/lib/chart/tree/treeAction.js","webpack://i4proportal/./node_modules/echarts/lib/chart/tree/treeLayout.js","webpack://i4proportal/./node_modules/echarts/lib/chart/treemap.js","webpack://i4proportal/./node_modules/echarts/lib/chart/treemap/Breadcrumb.js","webpack://i4proportal/./node_modules/echarts/lib/chart/treemap/TreemapSeries.js","webpack://i4proportal/./node_modules/echarts/lib/chart/treemap/TreemapView.js","webpack://i4proportal/./node_modules/echarts/lib/chart/treemap/treemapAction.js","webpack://i4proportal/./node_modules/echarts/lib/chart/treemap/treemapLayout.js","webpack://i4proportal/./node_modules/echarts/lib/chart/treemap/treemapVisual.js"],"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\nvar echarts = require(\"../echarts\");\n\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nrequire(\"./sunburst/SunburstSeries\");\n\nrequire(\"./sunburst/SunburstView\");\n\nrequire(\"./sunburst/sunburstAction\");\n\nvar dataColor = require(\"../visual/dataColor\");\n\nvar sunburstLayout = require(\"./sunburst/sunburstLayout\");\n\nvar dataFilter = require(\"../processor/dataFilter\");\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*/\necharts.registerVisual(zrUtil.curry(dataColor, 'sunburst'));\necharts.registerLayout(zrUtil.curry(sunburstLayout, 'sunburst'));\necharts.registerProcessor(zrUtil.curry(dataFilter, 'sunburst'));","\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\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar graphic = require(\"../../util/graphic\");\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*/\nvar NodeHighlightPolicy = {\n NONE: 'none',\n // not downplay others\n DESCENDANT: 'descendant',\n ANCESTOR: 'ancestor',\n SELF: 'self'\n};\nvar DEFAULT_SECTOR_Z = 2;\nvar DEFAULT_TEXT_Z = 4;\n/**\n * Sunburstce of Sunburst including Sector, Label, LabelLine\n * @constructor\n * @extends {module:zrender/graphic/Group}\n */\n\nfunction SunburstPiece(node, seriesModel, ecModel) {\n graphic.Group.call(this);\n var sector = new graphic.Sector({\n z2: DEFAULT_SECTOR_Z\n });\n sector.seriesIndex = seriesModel.seriesIndex;\n var text = new graphic.Text({\n z2: DEFAULT_TEXT_Z,\n silent: node.getModel('label').get('silent')\n });\n this.add(sector);\n this.add(text);\n this.updateData(true, node, 'normal', seriesModel, ecModel); // Hover to change label and labelLine\n\n function onEmphasis() {\n text.ignore = text.hoverIgnore;\n }\n\n function onNormal() {\n text.ignore = text.normalIgnore;\n }\n\n this.on('emphasis', onEmphasis).on('normal', onNormal).on('mouseover', onEmphasis).on('mouseout', onNormal);\n}\n\nvar SunburstPieceProto = SunburstPiece.prototype;\n\nSunburstPieceProto.updateData = function (firstCreate, node, state, seriesModel, ecModel) {\n this.node = node;\n node.piece = this;\n seriesModel = seriesModel || this._seriesModel;\n ecModel = ecModel || this._ecModel;\n var sector = this.childAt(0);\n sector.dataIndex = node.dataIndex;\n var itemModel = node.getModel();\n var layout = node.getLayout(); // if (!layout) {\n // console.log(node.getLayout());\n // }\n\n var sectorShape = zrUtil.extend({}, layout);\n sectorShape.label = null;\n var visualColor = getNodeColor(node, seriesModel, ecModel);\n fillDefaultColor(node, seriesModel, visualColor);\n var normalStyle = itemModel.getModel('itemStyle').getItemStyle();\n var style;\n\n if (state === 'normal') {\n style = normalStyle;\n } else {\n var stateStyle = itemModel.getModel(state + '.itemStyle').getItemStyle();\n style = zrUtil.merge(stateStyle, normalStyle);\n }\n\n style = zrUtil.defaults({\n lineJoin: 'bevel',\n fill: style.fill || visualColor\n }, style);\n\n if (firstCreate) {\n sector.setShape(sectorShape);\n sector.shape.r = layout.r0;\n graphic.updateProps(sector, {\n shape: {\n r: layout.r\n }\n }, seriesModel, node.dataIndex);\n sector.useStyle(style);\n } else if (typeof style.fill === 'object' && style.fill.type || typeof sector.style.fill === 'object' && sector.style.fill.type) {\n // Disable animation for gradient since no interpolation method\n // is supported for gradient\n graphic.updateProps(sector, {\n shape: sectorShape\n }, seriesModel);\n sector.useStyle(style);\n } else {\n graphic.updateProps(sector, {\n shape: sectorShape,\n style: style\n }, seriesModel);\n }\n\n this._updateLabel(seriesModel, visualColor, state);\n\n var cursorStyle = itemModel.getShallow('cursor');\n cursorStyle && sector.attr('cursor', cursorStyle);\n\n if (firstCreate) {\n var highlightPolicy = seriesModel.getShallow('highlightPolicy');\n\n this._initEvents(sector, node, seriesModel, highlightPolicy);\n }\n\n this._seriesModel = seriesModel || this._seriesModel;\n this._ecModel = ecModel || this._ecModel;\n graphic.setHoverStyle(this);\n};\n\nSunburstPieceProto.onEmphasis = function (highlightPolicy) {\n var that = this;\n this.node.hostTree.root.eachNode(function (n) {\n if (n.piece) {\n if (that.node === n) {\n n.piece.updateData(false, n, 'emphasis');\n } else if (isNodeHighlighted(n, that.node, highlightPolicy)) {\n n.piece.childAt(0).trigger('highlight');\n } else if (highlightPolicy !== NodeHighlightPolicy.NONE) {\n n.piece.childAt(0).trigger('downplay');\n }\n }\n });\n};\n\nSunburstPieceProto.onNormal = function () {\n this.node.hostTree.root.eachNode(function (n) {\n if (n.piece) {\n n.piece.updateData(false, n, 'normal');\n }\n });\n};\n\nSunburstPieceProto.onHighlight = function () {\n this.updateData(false, this.node, 'highlight');\n};\n\nSunburstPieceProto.onDownplay = function () {\n this.updateData(false, this.node, 'downplay');\n};\n\nSunburstPieceProto._updateLabel = function (seriesModel, visualColor, state) {\n var itemModel = this.node.getModel();\n var normalModel = itemModel.getModel('label');\n var labelModel = state === 'normal' || state === 'emphasis' ? normalModel : itemModel.getModel(state + '.label');\n var labelHoverModel = itemModel.getModel('emphasis.label');\n var labelFormatter = labelModel.get('formatter'); // Use normal formatter if no state formatter is defined\n\n var labelState = labelFormatter ? state : 'normal';\n var text = zrUtil.retrieve(seriesModel.getFormattedLabel(this.node.dataIndex, labelState, null, null, 'label'), this.node.name);\n\n if (getLabelAttr('show') === false) {\n text = '';\n }\n\n var layout = this.node.getLayout();\n var labelMinAngle = labelModel.get('minAngle');\n\n if (labelMinAngle == null) {\n labelMinAngle = normalModel.get('minAngle');\n }\n\n labelMinAngle = labelMinAngle / 180 * Math.PI;\n var angle = layout.endAngle - layout.startAngle;\n\n if (labelMinAngle != null && Math.abs(angle) < labelMinAngle) {\n // Not displaying text when angle is too small\n text = '';\n }\n\n var label = this.childAt(1);\n graphic.setLabelStyle(label.style, label.hoverStyle || {}, normalModel, labelHoverModel, {\n defaultText: labelModel.getShallow('show') ? text : null,\n autoColor: visualColor,\n useInsideStyle: true\n });\n var midAngle = (layout.startAngle + layout.endAngle) / 2;\n var dx = Math.cos(midAngle);\n var dy = Math.sin(midAngle);\n var r;\n var labelPosition = getLabelAttr('position');\n var labelPadding = getLabelAttr('distance') || 0;\n var textAlign = getLabelAttr('align');\n\n if (labelPosition === 'outside') {\n r = layout.r + labelPadding;\n textAlign = midAngle > Math.PI / 2 ? 'right' : 'left';\n } else {\n if (!textAlign || textAlign === 'center') {\n r = (layout.r + layout.r0) / 2;\n textAlign = 'center';\n } else if (textAlign === 'left') {\n r = layout.r0 + labelPadding;\n\n if (midAngle > Math.PI / 2) {\n textAlign = 'right';\n }\n } else if (textAlign === 'right') {\n r = layout.r - labelPadding;\n\n if (midAngle > Math.PI / 2) {\n textAlign = 'left';\n }\n }\n }\n\n label.attr('style', {\n text: text,\n textAlign: textAlign,\n textVerticalAlign: getLabelAttr('verticalAlign') || 'middle',\n opacity: getLabelAttr('opacity')\n });\n var textX = r * dx + layout.cx;\n var textY = r * dy + layout.cy;\n label.attr('position', [textX, textY]);\n var rotateType = getLabelAttr('rotate');\n var rotate = 0;\n\n if (rotateType === 'radial') {\n rotate = -midAngle;\n\n if (rotate < -Math.PI / 2) {\n rotate += Math.PI;\n }\n } else if (rotateType === 'tangential') {\n rotate = Math.PI / 2 - midAngle;\n\n if (rotate > Math.PI / 2) {\n rotate -= Math.PI;\n } else if (rotate < -Math.PI / 2) {\n rotate += Math.PI;\n }\n } else if (typeof rotateType === 'number') {\n rotate = rotateType * Math.PI / 180;\n }\n\n label.attr('rotation', rotate);\n\n function getLabelAttr(name) {\n var stateAttr = labelModel.get(name);\n\n if (stateAttr == null) {\n return normalModel.get(name);\n } else {\n return stateAttr;\n }\n }\n};\n\nSunburstPieceProto._initEvents = function (sector, node, seriesModel, highlightPolicy) {\n sector.off('mouseover').off('mouseout').off('emphasis').off('normal');\n var that = this;\n\n var onEmphasis = function () {\n that.onEmphasis(highlightPolicy);\n };\n\n var onNormal = function () {\n that.onNormal();\n };\n\n var onDownplay = function () {\n that.onDownplay();\n };\n\n var onHighlight = function () {\n that.onHighlight();\n };\n\n if (seriesModel.isAnimationEnabled()) {\n sector.on('mouseover', onEmphasis).on('mouseout', onNormal).on('emphasis', onEmphasis).on('normal', onNormal).on('downplay', onDownplay).on('highlight', onHighlight);\n }\n};\n\nzrUtil.inherits(SunburstPiece, graphic.Group);\nvar _default = SunburstPiece;\n/**\n * Get node color\n *\n * @param {TreeNode} node the node to get color\n * @param {module:echarts/model/Series} seriesModel series\n * @param {module:echarts/model/Global} ecModel echarts defaults\n */\n\nfunction getNodeColor(node, seriesModel, ecModel) {\n // Color from visualMap\n var visualColor = node.getVisual('color');\n var visualMetaList = node.getVisual('visualMeta');\n\n if (!visualMetaList || visualMetaList.length === 0) {\n // Use first-generation color if has no visualMap\n visualColor = null;\n } // Self color or level color\n\n\n var color = node.getModel('itemStyle').get('color');\n\n if (color) {\n return color;\n } else if (visualColor) {\n // Color mapping\n return visualColor;\n } else if (node.depth === 0) {\n // Virtual root node\n return ecModel.option.color[0];\n } else {\n // First-generation color\n var length = ecModel.option.color.length;\n color = ecModel.option.color[getRootId(node) % length];\n }\n\n return color;\n}\n/**\n * Get index of root in sorted order\n *\n * @param {TreeNode} node current node\n * @return {number} index in root\n */\n\n\nfunction getRootId(node) {\n var ancestor = node;\n\n while (ancestor.depth > 1) {\n ancestor = ancestor.parentNode;\n }\n\n var virtualRoot = node.getAncestors()[0];\n return zrUtil.indexOf(virtualRoot.children, ancestor);\n}\n\nfunction isNodeHighlighted(node, activeNode, policy) {\n if (policy === NodeHighlightPolicy.NONE) {\n return false;\n } else if (policy === NodeHighlightPolicy.SELF) {\n return node === activeNode;\n } else if (policy === NodeHighlightPolicy.ANCESTOR) {\n return node === activeNode || node.isAncestorOf(activeNode);\n } else {\n return node === activeNode || node.isDescendantOf(activeNode);\n }\n} // Fix tooltip callback function params.color incorrect when pick a default color\n\n\nfunction fillDefaultColor(node, seriesModel, color) {\n var data = seriesModel.getData();\n data.setItemVisual(node.dataIndex, 'color', color);\n}\n\nmodule.exports = _default;","\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\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar SeriesModel = require(\"../../model/Series\");\n\nvar Tree = require(\"../../data/Tree\");\n\nvar Model = require(\"../../model/Model\");\n\nvar _treeHelper = require(\"../helper/treeHelper\");\n\nvar wrapTreePathInfo = _treeHelper.wrapTreePathInfo;\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*/\nvar _default = SeriesModel.extend({\n type: 'series.sunburst',\n\n /**\n * @type {module:echarts/data/Tree~Node}\n */\n _viewRoot: null,\n getInitialData: function (option, ecModel) {\n // Create a virtual root.\n var root = {\n name: option.name,\n children: option.data\n };\n completeTreeValue(root);\n var levelModels = zrUtil.map(option.levels || [], function (levelDefine) {\n return new Model(levelDefine, this, ecModel);\n }, this); // Make sure always a new tree is created when setOption,\n // in TreemapView, we check whether oldTree === newTree\n // to choose mappings approach among old shapes and new shapes.\n\n var tree = Tree.createTree(root, this, beforeLink);\n\n function beforeLink(nodeData) {\n nodeData.wrapMethod('getItemModel', function (model, idx) {\n var node = tree.getNodeByDataIndex(idx);\n var levelModel = levelModels[node.depth];\n levelModel && (model.parentModel = levelModel);\n return model;\n });\n }\n\n return tree.data;\n },\n optionUpdated: function () {\n this.resetViewRoot();\n },\n\n /*\n * @override\n */\n getDataParams: function (dataIndex) {\n var params = SeriesModel.prototype.getDataParams.apply(this, arguments);\n var node = this.getData().tree.getNodeByDataIndex(dataIndex);\n params.treePathInfo = wrapTreePathInfo(node, this);\n return params;\n },\n defaultOption: {\n zlevel: 0,\n z: 2,\n // 默认全局居中\n center: ['50%', '50%'],\n radius: [0, '75%'],\n // 默认顺时针\n clockwise: true,\n startAngle: 90,\n // 最小角度改为0\n minAngle: 0,\n percentPrecision: 2,\n // If still show when all data zero.\n stillShowZeroSum: true,\n // Policy of highlighting pieces when hover on one\n // Valid values: 'none' (for not downplay others), 'descendant',\n // 'ancestor', 'self'\n highlightPolicy: 'descendant',\n // 'rootToNode', 'link', or false\n nodeClick: 'rootToNode',\n renderLabelForZeroData: false,\n label: {\n // could be: 'radial', 'tangential', or 'none'\n rotate: 'radial',\n show: true,\n opacity: 1,\n // 'left' is for inner side of inside, and 'right' is for outter\n // side for inside\n align: 'center',\n position: 'inside',\n distance: 5,\n silent: true\n },\n itemStyle: {\n borderWidth: 1,\n borderColor: 'white',\n borderType: 'solid',\n shadowBlur: 0,\n shadowColor: 'rgba(0, 0, 0, 0.2)',\n shadowOffsetX: 0,\n shadowOffsetY: 0,\n opacity: 1\n },\n highlight: {\n itemStyle: {\n opacity: 1\n }\n },\n downplay: {\n itemStyle: {\n opacity: 0.5\n },\n label: {\n opacity: 0.6\n }\n },\n // Animation type canbe expansion, scale\n animationType: 'expansion',\n animationDuration: 1000,\n animationDurationUpdate: 500,\n animationEasing: 'cubicOut',\n data: [],\n levels: [],\n\n /**\n * Sort order.\n *\n * Valid values: 'desc', 'asc', null, or callback function.\n * 'desc' and 'asc' for descend and ascendant order;\n * null for not sorting;\n * example of callback function:\n * function(nodeA, nodeB) {\n * return nodeA.getValue() - nodeB.getValue();\n * }\n */\n sort: 'desc'\n },\n getViewRoot: function () {\n return this._viewRoot;\n },\n\n /**\n * @param {module:echarts/data/Tree~Node} [viewRoot]\n */\n resetViewRoot: function (viewRoot) {\n viewRoot ? this._viewRoot = viewRoot : viewRoot = this._viewRoot;\n var root = this.getRawData().tree.root;\n\n if (!viewRoot || viewRoot !== root && !root.contains(viewRoot)) {\n this._viewRoot = root;\n }\n }\n});\n/**\n * @param {Object} dataNode\n */\n\n\nfunction completeTreeValue(dataNode) {\n // Postorder travel tree.\n // If value of none-leaf node is not set,\n // calculate it by suming up the value of all children.\n var sum = 0;\n zrUtil.each(dataNode.children, function (child) {\n completeTreeValue(child);\n var childValue = child.value;\n zrUtil.isArray(childValue) && (childValue = childValue[0]);\n sum += childValue;\n });\n var thisValue = dataNode.value;\n\n if (zrUtil.isArray(thisValue)) {\n thisValue = thisValue[0];\n }\n\n if (thisValue == null || isNaN(thisValue)) {\n thisValue = sum;\n } // Value should not less than 0.\n\n\n if (thisValue < 0) {\n thisValue = 0;\n }\n\n zrUtil.isArray(dataNode.value) ? dataNode.value[0] = thisValue : dataNode.value = thisValue;\n}\n\nmodule.exports = _default;","\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\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar ChartView = require(\"../../view/Chart\");\n\nvar SunburstPiece = require(\"./SunburstPiece\");\n\nvar DataDiffer = require(\"../../data/DataDiffer\");\n\nvar _format = require(\"../../util/format\");\n\nvar windowOpen = _format.windowOpen;\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*/\nvar ROOT_TO_NODE_ACTION = 'sunburstRootToNode';\nvar SunburstView = ChartView.extend({\n type: 'sunburst',\n init: function () {},\n render: function (seriesModel, ecModel, api, payload) {\n var that = this;\n this.seriesModel = seriesModel;\n this.api = api;\n this.ecModel = ecModel;\n var data = seriesModel.getData();\n var virtualRoot = data.tree.root;\n var newRoot = seriesModel.getViewRoot();\n var group = this.group;\n var renderLabelForZeroData = seriesModel.get('renderLabelForZeroData');\n var newChildren = [];\n newRoot.eachNode(function (node) {\n newChildren.push(node);\n });\n var oldChildren = this._oldChildren || [];\n dualTravel(newChildren, oldChildren);\n renderRollUp(virtualRoot, newRoot);\n\n if (payload && payload.highlight && payload.highlight.piece) {\n var highlightPolicy = seriesModel.getShallow('highlightPolicy');\n payload.highlight.piece.onEmphasis(highlightPolicy);\n } else if (payload && payload.unhighlight) {\n var piece = this.virtualPiece;\n\n if (!piece && virtualRoot.children.length) {\n piece = virtualRoot.children[0].piece;\n }\n\n if (piece) {\n piece.onNormal();\n }\n }\n\n this._initEvents();\n\n this._oldChildren = newChildren;\n\n function dualTravel(newChildren, oldChildren) {\n if (newChildren.length === 0 && oldChildren.length === 0) {\n return;\n }\n\n new DataDiffer(oldChildren, newChildren, getKey, getKey).add(processNode).update(processNode).remove(zrUtil.curry(processNode, null)).execute();\n\n function getKey(node) {\n return node.getId();\n }\n\n function processNode(newId, oldId) {\n var newNode = newId == null ? null : newChildren[newId];\n var oldNode = oldId == null ? null : oldChildren[oldId];\n doRenderNode(newNode, oldNode);\n }\n }\n\n function doRenderNode(newNode, oldNode) {\n if (!renderLabelForZeroData && newNode && !newNode.getValue()) {\n // Not render data with value 0\n newNode = null;\n }\n\n if (newNode !== virtualRoot && oldNode !== virtualRoot) {\n if (oldNode && oldNode.piece) {\n if (newNode) {\n // Update\n oldNode.piece.updateData(false, newNode, 'normal', seriesModel, ecModel); // For tooltip\n\n data.setItemGraphicEl(newNode.dataIndex, oldNode.piece);\n } else {\n // Remove\n removeNode(oldNode);\n }\n } else if (newNode) {\n // Add\n var piece = new SunburstPiece(newNode, seriesModel, ecModel);\n group.add(piece); // For tooltip\n\n data.setItemGraphicEl(newNode.dataIndex, piece);\n }\n }\n }\n\n function removeNode(node) {\n if (!node) {\n return;\n }\n\n if (node.piece) {\n group.remove(node.piece);\n node.piece = null;\n }\n }\n\n function renderRollUp(virtualRoot, viewRoot) {\n if (viewRoot.depth > 0) {\n // Render\n if (that.virtualPiece) {\n // Update\n that.virtualPiece.updateData(false, virtualRoot, 'normal', seriesModel, ecModel);\n } else {\n // Add\n that.virtualPiece = new SunburstPiece(virtualRoot, seriesModel, ecModel);\n group.add(that.virtualPiece);\n }\n\n if (viewRoot.piece._onclickEvent) {\n viewRoot.piece.off('click', viewRoot.piece._onclickEvent);\n }\n\n var event = function (e) {\n that._rootToNode(viewRoot.parentNode);\n };\n\n viewRoot.piece._onclickEvent = event;\n that.virtualPiece.on('click', event);\n } else if (that.virtualPiece) {\n // Remove\n group.remove(that.virtualPiece);\n that.virtualPiece = null;\n }\n }\n },\n dispose: function () {},\n\n /**\n * @private\n */\n _initEvents: function () {\n var that = this;\n\n var event = function (e) {\n var targetFound = false;\n var viewRoot = that.seriesModel.getViewRoot();\n viewRoot.eachNode(function (node) {\n if (!targetFound && node.piece && node.piece.childAt(0) === e.target) {\n var nodeClick = node.getModel().get('nodeClick');\n\n if (nodeClick === 'rootToNode') {\n that._rootToNode(node);\n } else if (nodeClick === 'link') {\n var itemModel = node.getModel();\n var link = itemModel.get('link');\n\n if (link) {\n var linkTarget = itemModel.get('target', true) || '_blank';\n windowOpen(link, linkTarget);\n }\n }\n\n targetFound = true;\n }\n });\n };\n\n if (this.group._onclickEvent) {\n this.group.off('click', this.group._onclickEvent);\n }\n\n this.group.on('click', event);\n this.group._onclickEvent = event;\n },\n\n /**\n * @private\n */\n _rootToNode: function (node) {\n if (node !== this.seriesModel.getViewRoot()) {\n this.api.dispatchAction({\n type: ROOT_TO_NODE_ACTION,\n from: this.uid,\n seriesId: this.seriesModel.id,\n targetNode: node\n });\n }\n },\n\n /**\n * @implement\n */\n containPoint: function (point, seriesModel) {\n var treeRoot = seriesModel.getData();\n var itemLayout = treeRoot.getItemLayout(0);\n\n if (itemLayout) {\n var dx = point[0] - itemLayout.cx;\n var dy = point[1] - itemLayout.cy;\n var radius = Math.sqrt(dx * dx + dy * dy);\n return radius <= itemLayout.r && radius >= itemLayout.r0;\n }\n }\n});\nvar _default = SunburstView;\nmodule.exports = _default;","\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\nvar echarts = require(\"../../echarts\");\n\nvar helper = require(\"../helper/treeHelper\");\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 * @file Sunburst action\n */\nvar ROOT_TO_NODE_ACTION = 'sunburstRootToNode';\necharts.registerAction({\n type: ROOT_TO_NODE_ACTION,\n update: 'updateView'\n}, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series',\n subType: 'sunburst',\n query: payload\n }, handleRootToNode);\n\n function handleRootToNode(model, index) {\n var targetInfo = helper.retrieveTargetInfo(payload, [ROOT_TO_NODE_ACTION], model);\n\n if (targetInfo) {\n var originViewRoot = model.getViewRoot();\n\n if (originViewRoot) {\n payload.direction = helper.aboveViewRoot(originViewRoot, targetInfo.node) ? 'rollUp' : 'drillDown';\n }\n\n model.resetViewRoot(targetInfo.node);\n }\n }\n});\nvar HIGHLIGHT_ACTION = 'sunburstHighlight';\necharts.registerAction({\n type: HIGHLIGHT_ACTION,\n update: 'updateView'\n}, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series',\n subType: 'sunburst',\n query: payload\n }, handleHighlight);\n\n function handleHighlight(model, index) {\n var targetInfo = helper.retrieveTargetInfo(payload, [HIGHLIGHT_ACTION], model);\n\n if (targetInfo) {\n payload.highlight = targetInfo.node;\n }\n }\n});\nvar UNHIGHLIGHT_ACTION = 'sunburstUnhighlight';\necharts.registerAction({\n type: UNHIGHLIGHT_ACTION,\n update: 'updateView'\n}, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series',\n subType: 'sunburst',\n query: payload\n }, handleUnhighlight);\n\n function handleUnhighlight(model, index) {\n payload.unhighlight = true;\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*/\n\nvar _number = require(\"../../util/number\");\n\nvar parsePercent = _number.parsePercent;\n\nvar zrUtil = require(\"zrender/lib/core/util\");\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// var PI2 = Math.PI * 2;\nvar RADIAN = Math.PI / 180;\n\nfunction _default(seriesType, ecModel, api, payload) {\n ecModel.eachSeriesByType(seriesType, function (seriesModel) {\n var center = seriesModel.get('center');\n var radius = seriesModel.get('radius');\n\n if (!zrUtil.isArray(radius)) {\n radius = [0, radius];\n }\n\n if (!zrUtil.isArray(center)) {\n center = [center, center];\n }\n\n var width = api.getWidth();\n var height = api.getHeight();\n var size = Math.min(width, height);\n var cx = parsePercent(center[0], width);\n var cy = parsePercent(center[1], height);\n var r0 = parsePercent(radius[0], size / 2);\n var r = parsePercent(radius[1], size / 2);\n var startAngle = -seriesModel.get('startAngle') * RADIAN;\n var minAngle = seriesModel.get('minAngle') * RADIAN;\n var virtualRoot = seriesModel.getData().tree.root;\n var treeRoot = seriesModel.getViewRoot();\n var rootDepth = treeRoot.depth;\n var sort = seriesModel.get('sort');\n\n if (sort != null) {\n initChildren(treeRoot, sort);\n }\n\n var validDataCount = 0;\n zrUtil.each(treeRoot.children, function (child) {\n !isNaN(child.getValue()) && validDataCount++;\n });\n var sum = treeRoot.getValue(); // Sum may be 0\n\n var unitRadian = Math.PI / (sum || validDataCount) * 2;\n var renderRollupNode = treeRoot.depth > 0;\n var levels = treeRoot.height - (renderRollupNode ? -1 : 1);\n var rPerLevel = (r - r0) / (levels || 1);\n var clockwise = seriesModel.get('clockwise');\n var stillShowZeroSum = seriesModel.get('stillShowZeroSum'); // In the case some sector angle is smaller than minAngle\n // var restAngle = PI2;\n // var valueSumLargerThanMinAngle = 0;\n\n var dir = clockwise ? 1 : -1;\n /**\n * Render a tree\n * @return increased angle\n */\n\n var renderNode = function (node, startAngle) {\n if (!node) {\n return;\n }\n\n var endAngle = startAngle; // Render self\n\n if (node !== virtualRoot) {\n // Tree node is virtual, so it doesn't need to be drawn\n var value = node.getValue();\n var angle = sum === 0 && stillShowZeroSum ? unitRadian : value * unitRadian;\n\n if (angle < minAngle) {\n angle = minAngle; // restAngle -= minAngle;\n } // else {\n // valueSumLargerThanMinAngle += value;\n // }\n\n\n endAngle = startAngle + dir * angle;\n var depth = node.depth - rootDepth - (renderRollupNode ? -1 : 1);\n var rStart = r0 + rPerLevel * depth;\n var rEnd = r0 + rPerLevel * (depth + 1);\n var itemModel = node.getModel();\n\n if (itemModel.get('r0') != null) {\n rStart = parsePercent(itemModel.get('r0'), size / 2);\n }\n\n if (itemModel.get('r') != null) {\n rEnd = parsePercent(itemModel.get('r'), size / 2);\n }\n\n node.setLayout({\n angle: angle,\n startAngle: startAngle,\n endAngle: endAngle,\n clockwise: clockwise,\n cx: cx,\n cy: cy,\n r0: rStart,\n r: rEnd\n });\n } // Render children\n\n\n if (node.children && node.children.length) {\n // currentAngle = startAngle;\n var siblingAngle = 0;\n zrUtil.each(node.children, function (node) {\n siblingAngle += renderNode(node, startAngle + siblingAngle);\n });\n }\n\n return endAngle - startAngle;\n }; // Virtual root node for roll up\n\n\n if (renderRollupNode) {\n var rStart = r0;\n var rEnd = r0 + rPerLevel;\n var angle = Math.PI * 2;\n virtualRoot.setLayout({\n angle: angle,\n startAngle: startAngle,\n endAngle: startAngle + angle,\n clockwise: clockwise,\n cx: cx,\n cy: cy,\n r0: rStart,\n r: rEnd\n });\n }\n\n renderNode(treeRoot, startAngle);\n });\n}\n/**\n * Init node children by order and update visual\n *\n * @param {TreeNode} node root node\n * @param {boolean} isAsc if is in ascendant order\n */\n\n\nfunction initChildren(node, isAsc) {\n var children = node.children || [];\n node.children = sort(children, isAsc); // Init children recursively\n\n if (children.length) {\n zrUtil.each(node.children, function (child) {\n initChildren(child, isAsc);\n });\n }\n}\n/**\n * Sort children nodes\n *\n * @param {TreeNode[]} children children of node to be sorted\n * @param {string | function | null} sort sort method\n * See SunburstSeries.js for details.\n */\n\n\nfunction sort(children, sortOrder) {\n if (typeof sortOrder === 'function') {\n return children.sort(sortOrder);\n } else {\n var isAsc = sortOrder === 'asc';\n return children.sort(function (a, b) {\n var diff = (a.getValue() - b.getValue()) * (isAsc ? 1 : -1);\n return diff === 0 ? (a.dataIndex - b.dataIndex) * (isAsc ? -1 : 1) : diff;\n });\n }\n}\n\nmodule.exports = _default;","\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\nvar echarts = require(\"../echarts\");\n\nrequire(\"../component/singleAxis\");\n\nrequire(\"./themeRiver/ThemeRiverSeries\");\n\nrequire(\"./themeRiver/ThemeRiverView\");\n\nvar themeRiverLayout = require(\"./themeRiver/themeRiverLayout\");\n\nvar themeRiverVisual = require(\"./themeRiver/themeRiverVisual\");\n\nvar dataFilter = require(\"../processor/dataFilter\");\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*/\necharts.registerLayout(themeRiverLayout);\necharts.registerVisual(themeRiverVisual);\necharts.registerProcessor(dataFilter('themeRiver'));","\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\nvar SeriesModel = require(\"../../model/Series\");\n\nvar createDimensions = require(\"../../data/helper/createDimensions\");\n\nvar _dimensionHelper = require(\"../../data/helper/dimensionHelper\");\n\nvar getDimensionTypeByAxis = _dimensionHelper.getDimensionTypeByAxis;\n\nvar List = require(\"../../data/List\");\n\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar _model = require(\"../../util/model\");\n\nvar groupData = _model.groupData;\n\nvar _format = require(\"../../util/format\");\n\nvar encodeHTML = _format.encodeHTML;\n\nvar LegendVisualProvider = require(\"../../visual/LegendVisualProvider\");\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*/\nvar DATA_NAME_INDEX = 2;\nvar ThemeRiverSeries = SeriesModel.extend({\n type: 'series.themeRiver',\n dependencies: ['singleAxis'],\n\n /**\n * @readOnly\n * @type {module:zrender/core/util#HashMap}\n */\n nameMap: null,\n\n /**\n * @override\n */\n init: function (option) {\n // eslint-disable-next-line\n ThemeRiverSeries.superApply(this, 'init', arguments); // Put this function here is for the sake of consistency of code style.\n // Enable legend selection for each data item\n // Use a function instead of direct access because data reference may changed\n\n this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this));\n },\n\n /**\n * If there is no value of a certain point in the time for some event,set it value to 0.\n *\n * @param {Array} data initial data in the option\n * @return {Array}\n */\n fixData: function (data) {\n var rawDataLength = data.length;\n /**\n * Make sure every layer data get the same keys.\n * The value index tells which layer has visited.\n * {\n * 2014/01/01: -1\n * }\n */\n\n var timeValueKeys = {}; // grouped data by name\n\n var groupResult = groupData(data, function (item) {\n if (!timeValueKeys.hasOwnProperty(item[0])) {\n timeValueKeys[item[0]] = -1;\n }\n\n return item[2];\n });\n var layData = [];\n groupResult.buckets.each(function (items, key) {\n layData.push({\n name: key,\n dataList: items\n });\n });\n var layerNum = layData.length;\n\n for (var k = 0; k < layerNum; ++k) {\n var name = layData[k].name;\n\n for (var j = 0; j < layData[k].dataList.length; ++j) {\n var timeValue = layData[k].dataList[j][0];\n timeValueKeys[timeValue] = k;\n }\n\n for (var timeValue in timeValueKeys) {\n if (timeValueKeys.hasOwnProperty(timeValue) && timeValueKeys[timeValue] !== k) {\n timeValueKeys[timeValue] = k;\n data[rawDataLength] = [];\n data[rawDataLength][0] = timeValue;\n data[rawDataLength][1] = 0;\n data[rawDataLength][2] = name;\n rawDataLength++;\n }\n }\n }\n\n return data;\n },\n\n /**\n * @override\n * @param {Object} option the initial option that user gived\n * @param {module:echarts/model/Model} ecModel the model object for themeRiver option\n * @return {module:echarts/data/List}\n */\n getInitialData: function (option, ecModel) {\n var singleAxisModel = ecModel.queryComponents({\n mainType: 'singleAxis',\n index: this.get('singleAxisIndex'),\n id: this.get('singleAxisId')\n })[0];\n var axisType = singleAxisModel.get('type'); // filter the data item with the value of label is undefined\n\n var filterData = zrUtil.filter(option.data, function (dataItem) {\n return dataItem[2] !== undefined;\n }); // ??? TODO design a stage to transfer data for themeRiver and lines?\n\n var data = this.fixData(filterData || []);\n var nameList = [];\n var nameMap = this.nameMap = zrUtil.createHashMap();\n var count = 0;\n\n for (var i = 0; i < data.length; ++i) {\n nameList.push(data[i][DATA_NAME_INDEX]);\n\n if (!nameMap.get(data[i][DATA_NAME_INDEX])) {\n nameMap.set(data[i][DATA_NAME_INDEX], count);\n count++;\n }\n }\n\n var dimensionsInfo = createDimensions(data, {\n coordDimensions: ['single'],\n dimensionsDefine: [{\n name: 'time',\n type: getDimensionTypeByAxis(axisType)\n }, {\n name: 'value',\n type: 'float'\n }, {\n name: 'name',\n type: 'ordinal'\n }],\n encodeDefine: {\n single: 0,\n value: 1,\n itemName: 2\n }\n });\n var list = new List(dimensionsInfo, this);\n list.initData(data);\n return list;\n },\n\n /**\n * The raw data is divided into multiple layers and each layer\n * has same name.\n *\n * @return {Array.>}\n */\n getLayerSeries: function () {\n var data = this.getData();\n var lenCount = data.count();\n var indexArr = [];\n\n for (var i = 0; i < lenCount; ++i) {\n indexArr[i] = i;\n }\n\n var timeDim = data.mapDimension('single'); // data group by name\n\n var groupResult = groupData(indexArr, function (index) {\n return data.get('name', index);\n });\n var layerSeries = [];\n groupResult.buckets.each(function (items, key) {\n items.sort(function (index1, index2) {\n return data.get(timeDim, index1) - data.get(timeDim, index2);\n });\n layerSeries.push({\n name: key,\n indices: items\n });\n });\n return layerSeries;\n },\n\n /**\n * Get data indices for show tooltip content\n * @param {Array.|string} dim single coordinate dimension\n * @param {number} value axis value\n * @param {module:echarts/coord/single/SingleAxis} baseAxis single Axis used\n * the themeRiver.\n * @return {Object} {dataIndices, nestestValue}\n */\n getAxisTooltipData: function (dim, value, baseAxis) {\n if (!zrUtil.isArray(dim)) {\n dim = dim ? [dim] : [];\n }\n\n var data = this.getData();\n var layerSeries = this.getLayerSeries();\n var indices = [];\n var layerNum = layerSeries.length;\n var nestestValue;\n\n for (var i = 0; i < layerNum; ++i) {\n var minDist = Number.MAX_VALUE;\n var nearestIdx = -1;\n var pointNum = layerSeries[i].indices.length;\n\n for (var j = 0; j < pointNum; ++j) {\n var theValue = data.get(dim[0], layerSeries[i].indices[j]);\n var dist = Math.abs(theValue - value);\n\n if (dist <= minDist) {\n nestestValue = theValue;\n minDist = dist;\n nearestIdx = layerSeries[i].indices[j];\n }\n }\n\n indices.push(nearestIdx);\n }\n\n return {\n dataIndices: indices,\n nestestValue: nestestValue\n };\n },\n\n /**\n * @override\n * @param {number} dataIndex index of data\n */\n formatTooltip: function (dataIndex) {\n var data = this.getData();\n var htmlName = data.getName(dataIndex);\n var htmlValue = data.get(data.mapDimension('value'), dataIndex);\n\n if (isNaN(htmlValue) || htmlValue == null) {\n htmlValue = '-';\n }\n\n return encodeHTML(htmlName + ' : ' + htmlValue);\n },\n defaultOption: {\n zlevel: 0,\n z: 2,\n coordinateSystem: 'singleAxis',\n // gap in axis's orthogonal orientation\n boundaryGap: ['10%', '10%'],\n // legendHoverLink: true,\n singleAxisIndex: 0,\n animationEasing: 'linear',\n label: {\n margin: 4,\n show: true,\n position: 'left',\n color: '#000',\n fontSize: 11\n },\n emphasis: {\n label: {\n show: true\n }\n }\n }\n});\nvar _default = ThemeRiverSeries;\nmodule.exports = _default;","\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\nvar echarts = require(\"../../echarts\");\n\nvar _poly = require(\"../line/poly\");\n\nvar Polygon = _poly.Polygon;\n\nvar graphic = require(\"../../util/graphic\");\n\nvar _util = require(\"zrender/lib/core/util\");\n\nvar bind = _util.bind;\nvar extend = _util.extend;\n\nvar DataDiffer = require(\"../../data/DataDiffer\");\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*/\nvar _default = echarts.extendChartView({\n type: 'themeRiver',\n init: function () {\n this._layers = [];\n },\n render: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var group = this.group;\n var layerSeries = seriesModel.getLayerSeries();\n var layoutInfo = data.getLayout('layoutInfo');\n var rect = layoutInfo.rect;\n var boundaryGap = layoutInfo.boundaryGap;\n group.attr('position', [0, rect.y + boundaryGap[0]]);\n\n function keyGetter(item) {\n return item.name;\n }\n\n var dataDiffer = new DataDiffer(this._layersSeries || [], layerSeries, keyGetter, keyGetter);\n var newLayersGroups = {};\n dataDiffer.add(bind(process, this, 'add')).update(bind(process, this, 'update')).remove(bind(process, this, 'remove')).execute();\n\n function process(status, idx, oldIdx) {\n var oldLayersGroups = this._layers;\n\n if (status === 'remove') {\n group.remove(oldLayersGroups[idx]);\n return;\n }\n\n var points0 = [];\n var points1 = [];\n var color;\n var indices = layerSeries[idx].indices;\n\n for (var j = 0; j < indices.length; j++) {\n var layout = data.getItemLayout(indices[j]);\n var x = layout.x;\n var y0 = layout.y0;\n var y = layout.y;\n points0.push([x, y0]);\n points1.push([x, y0 + y]);\n color = data.getItemVisual(indices[j], 'color');\n }\n\n var polygon;\n var text;\n var textLayout = data.getItemLayout(indices[0]);\n var itemModel = data.getItemModel(indices[j - 1]);\n var labelModel = itemModel.getModel('label');\n var margin = labelModel.get('margin');\n\n if (status === 'add') {\n var layerGroup = newLayersGroups[idx] = new graphic.Group();\n polygon = new Polygon({\n shape: {\n points: points0,\n stackedOnPoints: points1,\n smooth: 0.4,\n stackedOnSmooth: 0.4,\n smoothConstraint: false\n },\n z2: 0\n });\n text = new graphic.Text({\n style: {\n x: textLayout.x - margin,\n y: textLayout.y0 + textLayout.y / 2\n }\n });\n layerGroup.add(polygon);\n layerGroup.add(text);\n group.add(layerGroup);\n polygon.setClipPath(createGridClipShape(polygon.getBoundingRect(), seriesModel, function () {\n polygon.removeClipPath();\n }));\n } else {\n var layerGroup = oldLayersGroups[oldIdx];\n polygon = layerGroup.childAt(0);\n text = layerGroup.childAt(1);\n group.add(layerGroup);\n newLayersGroups[idx] = layerGroup;\n graphic.updateProps(polygon, {\n shape: {\n points: points0,\n stackedOnPoints: points1\n }\n }, seriesModel);\n graphic.updateProps(text, {\n style: {\n x: textLayout.x - margin,\n y: textLayout.y0 + textLayout.y / 2\n }\n }, seriesModel);\n }\n\n var hoverItemStyleModel = itemModel.getModel('emphasis.itemStyle');\n var itemStyleModel = itemModel.getModel('itemStyle');\n graphic.setTextStyle(text.style, labelModel, {\n text: labelModel.get('show') ? seriesModel.getFormattedLabel(indices[j - 1], 'normal') || data.getName(indices[j - 1]) : null,\n textVerticalAlign: 'middle'\n });\n polygon.setStyle(extend({\n fill: color\n }, itemStyleModel.getItemStyle(['color'])));\n graphic.setHoverStyle(polygon, hoverItemStyleModel.getItemStyle());\n }\n\n this._layersSeries = layerSeries;\n this._layers = newLayersGroups;\n },\n dispose: function () {}\n}); // 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 height: rect.height + 20\n }\n }, seriesModel, cb);\n return rectEl;\n}\n\nmodule.exports = _default;","\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\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar numberUtil = require(\"../../util/number\");\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*/\nfunction _default(ecModel, api) {\n ecModel.eachSeriesByType('themeRiver', function (seriesModel) {\n var data = seriesModel.getData();\n var single = seriesModel.coordinateSystem;\n var layoutInfo = {}; // use the axis boundingRect for view\n\n var rect = single.getRect();\n layoutInfo.rect = rect;\n var boundaryGap = seriesModel.get('boundaryGap');\n var axis = single.getAxis();\n layoutInfo.boundaryGap = boundaryGap;\n\n if (axis.orient === 'horizontal') {\n boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.height);\n boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.height);\n var height = rect.height - boundaryGap[0] - boundaryGap[1];\n themeRiverLayout(data, seriesModel, height);\n } else {\n boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.width);\n boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.width);\n var width = rect.width - boundaryGap[0] - boundaryGap[1];\n themeRiverLayout(data, seriesModel, width);\n }\n\n data.setLayout('layoutInfo', layoutInfo);\n });\n}\n/**\n * The layout information about themeriver\n *\n * @param {module:echarts/data/List} data data in the series\n * @param {module:echarts/model/Series} seriesModel the model object of themeRiver series\n * @param {number} height value used to compute every series height\n */\n\n\nfunction themeRiverLayout(data, seriesModel, height) {\n if (!data.count()) {\n return;\n }\n\n var coordSys = seriesModel.coordinateSystem; // the data in each layer are organized into a series.\n\n var layerSeries = seriesModel.getLayerSeries(); // the points in each layer.\n\n var timeDim = data.mapDimension('single');\n var valueDim = data.mapDimension('value');\n var layerPoints = zrUtil.map(layerSeries, function (singleLayer) {\n return zrUtil.map(singleLayer.indices, function (idx) {\n var pt = coordSys.dataToPoint(data.get(timeDim, idx));\n pt[1] = data.get(valueDim, idx);\n return pt;\n });\n });\n var base = computeBaseline(layerPoints);\n var baseLine = base.y0;\n var ky = height / base.max; // set layout information for each item.\n\n var n = layerSeries.length;\n var m = layerSeries[0].indices.length;\n var baseY0;\n\n for (var j = 0; j < m; ++j) {\n baseY0 = baseLine[j] * ky;\n data.setItemLayout(layerSeries[0].indices[j], {\n layerIndex: 0,\n x: layerPoints[0][j][0],\n y0: baseY0,\n y: layerPoints[0][j][1] * ky\n });\n\n for (var i = 1; i < n; ++i) {\n baseY0 += layerPoints[i - 1][j][1] * ky;\n data.setItemLayout(layerSeries[i].indices[j], {\n layerIndex: i,\n x: layerPoints[i][j][0],\n y0: baseY0,\n y: layerPoints[i][j][1] * ky\n });\n }\n }\n}\n/**\n * Compute the baseLine of the rawdata\n * Inspired by Lee Byron's paper Stacked Graphs - Geometry & Aesthetics\n *\n * @param {Array.} data the points in each layer\n * @return {Object}\n */\n\n\nfunction computeBaseline(data) {\n var layerNum = data.length;\n var pointNum = data[0].length;\n var sums = [];\n var y0 = [];\n var max = 0;\n var temp;\n var base = {};\n\n for (var i = 0; i < pointNum; ++i) {\n for (var j = 0, temp = 0; j < layerNum; ++j) {\n temp += data[j][i][1];\n }\n\n if (temp > max) {\n max = temp;\n }\n\n sums.push(temp);\n }\n\n for (var k = 0; k < pointNum; ++k) {\n y0[k] = (max - sums[k]) / 2;\n }\n\n max = 0;\n\n for (var l = 0; l < pointNum; ++l) {\n var sum = sums[l] + y0[l];\n\n if (sum > max) {\n max = sum;\n }\n }\n\n base.y0 = y0;\n base.max = max;\n return base;\n}\n\nmodule.exports = _default;","\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\nvar _util = require(\"zrender/lib/core/util\");\n\nvar createHashMap = _util.createHashMap;\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*/\nfunction _default(ecModel) {\n ecModel.eachSeriesByType('themeRiver', function (seriesModel) {\n var data = seriesModel.getData();\n var rawData = seriesModel.getRawData();\n var colorList = seriesModel.get('color');\n var idxMap = createHashMap();\n data.each(function (idx) {\n idxMap.set(data.getRawIndex(idx), idx);\n });\n rawData.each(function (rawIndex) {\n var name = rawData.getName(rawIndex);\n var color = colorList[(seriesModel.nameMap.get(name) - 1) % colorList.length];\n rawData.setItemVisual(rawIndex, 'color', color);\n var idx = idxMap.get(rawIndex);\n\n if (idx != null) {\n data.setItemVisual(idx, 'color', color);\n }\n });\n });\n}\n\nmodule.exports = _default;","\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\nvar echarts = require(\"../echarts\");\n\nrequire(\"./tree/TreeSeries\");\n\nrequire(\"./tree/TreeView\");\n\nrequire(\"./tree/treeAction\");\n\nvar visualSymbol = require(\"../visual/symbol\");\n\nvar treeLayout = require(\"./tree/treeLayout\");\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*/\necharts.registerVisual(visualSymbol('tree', 'circle'));\necharts.registerLayout(treeLayout);","\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\nvar SeriesModel = require(\"../../model/Series\");\n\nvar Tree = require(\"../../data/Tree\");\n\nvar _format = require(\"../../util/format\");\n\nvar encodeHTML = _format.encodeHTML;\n\nvar Model = require(\"../../model/Model\");\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*/\nvar _default = SeriesModel.extend({\n type: 'series.tree',\n layoutInfo: null,\n // can support the position parameters 'left', 'top','right','bottom', 'width',\n // 'height' in the setOption() with 'merge' mode normal.\n layoutMode: 'box',\n\n /**\n * Init a tree data structure from data in option series\n * @param {Object} option the object used to config echarts view\n * @return {module:echarts/data/List} storage initial data\n */\n getInitialData: function (option) {\n //create an virtual root\n var root = {\n name: option.name,\n children: option.data\n };\n var leaves = option.leaves || {};\n var leavesModel = new Model(leaves, this, this.ecModel);\n var tree = Tree.createTree(root, this, beforeLink);\n\n function beforeLink(nodeData) {\n nodeData.wrapMethod('getItemModel', function (model, idx) {\n var node = tree.getNodeByDataIndex(idx);\n\n if (!node.children.length || !node.isExpand) {\n model.parentModel = leavesModel;\n }\n\n return model;\n });\n }\n\n var treeDepth = 0;\n tree.eachNode('preorder', function (node) {\n if (node.depth > treeDepth) {\n treeDepth = node.depth;\n }\n });\n var expandAndCollapse = option.expandAndCollapse;\n var expandTreeDepth = expandAndCollapse && option.initialTreeDepth >= 0 ? option.initialTreeDepth : treeDepth;\n tree.root.eachNode('preorder', function (node) {\n var item = node.hostTree.data.getRawDataItem(node.dataIndex); // Add item.collapsed != null, because users can collapse node original in the series.data.\n\n node.isExpand = item && item.collapsed != null ? !item.collapsed : node.depth <= expandTreeDepth;\n });\n return tree.data;\n },\n\n /**\n * Make the configuration 'orient' backward compatibly, with 'horizontal = LR', 'vertical = TB'.\n * @returns {string} orient\n */\n getOrient: function () {\n var orient = this.get('orient');\n\n if (orient === 'horizontal') {\n orient = 'LR';\n } else if (orient === 'vertical') {\n orient = 'TB';\n }\n\n return orient;\n },\n setZoom: function (zoom) {\n this.option.zoom = zoom;\n },\n setCenter: function (center) {\n this.option.center = center;\n },\n\n /**\n * @override\n * @param {number} dataIndex\n */\n formatTooltip: function (dataIndex) {\n var tree = this.getData().tree;\n var realRoot = tree.root.children[0];\n var node = tree.getNodeByDataIndex(dataIndex);\n var value = node.getValue();\n var name = node.name;\n\n while (node && node !== realRoot) {\n name = node.parentNode.name + '.' + name;\n node = node.parentNode;\n }\n\n return encodeHTML(name + (isNaN(value) || value == null ? '' : ' : ' + value));\n },\n defaultOption: {\n zlevel: 0,\n z: 2,\n coordinateSystem: 'view',\n // the position of the whole view\n left: '12%',\n top: '12%',\n right: '12%',\n bottom: '12%',\n // the layout of the tree, two value can be selected, 'orthogonal' or 'radial'\n layout: 'orthogonal',\n // value can be 'polyline'\n edgeShape: 'curve',\n edgeForkPosition: '50%',\n // true | false | 'move' | 'scale', see module:component/helper/RoamController.\n roam: false,\n // Symbol size scale ratio in roam\n nodeScaleRatio: 0.4,\n // Default on center of graph\n center: null,\n zoom: 1,\n // The orient of orthoginal layout, can be setted to 'LR', 'TB', 'RL', 'BT'.\n // and the backward compatibility configuration 'horizontal = LR', 'vertical = TB'.\n orient: 'LR',\n symbol: 'emptyCircle',\n symbolSize: 7,\n expandAndCollapse: true,\n initialTreeDepth: 2,\n lineStyle: {\n color: '#ccc',\n width: 1.5,\n curveness: 0.5\n },\n itemStyle: {\n color: 'lightsteelblue',\n borderColor: '#c23531',\n borderWidth: 1.5\n },\n label: {\n show: true,\n color: '#555'\n },\n leaves: {\n label: {\n show: true\n }\n },\n animationEasing: 'linear',\n animationDuration: 700,\n animationDurationUpdate: 1000\n }\n});\n\nmodule.exports = _default;","\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\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar graphic = require(\"../../util/graphic\");\n\nvar SymbolClz = require(\"../helper/Symbol\");\n\nvar _layoutHelper = require(\"./layoutHelper\");\n\nvar radialCoordinate = _layoutHelper.radialCoordinate;\n\nvar echarts = require(\"../../echarts\");\n\nvar bbox = require(\"zrender/lib/core/bbox\");\n\nvar View = require(\"../../coord/View\");\n\nvar roamHelper = require(\"../../component/helper/roamHelper\");\n\nvar RoamController = require(\"../../component/helper/RoamController\");\n\nvar _cursorHelper = require(\"../../component/helper/cursorHelper\");\n\nvar onIrrelevantElement = _cursorHelper.onIrrelevantElement;\n\nvar _config = require(\"../../config\");\n\nvar __DEV__ = _config.__DEV__;\n\nvar _number = require(\"../../util/number\");\n\nvar parsePercent = _number.parsePercent;\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*/\nvar TreeShape = graphic.extendShape({\n shape: {\n parentPoint: [],\n childPoints: [],\n orient: '',\n forkPosition: ''\n },\n style: {\n stroke: '#000',\n fill: null\n },\n buildPath: function (ctx, shape) {\n var childPoints = shape.childPoints;\n var childLen = childPoints.length;\n var parentPoint = shape.parentPoint;\n var firstChildPos = childPoints[0];\n var lastChildPos = childPoints[childLen - 1];\n\n if (childLen === 1) {\n ctx.moveTo(parentPoint[0], parentPoint[1]);\n ctx.lineTo(firstChildPos[0], firstChildPos[1]);\n return;\n }\n\n var orient = shape.orient;\n var forkDim = orient === 'TB' || orient === 'BT' ? 0 : 1;\n var otherDim = 1 - forkDim;\n var forkPosition = parsePercent(shape.forkPosition, 1);\n var tmpPoint = [];\n tmpPoint[forkDim] = parentPoint[forkDim];\n tmpPoint[otherDim] = parentPoint[otherDim] + (lastChildPos[otherDim] - parentPoint[otherDim]) * forkPosition;\n ctx.moveTo(parentPoint[0], parentPoint[1]);\n ctx.lineTo(tmpPoint[0], tmpPoint[1]);\n ctx.moveTo(firstChildPos[0], firstChildPos[1]);\n tmpPoint[forkDim] = firstChildPos[forkDim];\n ctx.lineTo(tmpPoint[0], tmpPoint[1]);\n tmpPoint[forkDim] = lastChildPos[forkDim];\n ctx.lineTo(tmpPoint[0], tmpPoint[1]);\n ctx.lineTo(lastChildPos[0], lastChildPos[1]);\n\n for (var i = 1; i < childLen - 1; i++) {\n var point = childPoints[i];\n ctx.moveTo(point[0], point[1]);\n tmpPoint[forkDim] = point[forkDim];\n ctx.lineTo(tmpPoint[0], tmpPoint[1]);\n }\n }\n});\n\nvar _default = echarts.extendChartView({\n type: 'tree',\n\n /**\n * Init the chart\n * @override\n * @param {module:echarts/model/Global} ecModel\n * @param {module:echarts/ExtensionAPI} api\n */\n init: function (ecModel, api) {\n /**\n * @private\n * @type {module:echarts/data/Tree}\n */\n this._oldTree;\n /**\n * @private\n * @type {module:zrender/container/Group}\n */\n\n this._mainGroup = new graphic.Group();\n /**\n * @private\n * @type {module:echarts/componet/helper/RoamController}\n */\n\n this._controller = new RoamController(api.getZr());\n this._controllerHost = {\n target: this.group\n };\n this.group.add(this._mainGroup);\n },\n render: function (seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var layoutInfo = seriesModel.layoutInfo;\n var group = this._mainGroup;\n var layout = seriesModel.get('layout');\n\n if (layout === 'radial') {\n group.attr('position', [layoutInfo.x + layoutInfo.width / 2, layoutInfo.y + layoutInfo.height / 2]);\n } else {\n group.attr('position', [layoutInfo.x, layoutInfo.y]);\n }\n\n this._updateViewCoordSys(seriesModel, layoutInfo, layout);\n\n this._updateController(seriesModel, ecModel, api);\n\n var oldData = this._data;\n var seriesScope = {\n expandAndCollapse: seriesModel.get('expandAndCollapse'),\n layout: layout,\n edgeShape: seriesModel.get('edgeShape'),\n edgeForkPosition: seriesModel.get('edgeForkPosition'),\n orient: seriesModel.getOrient(),\n curvature: seriesModel.get('lineStyle.curveness'),\n symbolRotate: seriesModel.get('symbolRotate'),\n symbolOffset: seriesModel.get('symbolOffset'),\n hoverAnimation: seriesModel.get('hoverAnimation'),\n useNameLabel: true,\n fadeIn: true\n };\n data.diff(oldData).add(function (newIdx) {\n if (symbolNeedsDraw(data, newIdx)) {\n // Create node and edge\n updateNode(data, newIdx, null, group, seriesModel, seriesScope);\n }\n }).update(function (newIdx, oldIdx) {\n var symbolEl = oldData.getItemGraphicEl(oldIdx);\n\n if (!symbolNeedsDraw(data, newIdx)) {\n symbolEl && removeNode(oldData, oldIdx, symbolEl, group, seriesModel, seriesScope);\n return;\n } // Update node and edge\n\n\n updateNode(data, newIdx, symbolEl, group, seriesModel, seriesScope);\n }).remove(function (oldIdx) {\n var symbolEl = oldData.getItemGraphicEl(oldIdx); // When remove a collapsed node of subtree, since the collapsed\n // node haven't been initialized with a symbol element,\n // you can't found it's symbol element through index.\n // so if we want to remove the symbol element we should insure\n // that the symbol element is not null.\n\n if (symbolEl) {\n removeNode(oldData, oldIdx, symbolEl, group, seriesModel, seriesScope);\n }\n }).execute();\n this._nodeScaleRatio = seriesModel.get('nodeScaleRatio');\n\n this._updateNodeAndLinkScale(seriesModel);\n\n if (seriesScope.expandAndCollapse === true) {\n data.eachItemGraphicEl(function (el, dataIndex) {\n el.off('click').on('click', function () {\n api.dispatchAction({\n type: 'treeExpandAndCollapse',\n seriesId: seriesModel.id,\n dataIndex: dataIndex\n });\n });\n });\n }\n\n this._data = data;\n },\n _updateViewCoordSys: function (seriesModel) {\n var data = seriesModel.getData();\n var points = [];\n data.each(function (idx) {\n var layout = data.getItemLayout(idx);\n\n if (layout && !isNaN(layout.x) && !isNaN(layout.y)) {\n points.push([+layout.x, +layout.y]);\n }\n });\n var min = [];\n var max = [];\n bbox.fromPoints(points, min, max); // If don't Store min max when collapse the root node after roam,\n // the root node will disappear.\n\n var oldMin = this._min;\n var oldMax = this._max; // If width or height is 0\n\n if (max[0] - min[0] === 0) {\n min[0] = oldMin ? oldMin[0] : min[0] - 1;\n max[0] = oldMax ? oldMax[0] : max[0] + 1;\n }\n\n if (max[1] - min[1] === 0) {\n min[1] = oldMin ? oldMin[1] : min[1] - 1;\n max[1] = oldMax ? oldMax[1] : max[1] + 1;\n }\n\n var viewCoordSys = seriesModel.coordinateSystem = new View();\n viewCoordSys.zoomLimit = seriesModel.get('scaleLimit');\n viewCoordSys.setBoundingRect(min[0], min[1], max[0] - min[0], max[1] - min[1]);\n viewCoordSys.setCenter(seriesModel.get('center'));\n viewCoordSys.setZoom(seriesModel.get('zoom')); // Here we use viewCoordSys just for computing the 'position' and 'scale' of the group\n\n this.group.attr({\n position: viewCoordSys.position,\n scale: viewCoordSys.scale\n });\n this._viewCoordSys = viewCoordSys;\n this._min = min;\n this._max = max;\n },\n _updateController: function (seriesModel, ecModel, api) {\n var controller = this._controller;\n var controllerHost = this._controllerHost;\n var group = this.group;\n controller.setPointerChecker(function (e, x, y) {\n var rect = group.getBoundingRect();\n rect.applyTransform(group.transform);\n return rect.contain(x, y) && !onIrrelevantElement(e, api, seriesModel);\n });\n controller.enable(seriesModel.get('roam'));\n controllerHost.zoomLimit = seriesModel.get('scaleLimit');\n controllerHost.zoom = seriesModel.coordinateSystem.getZoom();\n controller.off('pan').off('zoom').on('pan', function (e) {\n roamHelper.updateViewOnPan(controllerHost, e.dx, e.dy);\n api.dispatchAction({\n seriesId: seriesModel.id,\n type: 'treeRoam',\n dx: e.dx,\n dy: e.dy\n });\n }, this).on('zoom', function (e) {\n roamHelper.updateViewOnZoom(controllerHost, e.scale, e.originX, e.originY);\n api.dispatchAction({\n seriesId: seriesModel.id,\n type: 'treeRoam',\n zoom: e.scale,\n originX: e.originX,\n originY: e.originY\n });\n\n this._updateNodeAndLinkScale(seriesModel);\n }, this);\n },\n _updateNodeAndLinkScale: function (seriesModel) {\n var data = seriesModel.getData();\n\n var nodeScale = this._getNodeGlobalScale(seriesModel);\n\n var invScale = [nodeScale, nodeScale];\n data.eachItemGraphicEl(function (el, idx) {\n el.attr('scale', invScale);\n });\n },\n _getNodeGlobalScale: function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n\n if (coordSys.type !== 'view') {\n return 1;\n }\n\n var nodeScaleRatio = this._nodeScaleRatio;\n var groupScale = coordSys.scale;\n var groupZoom = groupScale && groupScale[0] || 1; // Scale node when zoom changes\n\n var roamZoom = coordSys.getZoom();\n var nodeScale = (roamZoom - 1) * nodeScaleRatio + 1;\n return nodeScale / groupZoom;\n },\n dispose: function () {\n this._controller && this._controller.dispose();\n this._controllerHost = {};\n },\n remove: function () {\n this._mainGroup.removeAll();\n\n this._data = null;\n }\n});\n\nfunction symbolNeedsDraw(data, dataIndex) {\n var layout = data.getItemLayout(dataIndex);\n return layout && !isNaN(layout.x) && !isNaN(layout.y) && data.getItemVisual(dataIndex, 'symbol') !== 'none';\n}\n\nfunction getTreeNodeStyle(node, itemModel, seriesScope) {\n seriesScope.itemModel = itemModel;\n seriesScope.itemStyle = itemModel.getModel('itemStyle').getItemStyle();\n seriesScope.hoverItemStyle = itemModel.getModel('emphasis.itemStyle').getItemStyle();\n seriesScope.lineStyle = itemModel.getModel('lineStyle').getLineStyle();\n seriesScope.labelModel = itemModel.getModel('label');\n seriesScope.hoverLabelModel = itemModel.getModel('emphasis.label');\n\n if (node.isExpand === false && node.children.length !== 0) {\n seriesScope.symbolInnerColor = seriesScope.itemStyle.fill;\n } else {\n seriesScope.symbolInnerColor = '#fff';\n }\n\n return seriesScope;\n}\n\nfunction updateNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope) {\n var isInit = !symbolEl;\n var node = data.tree.getNodeByDataIndex(dataIndex);\n var itemModel = node.getModel();\n var seriesScope = getTreeNodeStyle(node, itemModel, seriesScope);\n var virtualRoot = data.tree.root;\n var source = node.parentNode === virtualRoot ? node : node.parentNode || node;\n var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);\n var sourceLayout = source.getLayout();\n var sourceOldLayout = sourceSymbolEl ? {\n x: sourceSymbolEl.position[0],\n y: sourceSymbolEl.position[1],\n rawX: sourceSymbolEl.__radialOldRawX,\n rawY: sourceSymbolEl.__radialOldRawY\n } : sourceLayout;\n var targetLayout = node.getLayout();\n\n if (isInit) {\n symbolEl = new SymbolClz(data, dataIndex, seriesScope);\n symbolEl.attr('position', [sourceOldLayout.x, sourceOldLayout.y]);\n } else {\n symbolEl.updateData(data, dataIndex, seriesScope);\n }\n\n symbolEl.__radialOldRawX = symbolEl.__radialRawX;\n symbolEl.__radialOldRawY = symbolEl.__radialRawY;\n symbolEl.__radialRawX = targetLayout.rawX;\n symbolEl.__radialRawY = targetLayout.rawY;\n group.add(symbolEl);\n data.setItemGraphicEl(dataIndex, symbolEl);\n graphic.updateProps(symbolEl, {\n position: [targetLayout.x, targetLayout.y]\n }, seriesModel);\n var symbolPath = symbolEl.getSymbolPath();\n\n if (seriesScope.layout === 'radial') {\n var realRoot = virtualRoot.children[0];\n var rootLayout = realRoot.getLayout();\n var length = realRoot.children.length;\n var rad;\n var isLeft;\n\n if (targetLayout.x === rootLayout.x && node.isExpand === true) {\n var center = {};\n center.x = (realRoot.children[0].getLayout().x + realRoot.children[length - 1].getLayout().x) / 2;\n center.y = (realRoot.children[0].getLayout().y + realRoot.children[length - 1].getLayout().y) / 2;\n rad = Math.atan2(center.y - rootLayout.y, center.x - rootLayout.x);\n\n if (rad < 0) {\n rad = Math.PI * 2 + rad;\n }\n\n isLeft = center.x < rootLayout.x;\n\n if (isLeft) {\n rad = rad - Math.PI;\n }\n } else {\n rad = Math.atan2(targetLayout.y - rootLayout.y, targetLayout.x - rootLayout.x);\n\n if (rad < 0) {\n rad = Math.PI * 2 + rad;\n }\n\n if (node.children.length === 0 || node.children.length !== 0 && node.isExpand === false) {\n isLeft = targetLayout.x < rootLayout.x;\n\n if (isLeft) {\n rad = rad - Math.PI;\n }\n } else {\n isLeft = targetLayout.x > rootLayout.x;\n\n if (!isLeft) {\n rad = rad - Math.PI;\n }\n }\n }\n\n var textPosition = isLeft ? 'left' : 'right';\n var rotate = seriesScope.labelModel.get('rotate');\n var labelRotateRadian = rotate * (Math.PI / 180);\n symbolPath.setStyle({\n textPosition: seriesScope.labelModel.get('position') || textPosition,\n textRotation: rotate == null ? -rad : labelRotateRadian,\n textOrigin: 'center',\n verticalAlign: 'middle'\n });\n }\n\n drawEdge(seriesModel, node, virtualRoot, symbolEl, sourceOldLayout, sourceLayout, targetLayout, group, seriesScope);\n}\n\nfunction drawEdge(seriesModel, node, virtualRoot, symbolEl, sourceOldLayout, sourceLayout, targetLayout, group, seriesScope) {\n var edgeShape = seriesScope.edgeShape;\n var edge = symbolEl.__edge;\n\n if (edgeShape === 'curve') {\n if (node.parentNode && node.parentNode !== virtualRoot) {\n if (!edge) {\n edge = symbolEl.__edge = new graphic.BezierCurve({\n shape: getEdgeShape(seriesScope, sourceOldLayout, sourceOldLayout),\n style: zrUtil.defaults({\n opacity: 0,\n strokeNoScale: true\n }, seriesScope.lineStyle)\n });\n }\n\n graphic.updateProps(edge, {\n shape: getEdgeShape(seriesScope, sourceLayout, targetLayout),\n style: zrUtil.defaults({\n opacity: 1\n }, seriesScope.lineStyle)\n }, seriesModel);\n }\n } else if (edgeShape === 'polyline') {\n if (seriesScope.layout === 'orthogonal') {\n if (node !== virtualRoot && node.children && node.children.length !== 0 && node.isExpand === true) {\n var children = node.children;\n var childPoints = [];\n\n for (var i = 0; i < children.length; i++) {\n var childLayout = children[i].getLayout();\n childPoints.push([childLayout.x, childLayout.y]);\n }\n\n if (!edge) {\n edge = symbolEl.__edge = new TreeShape({\n shape: {\n parentPoint: [targetLayout.x, targetLayout.y],\n childPoints: [[targetLayout.x, targetLayout.y]],\n orient: seriesScope.orient,\n forkPosition: seriesScope.edgeForkPosition\n },\n style: zrUtil.defaults({\n opacity: 0,\n strokeNoScale: true\n }, seriesScope.lineStyle)\n });\n }\n\n graphic.updateProps(edge, {\n shape: {\n parentPoint: [targetLayout.x, targetLayout.y],\n childPoints: childPoints\n },\n style: zrUtil.defaults({\n opacity: 1\n }, seriesScope.lineStyle)\n }, seriesModel);\n }\n } else {}\n }\n\n group.add(edge);\n}\n\nfunction removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope) {\n var node = data.tree.getNodeByDataIndex(dataIndex);\n var virtualRoot = data.tree.root;\n var itemModel = node.getModel();\n var seriesScope = getTreeNodeStyle(node, itemModel, seriesScope);\n var source = node.parentNode === virtualRoot ? node : node.parentNode || node;\n var edgeShape = seriesScope.edgeShape;\n var sourceLayout;\n\n while (sourceLayout = source.getLayout(), sourceLayout == null) {\n source = source.parentNode === virtualRoot ? source : source.parentNode || source;\n }\n\n graphic.updateProps(symbolEl, {\n position: [sourceLayout.x + 1, sourceLayout.y + 1]\n }, seriesModel, function () {\n group.remove(symbolEl);\n data.setItemGraphicEl(dataIndex, null);\n });\n symbolEl.fadeOut(null, {\n keepLabel: true\n });\n var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);\n var sourceEdge = sourceSymbolEl.__edge; // 1. when expand the sub tree, delete the children node should delete the edge of\n // the source at the same time. because the polyline edge shape is only owned by the source.\n // 2.when the node is the only children of the source, delete the node should delete the edge of\n // the source at the same time. the same reason as above.\n\n var edge = symbolEl.__edge || (source.isExpand === false || source.children.length === 1 ? sourceEdge : undefined);\n var edgeShape = seriesScope.edgeShape;\n\n if (edge) {\n if (edgeShape === 'curve') {\n graphic.updateProps(edge, {\n shape: getEdgeShape(seriesScope, sourceLayout, sourceLayout),\n style: {\n opacity: 0\n }\n }, seriesModel, function () {\n group.remove(edge);\n });\n } else if (edgeShape === 'polyline' && seriesScope.layout === 'orthogonal') {\n graphic.updateProps(edge, {\n shape: {\n parentPoint: [sourceLayout.x, sourceLayout.y],\n childPoints: [[sourceLayout.x, sourceLayout.y]]\n },\n style: {\n opacity: 0\n }\n }, seriesModel, function () {\n group.remove(edge);\n });\n }\n }\n}\n\nfunction getEdgeShape(seriesScope, sourceLayout, targetLayout) {\n var cpx1;\n var cpy1;\n var cpx2;\n var cpy2;\n var orient = seriesScope.orient;\n var x1;\n var x2;\n var y1;\n var y2;\n\n if (seriesScope.layout === 'radial') {\n x1 = sourceLayout.rawX;\n y1 = sourceLayout.rawY;\n x2 = targetLayout.rawX;\n y2 = targetLayout.rawY;\n var radialCoor1 = radialCoordinate(x1, y1);\n var radialCoor2 = radialCoordinate(x1, y1 + (y2 - y1) * seriesScope.curvature);\n var radialCoor3 = radialCoordinate(x2, y2 + (y1 - y2) * seriesScope.curvature);\n var radialCoor4 = radialCoordinate(x2, y2);\n return {\n x1: radialCoor1.x,\n y1: radialCoor1.y,\n x2: radialCoor4.x,\n y2: radialCoor4.y,\n cpx1: radialCoor2.x,\n cpy1: radialCoor2.y,\n cpx2: radialCoor3.x,\n cpy2: radialCoor3.y\n };\n } else {\n x1 = sourceLayout.x;\n y1 = sourceLayout.y;\n x2 = targetLayout.x;\n y2 = targetLayout.y;\n\n if (orient === 'LR' || orient === 'RL') {\n cpx1 = x1 + (x2 - x1) * seriesScope.curvature;\n cpy1 = y1;\n cpx2 = x2 + (x1 - x2) * seriesScope.curvature;\n cpy2 = y2;\n }\n\n if (orient === 'TB' || orient === 'BT') {\n cpx1 = x1;\n cpy1 = y1 + (y2 - y1) * seriesScope.curvature;\n cpx2 = x2;\n cpy2 = y2 + (y1 - y2) * seriesScope.curvature;\n }\n }\n\n return {\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}\n\nmodule.exports = _default;","\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\nvar layout = require(\"../../util/layout\");\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* A third-party license is embeded for some of the code in this file:\n* The tree layoutHelper implementation was originally copied from\n* \"d3.js\"(https://github.com/d3/d3-hierarchy) with\n* some modifications made for this project.\n* (see more details in the comment of the specific method below.)\n* The use of the source code of this file is also subject to the terms\n* and consitions of the licence of \"d3.js\" (BSD-3Clause, see\n* ).\n*/\n\n/**\n * @file The layout algorithm of node-link tree diagrams. Here we using Reingold-Tilford algorithm to drawing\n * the tree.\n */\n\n/**\n * Initialize all computational message for following algorithm.\n *\n * @param {module:echarts/data/Tree~TreeNode} root The virtual root of the tree.\n */\nfunction init(root) {\n root.hierNode = {\n defaultAncestor: null,\n ancestor: root,\n prelim: 0,\n modifier: 0,\n change: 0,\n shift: 0,\n i: 0,\n thread: null\n };\n var nodes = [root];\n var node;\n var children;\n\n while (node = nodes.pop()) {\n // jshint ignore:line\n children = node.children;\n\n if (node.isExpand && children.length) {\n var n = children.length;\n\n for (var i = n - 1; i >= 0; i--) {\n var child = children[i];\n child.hierNode = {\n defaultAncestor: null,\n ancestor: child,\n prelim: 0,\n modifier: 0,\n change: 0,\n shift: 0,\n i: i,\n thread: null\n };\n nodes.push(child);\n }\n }\n }\n}\n/**\n * The implementation of this function was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n *\n * Computes a preliminary x coordinate for node. Before that, this function is\n * applied recursively to the children of node, as well as the function\n * apportion(). After spacing out the children by calling executeShifts(), the\n * node is placed to the midpoint of its outermost children.\n *\n * @param {module:echarts/data/Tree~TreeNode} node\n * @param {Function} separation\n */\n\n\nfunction firstWalk(node, separation) {\n var children = node.isExpand ? node.children : [];\n var siblings = node.parentNode.children;\n var subtreeW = node.hierNode.i ? siblings[node.hierNode.i - 1] : null;\n\n if (children.length) {\n executeShifts(node);\n var midPoint = (children[0].hierNode.prelim + children[children.length - 1].hierNode.prelim) / 2;\n\n if (subtreeW) {\n node.hierNode.prelim = subtreeW.hierNode.prelim + separation(node, subtreeW);\n node.hierNode.modifier = node.hierNode.prelim - midPoint;\n } else {\n node.hierNode.prelim = midPoint;\n }\n } else if (subtreeW) {\n node.hierNode.prelim = subtreeW.hierNode.prelim + separation(node, subtreeW);\n }\n\n node.parentNode.hierNode.defaultAncestor = apportion(node, subtreeW, node.parentNode.hierNode.defaultAncestor || siblings[0], separation);\n}\n/**\n * The implementation of this function was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n *\n * Computes all real x-coordinates by summing up the modifiers recursively.\n *\n * @param {module:echarts/data/Tree~TreeNode} node\n */\n\n\nfunction secondWalk(node) {\n var nodeX = node.hierNode.prelim + node.parentNode.hierNode.modifier;\n node.setLayout({\n x: nodeX\n }, true);\n node.hierNode.modifier += node.parentNode.hierNode.modifier;\n}\n\nfunction separation(cb) {\n return arguments.length ? cb : defaultSeparation;\n}\n/**\n * Transform the common coordinate to radial coordinate.\n *\n * @param {number} x\n * @param {number} y\n * @return {Object}\n */\n\n\nfunction radialCoordinate(x, y) {\n var radialCoor = {};\n x -= Math.PI / 2;\n radialCoor.x = y * Math.cos(x);\n radialCoor.y = y * Math.sin(x);\n return radialCoor;\n}\n/**\n * Get the layout position of the whole view.\n *\n * @param {module:echarts/model/Series} seriesModel the model object of sankey series\n * @param {module:echarts/ExtensionAPI} api provide the API list that the developer can call\n * @return {module:zrender/core/BoundingRect} size of rect to draw the sankey view\n */\n\n\nfunction getViewRect(seriesModel, api) {\n return layout.getLayoutRect(seriesModel.getBoxLayoutParams(), {\n width: api.getWidth(),\n height: api.getHeight()\n });\n}\n/**\n * All other shifts, applied to the smaller subtrees between w- and w+, are\n * performed by this function.\n *\n * The implementation of this function was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n *\n * @param {module:echarts/data/Tree~TreeNode} node\n */\n\n\nfunction executeShifts(node) {\n var children = node.children;\n var n = children.length;\n var shift = 0;\n var change = 0;\n\n while (--n >= 0) {\n var child = children[n];\n child.hierNode.prelim += shift;\n child.hierNode.modifier += shift;\n change += child.hierNode.change;\n shift += child.hierNode.shift + change;\n }\n}\n/**\n * The implementation of this function was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n *\n * The core of the algorithm. Here, a new subtree is combined with the\n * previous subtrees. Threads are used to traverse the inside and outside\n * contours of the left and right subtree up to the highest common level.\n * Whenever two nodes of the inside contours conflict, we compute the left\n * one of the greatest uncommon ancestors using the function nextAncestor()\n * and call moveSubtree() to shift the subtree and prepare the shifts of\n * smaller subtrees. Finally, we add a new thread (if necessary).\n *\n * @param {module:echarts/data/Tree~TreeNode} subtreeV\n * @param {module:echarts/data/Tree~TreeNode} subtreeW\n * @param {module:echarts/data/Tree~TreeNode} ancestor\n * @param {Function} separation\n * @return {module:echarts/data/Tree~TreeNode}\n */\n\n\nfunction apportion(subtreeV, subtreeW, ancestor, separation) {\n if (subtreeW) {\n var nodeOutRight = subtreeV;\n var nodeInRight = subtreeV;\n var nodeOutLeft = nodeInRight.parentNode.children[0];\n var nodeInLeft = subtreeW;\n var sumOutRight = nodeOutRight.hierNode.modifier;\n var sumInRight = nodeInRight.hierNode.modifier;\n var sumOutLeft = nodeOutLeft.hierNode.modifier;\n var sumInLeft = nodeInLeft.hierNode.modifier;\n\n while (nodeInLeft = nextRight(nodeInLeft), nodeInRight = nextLeft(nodeInRight), nodeInLeft && nodeInRight) {\n nodeOutRight = nextRight(nodeOutRight);\n nodeOutLeft = nextLeft(nodeOutLeft);\n nodeOutRight.hierNode.ancestor = subtreeV;\n var shift = nodeInLeft.hierNode.prelim + sumInLeft - nodeInRight.hierNode.prelim - sumInRight + separation(nodeInLeft, nodeInRight);\n\n if (shift > 0) {\n moveSubtree(nextAncestor(nodeInLeft, subtreeV, ancestor), subtreeV, shift);\n sumInRight += shift;\n sumOutRight += shift;\n }\n\n sumInLeft += nodeInLeft.hierNode.modifier;\n sumInRight += nodeInRight.hierNode.modifier;\n sumOutRight += nodeOutRight.hierNode.modifier;\n sumOutLeft += nodeOutLeft.hierNode.modifier;\n }\n\n if (nodeInLeft && !nextRight(nodeOutRight)) {\n nodeOutRight.hierNode.thread = nodeInLeft;\n nodeOutRight.hierNode.modifier += sumInLeft - sumOutRight;\n }\n\n if (nodeInRight && !nextLeft(nodeOutLeft)) {\n nodeOutLeft.hierNode.thread = nodeInRight;\n nodeOutLeft.hierNode.modifier += sumInRight - sumOutLeft;\n ancestor = subtreeV;\n }\n }\n\n return ancestor;\n}\n/**\n * This function is used to traverse the right contour of a subtree.\n * It returns the rightmost child of node or the thread of node. The function\n * returns null if and only if node is on the highest depth of its subtree.\n *\n * @param {module:echarts/data/Tree~TreeNode} node\n * @return {module:echarts/data/Tree~TreeNode}\n */\n\n\nfunction nextRight(node) {\n var children = node.children;\n return children.length && node.isExpand ? children[children.length - 1] : node.hierNode.thread;\n}\n/**\n * This function is used to traverse the left contour of a subtree (or a subforest).\n * It returns the leftmost child of node or the thread of node. The function\n * returns null if and only if node is on the highest depth of its subtree.\n *\n * @param {module:echarts/data/Tree~TreeNode} node\n * @return {module:echarts/data/Tree~TreeNode}\n */\n\n\nfunction nextLeft(node) {\n var children = node.children;\n return children.length && node.isExpand ? children[0] : node.hierNode.thread;\n}\n/**\n * If nodeInLeft’s ancestor is a sibling of node, returns nodeInLeft’s ancestor.\n * Otherwise, returns the specified ancestor.\n *\n * @param {module:echarts/data/Tree~TreeNode} nodeInLeft\n * @param {module:echarts/data/Tree~TreeNode} node\n * @param {module:echarts/data/Tree~TreeNode} ancestor\n * @return {module:echarts/data/Tree~TreeNode}\n */\n\n\nfunction nextAncestor(nodeInLeft, node, ancestor) {\n return nodeInLeft.hierNode.ancestor.parentNode === node.parentNode ? nodeInLeft.hierNode.ancestor : ancestor;\n}\n/**\n * The implementation of this function was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n *\n * Shifts the current subtree rooted at wr.\n * This is done by increasing prelim(w+) and modifier(w+) by shift.\n *\n * @param {module:echarts/data/Tree~TreeNode} wl\n * @param {module:echarts/data/Tree~TreeNode} wr\n * @param {number} shift [description]\n */\n\n\nfunction moveSubtree(wl, wr, shift) {\n var change = shift / (wr.hierNode.i - wl.hierNode.i);\n wr.hierNode.change -= change;\n wr.hierNode.shift += shift;\n wr.hierNode.modifier += shift;\n wr.hierNode.prelim += shift;\n wl.hierNode.change += change;\n}\n/**\n * The implementation of this function was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n */\n\n\nfunction defaultSeparation(node1, node2) {\n return node1.parentNode === node2.parentNode ? 1 : 2;\n}\n\nexports.init = init;\nexports.firstWalk = firstWalk;\nexports.secondWalk = secondWalk;\nexports.separation = separation;\nexports.radialCoordinate = radialCoordinate;\nexports.getViewRect = getViewRect;","\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* 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 * Traverse the tree from bottom to top and do something\n * @param {module:echarts/data/Tree~TreeNode} root The real root of the tree\n * @param {Function} callback\n */\nfunction eachAfter(root, callback, separation) {\n var nodes = [root];\n var next = [];\n var node;\n\n while (node = nodes.pop()) {\n // jshint ignore:line\n next.push(node);\n\n if (node.isExpand) {\n var children = node.children;\n\n if (children.length) {\n for (var i = 0; i < children.length; i++) {\n nodes.push(children[i]);\n }\n }\n }\n }\n\n while (node = next.pop()) {\n // jshint ignore:line\n callback(node, separation);\n }\n}\n/**\n * Traverse the tree from top to bottom and do something\n * @param {module:echarts/data/Tree~TreeNode} root The real root of the tree\n * @param {Function} callback\n */\n\n\nfunction eachBefore(root, callback) {\n var nodes = [root];\n var node;\n\n while (node = nodes.pop()) {\n // jshint ignore:line\n callback(node);\n\n if (node.isExpand) {\n var children = node.children;\n\n if (children.length) {\n for (var i = children.length - 1; i >= 0; i--) {\n nodes.push(children[i]);\n }\n }\n }\n }\n}\n\nexports.eachAfter = eachAfter;\nexports.eachBefore = eachBefore;","\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\nvar echarts = require(\"../../echarts\");\n\nvar _roamHelper = require(\"../../action/roamHelper\");\n\nvar updateCenterAndZoom = _roamHelper.updateCenterAndZoom;\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*/\necharts.registerAction({\n type: 'treeExpandAndCollapse',\n event: 'treeExpandAndCollapse',\n update: 'update'\n}, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series',\n subType: 'tree',\n query: payload\n }, function (seriesModel) {\n var dataIndex = payload.dataIndex;\n var tree = seriesModel.getData().tree;\n var node = tree.getNodeByDataIndex(dataIndex);\n node.isExpand = !node.isExpand;\n });\n});\necharts.registerAction({\n type: 'treeRoam',\n event: 'treeRoam',\n // Here we set 'none' instead of 'update', because roam action\n // just need to update the transform matrix without having to recalculate\n // the layout. So don't need to go through the whole update process, such\n // as 'dataPrcocess', 'coordSystemUpdate', 'layout' and so on.\n update: 'none'\n}, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series',\n subType: 'tree',\n query: payload\n }, function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n var res = updateCenterAndZoom(coordSys, payload);\n seriesModel.setCenter && seriesModel.setCenter(res.center);\n seriesModel.setZoom && seriesModel.setZoom(res.zoom);\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*/\n\nvar _traversalHelper = require(\"./traversalHelper\");\n\nvar eachAfter = _traversalHelper.eachAfter;\nvar eachBefore = _traversalHelper.eachBefore;\n\nvar _layoutHelper = require(\"./layoutHelper\");\n\nvar init = _layoutHelper.init;\nvar firstWalk = _layoutHelper.firstWalk;\nvar secondWalk = _layoutHelper.secondWalk;\nvar sep = _layoutHelper.separation;\nvar radialCoordinate = _layoutHelper.radialCoordinate;\nvar getViewRect = _layoutHelper.getViewRect;\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*/\nfunction _default(ecModel, api) {\n ecModel.eachSeriesByType('tree', function (seriesModel) {\n commonLayout(seriesModel, api);\n });\n}\n\nfunction commonLayout(seriesModel, api) {\n var layoutInfo = getViewRect(seriesModel, api);\n seriesModel.layoutInfo = layoutInfo;\n var layout = seriesModel.get('layout');\n var width = 0;\n var height = 0;\n var separation = null;\n\n if (layout === 'radial') {\n width = 2 * Math.PI;\n height = Math.min(layoutInfo.height, layoutInfo.width) / 2;\n separation = sep(function (node1, node2) {\n return (node1.parentNode === node2.parentNode ? 1 : 2) / node1.depth;\n });\n } else {\n width = layoutInfo.width;\n height = layoutInfo.height;\n separation = sep();\n }\n\n var virtualRoot = seriesModel.getData().tree.root;\n var realRoot = virtualRoot.children[0];\n\n if (realRoot) {\n init(virtualRoot);\n eachAfter(realRoot, firstWalk, separation);\n virtualRoot.hierNode.modifier = -realRoot.hierNode.prelim;\n eachBefore(realRoot, secondWalk);\n var left = realRoot;\n var right = realRoot;\n var bottom = realRoot;\n eachBefore(realRoot, function (node) {\n var x = node.getLayout().x;\n\n if (x < left.getLayout().x) {\n left = node;\n }\n\n if (x > right.getLayout().x) {\n right = node;\n }\n\n if (node.depth > bottom.depth) {\n bottom = node;\n }\n });\n var delta = left === right ? 1 : separation(left, right) / 2;\n var tx = delta - left.getLayout().x;\n var kx = 0;\n var ky = 0;\n var coorX = 0;\n var coorY = 0;\n\n if (layout === 'radial') {\n kx = width / (right.getLayout().x + delta + tx); // here we use (node.depth - 1), bucause the real root's depth is 1\n\n ky = height / (bottom.depth - 1 || 1);\n eachBefore(realRoot, function (node) {\n coorX = (node.getLayout().x + tx) * kx;\n coorY = (node.depth - 1) * ky;\n var finalCoor = radialCoordinate(coorX, coorY);\n node.setLayout({\n x: finalCoor.x,\n y: finalCoor.y,\n rawX: coorX,\n rawY: coorY\n }, true);\n });\n } else {\n var orient = seriesModel.getOrient();\n\n if (orient === 'RL' || orient === 'LR') {\n ky = height / (right.getLayout().x + delta + tx);\n kx = width / (bottom.depth - 1 || 1);\n eachBefore(realRoot, function (node) {\n coorY = (node.getLayout().x + tx) * ky;\n coorX = orient === 'LR' ? (node.depth - 1) * kx : width - (node.depth - 1) * kx;\n node.setLayout({\n x: coorX,\n y: coorY\n }, true);\n });\n } else if (orient === 'TB' || orient === 'BT') {\n kx = width / (right.getLayout().x + delta + tx);\n ky = height / (bottom.depth - 1 || 1);\n eachBefore(realRoot, function (node) {\n coorX = (node.getLayout().x + tx) * kx;\n coorY = orient === 'TB' ? (node.depth - 1) * ky : height - (node.depth - 1) * ky;\n node.setLayout({\n x: coorX,\n y: coorY\n }, true);\n });\n }\n }\n }\n}\n\nmodule.exports = _default;","\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\nvar echarts = require(\"../echarts\");\n\nrequire(\"./treemap/TreemapSeries\");\n\nrequire(\"./treemap/TreemapView\");\n\nrequire(\"./treemap/treemapAction\");\n\nvar treemapVisual = require(\"./treemap/treemapVisual\");\n\nvar treemapLayout = require(\"./treemap/treemapLayout\");\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*/\necharts.registerVisual(treemapVisual);\necharts.registerLayout(treemapLayout);","\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\nvar graphic = require(\"../../util/graphic\");\n\nvar layout = require(\"../../util/layout\");\n\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar _treeHelper = require(\"../helper/treeHelper\");\n\nvar wrapTreePathInfo = _treeHelper.wrapTreePathInfo;\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*/\nvar TEXT_PADDING = 8;\nvar ITEM_GAP = 8;\nvar ARRAY_LENGTH = 5;\n\nfunction Breadcrumb(containerGroup) {\n /**\n * @private\n * @type {module:zrender/container/Group}\n */\n this.group = new graphic.Group();\n containerGroup.add(this.group);\n}\n\nBreadcrumb.prototype = {\n constructor: Breadcrumb,\n render: function (seriesModel, api, targetNode, onSelect) {\n var model = seriesModel.getModel('breadcrumb');\n var thisGroup = this.group;\n thisGroup.removeAll();\n\n if (!model.get('show') || !targetNode) {\n return;\n }\n\n var normalStyleModel = model.getModel('itemStyle'); // var emphasisStyleModel = model.getModel('emphasis.itemStyle');\n\n var textStyleModel = normalStyleModel.getModel('textStyle');\n var layoutParam = {\n pos: {\n left: model.get('left'),\n right: model.get('right'),\n top: model.get('top'),\n bottom: model.get('bottom')\n },\n box: {\n width: api.getWidth(),\n height: api.getHeight()\n },\n emptyItemWidth: model.get('emptyItemWidth'),\n totalWidth: 0,\n renderList: []\n };\n\n this._prepare(targetNode, layoutParam, textStyleModel);\n\n this._renderContent(seriesModel, layoutParam, normalStyleModel, textStyleModel, onSelect);\n\n layout.positionElement(thisGroup, layoutParam.pos, layoutParam.box);\n },\n\n /**\n * Prepare render list and total width\n * @private\n */\n _prepare: function (targetNode, layoutParam, textStyleModel) {\n for (var node = targetNode; node; node = node.parentNode) {\n var text = node.getModel().get('name');\n var textRect = textStyleModel.getTextRect(text);\n var itemWidth = Math.max(textRect.width + TEXT_PADDING * 2, layoutParam.emptyItemWidth);\n layoutParam.totalWidth += itemWidth + ITEM_GAP;\n layoutParam.renderList.push({\n node: node,\n text: text,\n width: itemWidth\n });\n }\n },\n\n /**\n * @private\n */\n _renderContent: function (seriesModel, layoutParam, normalStyleModel, textStyleModel, onSelect) {\n // Start rendering.\n var lastX = 0;\n var emptyItemWidth = layoutParam.emptyItemWidth;\n var height = seriesModel.get('breadcrumb.height');\n var availableSize = layout.getAvailableSize(layoutParam.pos, layoutParam.box);\n var totalWidth = layoutParam.totalWidth;\n var renderList = layoutParam.renderList;\n\n for (var i = renderList.length - 1; i >= 0; i--) {\n var item = renderList[i];\n var itemNode = item.node;\n var itemWidth = item.width;\n var text = item.text; // Hdie text and shorten width if necessary.\n\n if (totalWidth > availableSize.width) {\n totalWidth -= itemWidth - emptyItemWidth;\n itemWidth = emptyItemWidth;\n text = null;\n }\n\n var el = new graphic.Polygon({\n shape: {\n points: makeItemPoints(lastX, 0, itemWidth, height, i === renderList.length - 1, i === 0)\n },\n style: zrUtil.defaults(normalStyleModel.getItemStyle(), {\n lineJoin: 'bevel',\n text: text,\n textFill: textStyleModel.getTextColor(),\n textFont: textStyleModel.getFont()\n }),\n z: 10,\n onclick: zrUtil.curry(onSelect, itemNode)\n });\n this.group.add(el);\n packEventData(el, seriesModel, itemNode);\n lastX += itemWidth + ITEM_GAP;\n }\n },\n\n /**\n * @override\n */\n remove: function () {\n this.group.removeAll();\n }\n};\n\nfunction makeItemPoints(x, y, itemWidth, itemHeight, head, tail) {\n var points = [[head ? x : x - ARRAY_LENGTH, y], [x + itemWidth, y], [x + itemWidth, y + itemHeight], [head ? x : x - ARRAY_LENGTH, y + itemHeight]];\n !tail && points.splice(2, 0, [x + itemWidth + ARRAY_LENGTH, y + itemHeight / 2]);\n !head && points.push([x, y + itemHeight / 2]);\n return points;\n} // Package custom mouse event.\n\n\nfunction packEventData(el, seriesModel, itemNode) {\n el.eventData = {\n componentType: 'series',\n componentSubType: 'treemap',\n componentIndex: seriesModel.componentIndex,\n seriesIndex: seriesModel.componentIndex,\n seriesName: seriesModel.name,\n seriesType: 'treemap',\n selfType: 'breadcrumb',\n // Distinguish with click event on treemap node.\n nodeData: {\n dataIndex: itemNode && itemNode.dataIndex,\n name: itemNode && itemNode.name\n },\n treePathInfo: itemNode && wrapTreePathInfo(itemNode, seriesModel)\n };\n}\n\nvar _default = Breadcrumb;\nmodule.exports = _default;","\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\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar SeriesModel = require(\"../../model/Series\");\n\nvar Tree = require(\"../../data/Tree\");\n\nvar Model = require(\"../../model/Model\");\n\nvar _format = require(\"../../util/format\");\n\nvar encodeHTML = _format.encodeHTML;\nvar addCommas = _format.addCommas;\n\nvar _treeHelper = require(\"../helper/treeHelper\");\n\nvar wrapTreePathInfo = _treeHelper.wrapTreePathInfo;\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*/\nvar _default = SeriesModel.extend({\n type: 'series.treemap',\n layoutMode: 'box',\n dependencies: ['grid', 'polar'],\n preventUsingHoverLayer: true,\n\n /**\n * @type {module:echarts/data/Tree~Node}\n */\n _viewRoot: null,\n defaultOption: {\n // Disable progressive rendering\n progressive: 0,\n // center: ['50%', '50%'], // not supported in ec3.\n // size: ['80%', '80%'], // deprecated, compatible with ec2.\n left: 'center',\n top: 'middle',\n right: null,\n bottom: null,\n width: '80%',\n height: '80%',\n sort: true,\n // Can be null or false or true\n // (order by desc default, asc not supported yet (strange effect))\n clipWindow: 'origin',\n // Size of clipped window when zooming. 'origin' or 'fullscreen'\n squareRatio: 0.5 * (1 + Math.sqrt(5)),\n // golden ratio\n leafDepth: null,\n // Nodes on depth from root are regarded as leaves.\n // Count from zero (zero represents only view root).\n drillDownIcon: '▶',\n // Use html character temporarily because it is complicated\n // to align specialized icon. ▷▶❒❐▼✚\n zoomToNodeRatio: 0.32 * 0.32,\n // Be effective when using zoomToNode. Specify the proportion of the\n // target node area in the view area.\n roam: true,\n // true, false, 'scale' or 'zoom', 'move'.\n nodeClick: 'zoomToNode',\n // Leaf node click behaviour: 'zoomToNode', 'link', false.\n // If leafDepth is set and clicking a node which has children but\n // be on left depth, the behaviour would be changing root. Otherwise\n // use behavious defined above.\n animation: true,\n animationDurationUpdate: 900,\n animationEasing: 'quinticInOut',\n breadcrumb: {\n show: true,\n height: 22,\n left: 'center',\n top: 'bottom',\n // right\n // bottom\n emptyItemWidth: 25,\n // Width of empty node.\n itemStyle: {\n color: 'rgba(0,0,0,0.7)',\n //'#5793f3',\n borderColor: 'rgba(255,255,255,0.7)',\n borderWidth: 1,\n shadowColor: 'rgba(150,150,150,1)',\n shadowBlur: 3,\n shadowOffsetX: 0,\n shadowOffsetY: 0,\n textStyle: {\n color: '#fff'\n }\n },\n emphasis: {\n textStyle: {}\n }\n },\n label: {\n show: true,\n // Do not use textDistance, for ellipsis rect just the same as treemap node rect.\n distance: 0,\n padding: 5,\n position: 'inside',\n // Can be [5, '5%'] or position stirng like 'insideTopLeft', ...\n // formatter: null,\n color: '#fff',\n ellipsis: true // align\n // verticalAlign\n\n },\n upperLabel: {\n // Label when node is parent.\n show: false,\n position: [0, '50%'],\n height: 20,\n // formatter: null,\n color: '#fff',\n ellipsis: true,\n // align: null,\n verticalAlign: 'middle'\n },\n itemStyle: {\n color: null,\n // Can be 'none' if not necessary.\n colorAlpha: null,\n // Can be 'none' if not necessary.\n colorSaturation: null,\n // Can be 'none' if not necessary.\n borderWidth: 0,\n gapWidth: 0,\n borderColor: '#fff',\n borderColorSaturation: null // If specified, borderColor will be ineffective, and the\n // border color is evaluated by color of current node and\n // borderColorSaturation.\n\n },\n emphasis: {\n upperLabel: {\n show: true,\n position: [0, '50%'],\n color: '#fff',\n ellipsis: true,\n verticalAlign: 'middle'\n }\n },\n visualDimension: 0,\n // Can be 0, 1, 2, 3.\n visualMin: null,\n visualMax: null,\n color: [],\n // + treemapSeries.color should not be modified. Please only modified\n // level[n].color (if necessary).\n // + Specify color list of each level. level[0].color would be global\n // color list if not specified. (see method `setDefault`).\n // + But set as a empty array to forbid fetch color from global palette\n // when using nodeModel.get('color'), otherwise nodes on deep level\n // will always has color palette set and are not able to inherit color\n // from parent node.\n // + TreemapSeries.color can not be set as 'none', otherwise effect\n // legend color fetching (see seriesColor.js).\n colorAlpha: null,\n // Array. Specify color alpha range of each level, like [0.2, 0.8]\n colorSaturation: null,\n // Array. Specify color saturation of each level, like [0.2, 0.5]\n colorMappingBy: 'index',\n // 'value' or 'index' or 'id'.\n visibleMin: 10,\n // If area less than this threshold (unit: pixel^2), node will not\n // be rendered. Only works when sort is 'asc' or 'desc'.\n childrenVisibleMin: null,\n // If area of a node less than this threshold (unit: pixel^2),\n // grandchildren will not show.\n // Why grandchildren? If not grandchildren but children,\n // some siblings show children and some not,\n // the appearance may be mess and not consistent,\n levels: [] // Each item: {\n // visibleMin, itemStyle, visualDimension, label\n // }\n // data: {\n // value: [],\n // children: [],\n // link: 'http://xxx.xxx.xxx',\n // target: 'blank' or 'self'\n // }\n\n },\n\n /**\n * @override\n */\n getInitialData: function (option, ecModel) {\n // Create a virtual root.\n var root = {\n name: option.name,\n children: option.data\n };\n completeTreeValue(root);\n var levels = option.levels || []; // Used in \"visual priority\" in `treemapVisual.js`.\n // This way is a little tricky, must satisfy the precondition:\n // 1. There is no `treeNode.getModel('itemStyle.xxx')` used.\n // 2. The `Model.prototype.getModel()` will not use any clone-like way.\n\n var designatedVisualItemStyle = this.designatedVisualItemStyle = {};\n var designatedVisualModel = new Model({\n itemStyle: designatedVisualItemStyle\n }, this, ecModel);\n levels = option.levels = setDefault(levels, ecModel);\n var levelModels = zrUtil.map(levels || [], function (levelDefine) {\n return new Model(levelDefine, designatedVisualModel, ecModel);\n }, this); // Make sure always a new tree is created when setOption,\n // in TreemapView, we check whether oldTree === newTree\n // to choose mappings approach among old shapes and new shapes.\n\n var tree = Tree.createTree(root, this, beforeLink);\n\n function beforeLink(nodeData) {\n nodeData.wrapMethod('getItemModel', function (model, idx) {\n var node = tree.getNodeByDataIndex(idx);\n var levelModel = levelModels[node.depth]; // If no levelModel, we also need `designatedVisualModel`.\n\n model.parentModel = levelModel || designatedVisualModel;\n return model;\n });\n }\n\n return tree.data;\n },\n optionUpdated: function () {\n this.resetViewRoot();\n },\n\n /**\n * @override\n * @param {number} dataIndex\n * @param {boolean} [mutipleSeries=false]\n */\n formatTooltip: function (dataIndex) {\n var data = this.getData();\n var value = this.getRawValue(dataIndex);\n var formattedValue = zrUtil.isArray(value) ? addCommas(value[0]) : addCommas(value);\n var name = data.getName(dataIndex);\n return encodeHTML(name + ': ' + formattedValue);\n },\n\n /**\n * Add tree path to tooltip param\n *\n * @override\n * @param {number} dataIndex\n * @return {Object}\n */\n getDataParams: function (dataIndex) {\n var params = SeriesModel.prototype.getDataParams.apply(this, arguments);\n var node = this.getData().tree.getNodeByDataIndex(dataIndex);\n params.treePathInfo = wrapTreePathInfo(node, this);\n return params;\n },\n\n /**\n * @public\n * @param {Object} layoutInfo {\n * x: containerGroup x\n * y: containerGroup y\n * width: containerGroup width\n * height: containerGroup height\n * }\n */\n setLayoutInfo: function (layoutInfo) {\n /**\n * @readOnly\n * @type {Object}\n */\n this.layoutInfo = this.layoutInfo || {};\n zrUtil.extend(this.layoutInfo, layoutInfo);\n },\n\n /**\n * @param {string} id\n * @return {number} index\n */\n mapIdToIndex: function (id) {\n // A feature is implemented:\n // index is monotone increasing with the sequence of\n // input id at the first time.\n // This feature can make sure that each data item and its\n // mapped color have the same index between data list and\n // color list at the beginning, which is useful for user\n // to adjust data-color mapping.\n\n /**\n * @private\n * @type {Object}\n */\n var idIndexMap = this._idIndexMap;\n\n if (!idIndexMap) {\n idIndexMap = this._idIndexMap = zrUtil.createHashMap();\n /**\n * @private\n * @type {number}\n */\n\n this._idIndexMapCount = 0;\n }\n\n var index = idIndexMap.get(id);\n\n if (index == null) {\n idIndexMap.set(id, index = this._idIndexMapCount++);\n }\n\n return index;\n },\n getViewRoot: function () {\n return this._viewRoot;\n },\n\n /**\n * @param {module:echarts/data/Tree~Node} [viewRoot]\n */\n resetViewRoot: function (viewRoot) {\n viewRoot ? this._viewRoot = viewRoot : viewRoot = this._viewRoot;\n var root = this.getRawData().tree.root;\n\n if (!viewRoot || viewRoot !== root && !root.contains(viewRoot)) {\n this._viewRoot = root;\n }\n }\n});\n/**\n * @param {Object} dataNode\n */\n\n\nfunction completeTreeValue(dataNode) {\n // Postorder travel tree.\n // If value of none-leaf node is not set,\n // calculate it by suming up the value of all children.\n var sum = 0;\n zrUtil.each(dataNode.children, function (child) {\n completeTreeValue(child);\n var childValue = child.value;\n zrUtil.isArray(childValue) && (childValue = childValue[0]);\n sum += childValue;\n });\n var thisValue = dataNode.value;\n\n if (zrUtil.isArray(thisValue)) {\n thisValue = thisValue[0];\n }\n\n if (thisValue == null || isNaN(thisValue)) {\n thisValue = sum;\n } // Value should not less than 0.\n\n\n if (thisValue < 0) {\n thisValue = 0;\n }\n\n zrUtil.isArray(dataNode.value) ? dataNode.value[0] = thisValue : dataNode.value = thisValue;\n}\n/**\n * set default to level configuration\n */\n\n\nfunction setDefault(levels, ecModel) {\n var globalColorList = ecModel.get('color');\n\n if (!globalColorList) {\n return;\n }\n\n levels = levels || [];\n var hasColorDefine;\n zrUtil.each(levels, function (levelDefine) {\n var model = new Model(levelDefine);\n var modelColor = model.get('color');\n\n if (model.get('itemStyle.color') || modelColor && modelColor !== 'none') {\n hasColorDefine = true;\n }\n });\n\n if (!hasColorDefine) {\n var level0 = levels[0] || (levels[0] = {});\n level0.color = globalColorList.slice();\n }\n\n return levels;\n}\n\nmodule.exports = _default;","\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\nvar echarts = require(\"../../echarts\");\n\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar graphic = require(\"../../util/graphic\");\n\nvar DataDiffer = require(\"../../data/DataDiffer\");\n\nvar helper = require(\"../helper/treeHelper\");\n\nvar Breadcrumb = require(\"./Breadcrumb\");\n\nvar RoamController = require(\"../../component/helper/RoamController\");\n\nvar BoundingRect = require(\"zrender/lib/core/BoundingRect\");\n\nvar matrix = require(\"zrender/lib/core/matrix\");\n\nvar animationUtil = require(\"../../util/animation\");\n\nvar makeStyleMapper = require(\"../../model/mixin/makeStyleMapper\");\n\nvar _format = require(\"../../util/format\");\n\nvar windowOpen = _format.windowOpen;\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*/\nvar bind = zrUtil.bind;\nvar Group = graphic.Group;\nvar Rect = graphic.Rect;\nvar each = zrUtil.each;\nvar DRAG_THRESHOLD = 3;\nvar PATH_LABEL_NOAMAL = ['label'];\nvar PATH_LABEL_EMPHASIS = ['emphasis', 'label'];\nvar PATH_UPPERLABEL_NORMAL = ['upperLabel'];\nvar PATH_UPPERLABEL_EMPHASIS = ['emphasis', 'upperLabel'];\nvar Z_BASE = 10; // Should bigger than every z.\n\nvar Z_BG = 1;\nvar Z_CONTENT = 2;\nvar getItemStyleEmphasis = makeStyleMapper([['fill', 'color'], // `borderColor` and `borderWidth` has been occupied,\n// so use `stroke` to indicate the stroke of the rect.\n['stroke', 'strokeColor'], ['lineWidth', 'strokeWidth'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor']]);\n\nvar getItemStyleNormal = function (model) {\n // Normal style props should include emphasis style props.\n var itemStyle = getItemStyleEmphasis(model); // Clear styles set by emphasis.\n\n itemStyle.stroke = itemStyle.fill = itemStyle.lineWidth = null;\n return itemStyle;\n};\n\nvar _default = echarts.extendChartView({\n type: 'treemap',\n\n /**\n * @override\n */\n init: function (o, api) {\n /**\n * @private\n * @type {module:zrender/container/Group}\n */\n this._containerGroup;\n /**\n * @private\n * @type {Object.>}\n */\n\n this._storage = createStorage();\n /**\n * @private\n * @type {module:echarts/data/Tree}\n */\n\n this._oldTree;\n /**\n * @private\n * @type {module:echarts/chart/treemap/Breadcrumb}\n */\n\n this._breadcrumb;\n /**\n * @private\n * @type {module:echarts/component/helper/RoamController}\n */\n\n this._controller;\n /**\n * 'ready', 'animating'\n * @private\n */\n\n this._state = 'ready';\n },\n\n /**\n * @override\n */\n render: function (seriesModel, ecModel, api, payload) {\n var models = ecModel.findComponents({\n mainType: 'series',\n subType: 'treemap',\n query: payload\n });\n\n if (zrUtil.indexOf(models, seriesModel) < 0) {\n return;\n }\n\n this.seriesModel = seriesModel;\n this.api = api;\n this.ecModel = ecModel;\n var types = ['treemapZoomToNode', 'treemapRootToNode'];\n var targetInfo = helper.retrieveTargetInfo(payload, types, seriesModel);\n var payloadType = payload && payload.type;\n var layoutInfo = seriesModel.layoutInfo;\n var isInit = !this._oldTree;\n var thisStorage = this._storage; // Mark new root when action is treemapRootToNode.\n\n var reRoot = payloadType === 'treemapRootToNode' && targetInfo && thisStorage ? {\n rootNodeGroup: thisStorage.nodeGroup[targetInfo.node.getRawIndex()],\n direction: payload.direction\n } : null;\n\n var containerGroup = this._giveContainerGroup(layoutInfo);\n\n var renderResult = this._doRender(containerGroup, seriesModel, reRoot);\n\n !isInit && (!payloadType || payloadType === 'treemapZoomToNode' || payloadType === 'treemapRootToNode') ? this._doAnimation(containerGroup, renderResult, seriesModel, reRoot) : renderResult.renderFinally();\n\n this._resetController(api);\n\n this._renderBreadcrumb(seriesModel, api, targetInfo);\n },\n\n /**\n * @private\n */\n _giveContainerGroup: function (layoutInfo) {\n var containerGroup = this._containerGroup;\n\n if (!containerGroup) {\n // FIXME\n // 加一层containerGroup是为了clip,但是现在clip功能并没有实现。\n containerGroup = this._containerGroup = new Group();\n\n this._initEvents(containerGroup);\n\n this.group.add(containerGroup);\n }\n\n containerGroup.attr('position', [layoutInfo.x, layoutInfo.y]);\n return containerGroup;\n },\n\n /**\n * @private\n */\n _doRender: function (containerGroup, seriesModel, reRoot) {\n var thisTree = seriesModel.getData().tree;\n var oldTree = this._oldTree; // Clear last shape records.\n\n var lastsForAnimation = createStorage();\n var thisStorage = createStorage();\n var oldStorage = this._storage;\n var willInvisibleEls = [];\n var doRenderNode = zrUtil.curry(renderNode, seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimation, willInvisibleEls); // Notice: when thisTree and oldTree are the same tree (see list.cloneShallow),\n // the oldTree is actually losted, so we can not find all of the old graphic\n // elements from tree. So we use this stragegy: make element storage, move\n // from old storage to new storage, clear old storage.\n\n dualTravel(thisTree.root ? [thisTree.root] : [], oldTree && oldTree.root ? [oldTree.root] : [], containerGroup, thisTree === oldTree || !oldTree, 0); // Process all removing.\n\n var willDeleteEls = clearStorage(oldStorage);\n this._oldTree = thisTree;\n this._storage = thisStorage;\n return {\n lastsForAnimation: lastsForAnimation,\n willDeleteEls: willDeleteEls,\n renderFinally: renderFinally\n };\n\n function dualTravel(thisViewChildren, oldViewChildren, parentGroup, sameTree, depth) {\n // When 'render' is triggered by action,\n // 'this' and 'old' may be the same tree,\n // we use rawIndex in that case.\n if (sameTree) {\n oldViewChildren = thisViewChildren;\n each(thisViewChildren, function (child, index) {\n !child.isRemoved() && processNode(index, index);\n });\n } // Diff hierarchically (diff only in each subtree, but not whole).\n // because, consistency of view is important.\n else {\n new DataDiffer(oldViewChildren, thisViewChildren, getKey, getKey).add(processNode).update(processNode).remove(zrUtil.curry(processNode, null)).execute();\n }\n\n function getKey(node) {\n // Identify by name or raw index.\n return node.getId();\n }\n\n function processNode(newIndex, oldIndex) {\n var thisNode = newIndex != null ? thisViewChildren[newIndex] : null;\n var oldNode = oldIndex != null ? oldViewChildren[oldIndex] : null;\n var group = doRenderNode(thisNode, oldNode, parentGroup, depth);\n group && dualTravel(thisNode && thisNode.viewChildren || [], oldNode && oldNode.viewChildren || [], group, sameTree, depth + 1);\n }\n }\n\n function clearStorage(storage) {\n var willDeleteEls = createStorage();\n storage && each(storage, function (store, storageName) {\n var delEls = willDeleteEls[storageName];\n each(store, function (el) {\n el && (delEls.push(el), el.__tmWillDelete = 1);\n });\n });\n return willDeleteEls;\n }\n\n function renderFinally() {\n each(willDeleteEls, function (els) {\n each(els, function (el) {\n el.parent && el.parent.remove(el);\n });\n });\n each(willInvisibleEls, function (el) {\n el.invisible = true; // Setting invisible is for optimizing, so no need to set dirty,\n // just mark as invisible.\n\n el.dirty();\n });\n }\n },\n\n /**\n * @private\n */\n _doAnimation: function (containerGroup, renderResult, seriesModel, reRoot) {\n if (!seriesModel.get('animation')) {\n return;\n }\n\n var duration = seriesModel.get('animationDurationUpdate');\n var easing = seriesModel.get('animationEasing');\n var animationWrap = animationUtil.createWrap(); // Make delete animations.\n\n each(renderResult.willDeleteEls, function (store, storageName) {\n each(store, function (el, rawIndex) {\n if (el.invisible) {\n return;\n }\n\n var parent = el.parent; // Always has parent, and parent is nodeGroup.\n\n var target;\n\n if (reRoot && reRoot.direction === 'drillDown') {\n target = parent === reRoot.rootNodeGroup // This is the content element of view root.\n // Only `content` will enter this branch, because\n // `background` and `nodeGroup` will not be deleted.\n ? {\n shape: {\n x: 0,\n y: 0,\n width: parent.__tmNodeWidth,\n height: parent.__tmNodeHeight\n },\n style: {\n opacity: 0\n } // Others.\n\n } : {\n style: {\n opacity: 0\n }\n };\n } else {\n var targetX = 0;\n var targetY = 0;\n\n if (!parent.__tmWillDelete) {\n // Let node animate to right-bottom corner, cooperating with fadeout,\n // which is appropriate for user understanding.\n // Divided by 2 for reRoot rolling up effect.\n targetX = parent.__tmNodeWidth / 2;\n targetY = parent.__tmNodeHeight / 2;\n }\n\n target = storageName === 'nodeGroup' ? {\n position: [targetX, targetY],\n style: {\n opacity: 0\n }\n } : {\n shape: {\n x: targetX,\n y: targetY,\n width: 0,\n height: 0\n },\n style: {\n opacity: 0\n }\n };\n }\n\n target && animationWrap.add(el, target, duration, easing);\n });\n }); // Make other animations\n\n each(this._storage, function (store, storageName) {\n each(store, function (el, rawIndex) {\n var last = renderResult.lastsForAnimation[storageName][rawIndex];\n var target = {};\n\n if (!last) {\n return;\n }\n\n if (storageName === 'nodeGroup') {\n if (last.old) {\n target.position = el.position.slice();\n el.attr('position', last.old);\n }\n } else {\n if (last.old) {\n target.shape = zrUtil.extend({}, el.shape);\n el.setShape(last.old);\n }\n\n if (last.fadein) {\n el.setStyle('opacity', 0);\n target.style = {\n opacity: 1\n };\n } // When animation is stopped for succedent animation starting,\n // el.style.opacity might not be 1\n else if (el.style.opacity !== 1) {\n target.style = {\n opacity: 1\n };\n }\n }\n\n animationWrap.add(el, target, duration, easing);\n });\n }, this);\n this._state = 'animating';\n animationWrap.done(bind(function () {\n this._state = 'ready';\n renderResult.renderFinally();\n }, this)).start();\n },\n\n /**\n * @private\n */\n _resetController: function (api) {\n var controller = this._controller; // Init controller.\n\n if (!controller) {\n controller = this._controller = new RoamController(api.getZr());\n controller.enable(this.seriesModel.get('roam'));\n controller.on('pan', bind(this._onPan, this));\n controller.on('zoom', bind(this._onZoom, this));\n }\n\n var rect = new BoundingRect(0, 0, api.getWidth(), api.getHeight());\n controller.setPointerChecker(function (e, x, y) {\n return rect.contain(x, y);\n });\n },\n\n /**\n * @private\n */\n _clearController: function () {\n var controller = this._controller;\n\n if (controller) {\n controller.dispose();\n controller = null;\n }\n },\n\n /**\n * @private\n */\n _onPan: function (e) {\n if (this._state !== 'animating' && (Math.abs(e.dx) > DRAG_THRESHOLD || Math.abs(e.dy) > DRAG_THRESHOLD)) {\n // These param must not be cached.\n var root = this.seriesModel.getData().tree.root;\n\n if (!root) {\n return;\n }\n\n var rootLayout = root.getLayout();\n\n if (!rootLayout) {\n return;\n }\n\n this.api.dispatchAction({\n type: 'treemapMove',\n from: this.uid,\n seriesId: this.seriesModel.id,\n rootRect: {\n x: rootLayout.x + e.dx,\n y: rootLayout.y + e.dy,\n width: rootLayout.width,\n height: rootLayout.height\n }\n });\n }\n },\n\n /**\n * @private\n */\n _onZoom: function (e) {\n var mouseX = e.originX;\n var mouseY = e.originY;\n\n if (this._state !== 'animating') {\n // These param must not be cached.\n var root = this.seriesModel.getData().tree.root;\n\n if (!root) {\n return;\n }\n\n var rootLayout = root.getLayout();\n\n if (!rootLayout) {\n return;\n }\n\n var rect = new BoundingRect(rootLayout.x, rootLayout.y, rootLayout.width, rootLayout.height);\n var layoutInfo = this.seriesModel.layoutInfo; // Transform mouse coord from global to containerGroup.\n\n mouseX -= layoutInfo.x;\n mouseY -= layoutInfo.y; // Scale root bounding rect.\n\n var m = matrix.create();\n matrix.translate(m, m, [-mouseX, -mouseY]);\n matrix.scale(m, m, [e.scale, e.scale]);\n matrix.translate(m, m, [mouseX, mouseY]);\n rect.applyTransform(m);\n this.api.dispatchAction({\n type: 'treemapRender',\n from: this.uid,\n seriesId: this.seriesModel.id,\n rootRect: {\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height\n }\n });\n }\n },\n\n /**\n * @private\n */\n _initEvents: function (containerGroup) {\n containerGroup.on('click', function (e) {\n if (this._state !== 'ready') {\n return;\n }\n\n var nodeClick = this.seriesModel.get('nodeClick', true);\n\n if (!nodeClick) {\n return;\n }\n\n var targetInfo = this.findTarget(e.offsetX, e.offsetY);\n\n if (!targetInfo) {\n return;\n }\n\n var node = targetInfo.node;\n\n if (node.getLayout().isLeafRoot) {\n this._rootToNode(targetInfo);\n } else {\n if (nodeClick === 'zoomToNode') {\n this._zoomToNode(targetInfo);\n } else if (nodeClick === 'link') {\n var itemModel = node.hostTree.data.getItemModel(node.dataIndex);\n var link = itemModel.get('link', true);\n var linkTarget = itemModel.get('target', true) || 'blank';\n link && windowOpen(link, linkTarget);\n }\n }\n }, this);\n },\n\n /**\n * @private\n */\n _renderBreadcrumb: function (seriesModel, api, targetInfo) {\n if (!targetInfo) {\n targetInfo = seriesModel.get('leafDepth', true) != null ? {\n node: seriesModel.getViewRoot() // FIXME\n // better way?\n // Find breadcrumb tail on center of containerGroup.\n\n } : this.findTarget(api.getWidth() / 2, api.getHeight() / 2);\n\n if (!targetInfo) {\n targetInfo = {\n node: seriesModel.getData().tree.root\n };\n }\n }\n\n (this._breadcrumb || (this._breadcrumb = new Breadcrumb(this.group))).render(seriesModel, api, targetInfo.node, bind(onSelect, this));\n\n function onSelect(node) {\n if (this._state !== 'animating') {\n helper.aboveViewRoot(seriesModel.getViewRoot(), node) ? this._rootToNode({\n node: node\n }) : this._zoomToNode({\n node: node\n });\n }\n }\n },\n\n /**\n * @override\n */\n remove: function () {\n this._clearController();\n\n this._containerGroup && this._containerGroup.removeAll();\n this._storage = createStorage();\n this._state = 'ready';\n this._breadcrumb && this._breadcrumb.remove();\n },\n dispose: function () {\n this._clearController();\n },\n\n /**\n * @private\n */\n _zoomToNode: function (targetInfo) {\n this.api.dispatchAction({\n type: 'treemapZoomToNode',\n from: this.uid,\n seriesId: this.seriesModel.id,\n targetNode: targetInfo.node\n });\n },\n\n /**\n * @private\n */\n _rootToNode: function (targetInfo) {\n this.api.dispatchAction({\n type: 'treemapRootToNode',\n from: this.uid,\n seriesId: this.seriesModel.id,\n targetNode: targetInfo.node\n });\n },\n\n /**\n * @public\n * @param {number} x Global coord x.\n * @param {number} y Global coord y.\n * @return {Object} info If not found, return undefined;\n * @return {number} info.node Target node.\n * @return {number} info.offsetX x refer to target node.\n * @return {number} info.offsetY y refer to target node.\n */\n findTarget: function (x, y) {\n var targetInfo;\n var viewRoot = this.seriesModel.getViewRoot();\n viewRoot.eachNode({\n attr: 'viewChildren',\n order: 'preorder'\n }, function (node) {\n var bgEl = this._storage.background[node.getRawIndex()]; // If invisible, there might be no element.\n\n\n if (bgEl) {\n var point = bgEl.transformCoordToLocal(x, y);\n var shape = bgEl.shape; // For performance consideration, dont use 'getBoundingRect'.\n\n if (shape.x <= point[0] && point[0] <= shape.x + shape.width && shape.y <= point[1] && point[1] <= shape.y + shape.height) {\n targetInfo = {\n node: node,\n offsetX: point[0],\n offsetY: point[1]\n };\n } else {\n return false; // Suppress visit subtree.\n }\n }\n }, this);\n return targetInfo;\n }\n});\n/**\n * @inner\n */\n\n\nfunction createStorage() {\n return {\n nodeGroup: [],\n background: [],\n content: []\n };\n}\n/**\n * @inner\n * @return Return undefined means do not travel further.\n */\n\n\nfunction renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimation, willInvisibleEls, thisNode, oldNode, parentGroup, depth) {\n // Whether under viewRoot.\n if (!thisNode) {\n // Deleting nodes will be performed finally. This method just find\n // element from old storage, or create new element, set them to new\n // storage, and set styles.\n return;\n } // -------------------------------------------------------------------\n // Start of closure variables available in \"Procedures in renderNode\".\n\n\n var thisLayout = thisNode.getLayout();\n var data = seriesModel.getData(); // Only for enabling highlight/downplay. Clear firstly.\n // Because some node will not be rendered.\n\n data.setItemGraphicEl(thisNode.dataIndex, null);\n\n if (!thisLayout || !thisLayout.isInView) {\n return;\n }\n\n var thisWidth = thisLayout.width;\n var thisHeight = thisLayout.height;\n var borderWidth = thisLayout.borderWidth;\n var thisInvisible = thisLayout.invisible;\n var thisRawIndex = thisNode.getRawIndex();\n var oldRawIndex = oldNode && oldNode.getRawIndex();\n var thisViewChildren = thisNode.viewChildren;\n var upperHeight = thisLayout.upperHeight;\n var isParent = thisViewChildren && thisViewChildren.length;\n var itemStyleNormalModel = thisNode.getModel('itemStyle');\n var itemStyleEmphasisModel = thisNode.getModel('emphasis.itemStyle'); // End of closure ariables available in \"Procedures in renderNode\".\n // -----------------------------------------------------------------\n // Node group\n\n var group = giveGraphic('nodeGroup', Group);\n\n if (!group) {\n return;\n }\n\n parentGroup.add(group); // x,y are not set when el is above view root.\n\n group.attr('position', [thisLayout.x || 0, thisLayout.y || 0]);\n group.__tmNodeWidth = thisWidth;\n group.__tmNodeHeight = thisHeight;\n\n if (thisLayout.isAboveViewRoot) {\n return group;\n }\n\n var nodeModel = thisNode.getModel(); // Background\n\n var bg = giveGraphic('background', Rect, depth, Z_BG);\n bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight); // No children, render content.\n\n if (isParent) {\n // Because of the implementation about \"traverse\" in graphic hover style, we\n // can not set hover listener on the \"group\" of non-leaf node. Otherwise the\n // hover event from the descendents will be listenered.\n if (graphic.isHighDownDispatcher(group)) {\n graphic.setAsHighDownDispatcher(group, false);\n }\n\n if (bg) {\n graphic.setAsHighDownDispatcher(bg, true); // Only for enabling highlight/downplay.\n\n data.setItemGraphicEl(thisNode.dataIndex, bg);\n }\n } else {\n var content = giveGraphic('content', Rect, depth, Z_CONTENT);\n content && renderContent(group, content);\n\n if (bg && graphic.isHighDownDispatcher(bg)) {\n graphic.setAsHighDownDispatcher(bg, false);\n }\n\n graphic.setAsHighDownDispatcher(group, true); // Only for enabling highlight/downplay.\n\n data.setItemGraphicEl(thisNode.dataIndex, group);\n }\n\n return group; // ----------------------------\n // | Procedures in renderNode |\n // ----------------------------\n\n function renderBackground(group, bg, useUpperLabel) {\n // For tooltip.\n bg.dataIndex = thisNode.dataIndex;\n bg.seriesIndex = seriesModel.seriesIndex;\n bg.setShape({\n x: 0,\n y: 0,\n width: thisWidth,\n height: thisHeight\n });\n\n if (thisInvisible) {\n // If invisible, do not set visual, otherwise the element will\n // change immediately before animation. We think it is OK to\n // remain its origin color when moving out of the view window.\n processInvisible(bg);\n } else {\n bg.invisible = false;\n var visualBorderColor = thisNode.getVisual('borderColor', true);\n var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');\n var normalStyle = getItemStyleNormal(itemStyleNormalModel);\n normalStyle.fill = visualBorderColor;\n var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);\n emphasisStyle.fill = emphasisBorderColor;\n\n if (useUpperLabel) {\n var upperLabelWidth = thisWidth - 2 * borderWidth;\n prepareText(normalStyle, emphasisStyle, visualBorderColor, upperLabelWidth, upperHeight, {\n x: borderWidth,\n y: 0,\n width: upperLabelWidth,\n height: upperHeight\n });\n } // For old bg.\n else {\n normalStyle.text = emphasisStyle.text = null;\n }\n\n bg.setStyle(normalStyle);\n graphic.setElementHoverStyle(bg, emphasisStyle);\n }\n\n group.add(bg);\n }\n\n function renderContent(group, content) {\n // For tooltip.\n content.dataIndex = thisNode.dataIndex;\n content.seriesIndex = seriesModel.seriesIndex;\n var contentWidth = Math.max(thisWidth - 2 * borderWidth, 0);\n var contentHeight = Math.max(thisHeight - 2 * borderWidth, 0);\n content.culling = true;\n content.setShape({\n x: borderWidth,\n y: borderWidth,\n width: contentWidth,\n height: contentHeight\n });\n\n if (thisInvisible) {\n // If invisible, do not set visual, otherwise the element will\n // change immediately before animation. We think it is OK to\n // remain its origin color when moving out of the view window.\n processInvisible(content);\n } else {\n content.invisible = false;\n var visualColor = thisNode.getVisual('color', true);\n var normalStyle = getItemStyleNormal(itemStyleNormalModel);\n normalStyle.fill = visualColor;\n var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);\n prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight);\n content.setStyle(normalStyle);\n graphic.setElementHoverStyle(content, emphasisStyle);\n }\n\n group.add(content);\n }\n\n function processInvisible(element) {\n // Delay invisible setting utill animation finished,\n // avoid element vanish suddenly before animation.\n !element.invisible && willInvisibleEls.push(element);\n }\n\n function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {\n var defaultText = nodeModel.get('name');\n var normalLabelModel = nodeModel.getModel(upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL);\n var emphasisLabelModel = nodeModel.getModel(upperLabelRect ? PATH_UPPERLABEL_EMPHASIS : PATH_LABEL_EMPHASIS);\n var isShow = normalLabelModel.getShallow('show');\n graphic.setLabelStyle(normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel, {\n defaultText: isShow ? defaultText : null,\n autoColor: visualColor,\n isRectText: true,\n labelFetcher: seriesModel,\n labelDataIndex: thisNode.dataIndex,\n labelProp: upperLabelRect ? 'upperLabel' : 'label'\n });\n addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);\n addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);\n upperLabelRect && (normalStyle.textRect = zrUtil.clone(upperLabelRect));\n normalStyle.truncate = isShow && normalLabelModel.get('ellipsis') ? {\n outerWidth: width,\n outerHeight: height,\n minChar: 2\n } : null;\n }\n\n function addDrillDownIcon(style, upperLabelRect, thisLayout) {\n var text = style.text;\n\n if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {\n var iconChar = seriesModel.get('drillDownIcon', true);\n style.text = iconChar ? iconChar + ' ' + text : text;\n }\n }\n\n function giveGraphic(storageName, Ctor, depth, z) {\n var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];\n var lasts = lastsForAnimation[storageName];\n\n if (element) {\n // Remove from oldStorage\n oldStorage[storageName][oldRawIndex] = null;\n prepareAnimationWhenHasOld(lasts, element, storageName);\n } // If invisible and no old element, do not create new element (for optimizing).\n else if (!thisInvisible) {\n element = new Ctor({\n z: calculateZ(depth, z)\n });\n element.__tmDepth = depth;\n element.__tmStorageName = storageName;\n prepareAnimationWhenNoOld(lasts, element, storageName);\n } // Set to thisStorage\n\n\n return thisStorage[storageName][thisRawIndex] = element;\n }\n\n function prepareAnimationWhenHasOld(lasts, element, storageName) {\n var lastCfg = lasts[thisRawIndex] = {};\n lastCfg.old = storageName === 'nodeGroup' ? element.position.slice() : zrUtil.extend({}, element.shape);\n } // If a element is new, we need to find the animation start point carefully,\n // otherwise it will looks strange when 'zoomToNode'.\n\n\n function prepareAnimationWhenNoOld(lasts, element, storageName) {\n var lastCfg = lasts[thisRawIndex] = {};\n var parentNode = thisNode.parentNode;\n\n if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) {\n var parentOldX = 0;\n var parentOldY = 0; // New nodes appear from right-bottom corner in 'zoomToNode' animation.\n // For convenience, get old bounding rect from background.\n\n var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()];\n\n if (!reRoot && parentOldBg && parentOldBg.old) {\n parentOldX = parentOldBg.old.width;\n parentOldY = parentOldBg.old.height;\n } // When no parent old shape found, its parent is new too,\n // so we can just use {x:0, y:0}.\n\n\n lastCfg.old = storageName === 'nodeGroup' ? [0, parentOldY] : {\n x: parentOldX,\n y: parentOldY,\n width: 0,\n height: 0\n };\n } // Fade in, user can be aware that these nodes are new.\n\n\n lastCfg.fadein = storageName !== 'nodeGroup';\n }\n} // We can not set all backgroud with the same z, Because the behaviour of\n// drill down and roll up differ background creation sequence from tree\n// hierarchy sequence, which cause that lowser background element overlap\n// upper ones. So we calculate z based on depth.\n// Moreover, we try to shrink down z interval to [0, 1] to avoid that\n// treemap with large z overlaps other components.\n\n\nfunction calculateZ(depth, zInLevel) {\n var zb = depth * Z_BASE + zInLevel;\n return (zb - 1) / zb;\n}\n\nmodule.exports = _default;","\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\nvar echarts = require(\"../../echarts\");\n\nvar helper = require(\"../helper/treeHelper\");\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 * @file Treemap action\n */\nvar noop = function () {};\n\nvar actionTypes = ['treemapZoomToNode', 'treemapRender', 'treemapMove'];\n\nfor (var i = 0; i < actionTypes.length; i++) {\n echarts.registerAction({\n type: actionTypes[i],\n update: 'updateView'\n }, noop);\n}\n\necharts.registerAction({\n type: 'treemapRootToNode',\n update: 'updateView'\n}, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series',\n subType: 'treemap',\n query: payload\n }, handleRootToNode);\n\n function handleRootToNode(model, index) {\n var types = ['treemapZoomToNode', 'treemapRootToNode'];\n var targetInfo = helper.retrieveTargetInfo(payload, types, model);\n\n if (targetInfo) {\n var originViewRoot = model.getViewRoot();\n\n if (originViewRoot) {\n payload.direction = helper.aboveViewRoot(originViewRoot, targetInfo.node) ? 'rollUp' : 'drillDown';\n }\n\n model.resetViewRoot(targetInfo.node);\n }\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*/\n\nvar zrUtil = require(\"zrender/lib/core/util\");\n\nvar BoundingRect = require(\"zrender/lib/core/BoundingRect\");\n\nvar _number = require(\"../../util/number\");\n\nvar parsePercent = _number.parsePercent;\nvar MAX_SAFE_INTEGER = _number.MAX_SAFE_INTEGER;\n\nvar layout = require(\"../../util/layout\");\n\nvar helper = require(\"../helper/treeHelper\");\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* A third-party license is embeded for some of the code in this file:\n* The treemap layout implementation was originally copied from\n* \"d3.js\" with some modifications made for this project.\n* (See more details in the comment of the method \"squarify\" below.)\n* The use of the source code of this file is also subject to the terms\n* and consitions of the license of \"d3.js\" (BSD-3Clause, see\n* ).\n*/\nvar mathMax = Math.max;\nvar mathMin = Math.min;\nvar retrieveValue = zrUtil.retrieve;\nvar each = zrUtil.each;\nvar PATH_BORDER_WIDTH = ['itemStyle', 'borderWidth'];\nvar PATH_GAP_WIDTH = ['itemStyle', 'gapWidth'];\nvar PATH_UPPER_LABEL_SHOW = ['upperLabel', 'show'];\nvar PATH_UPPER_LABEL_HEIGHT = ['upperLabel', 'height'];\n/**\n * @public\n */\n\nvar _default = {\n seriesType: 'treemap',\n reset: function (seriesModel, ecModel, api, payload) {\n // Layout result in each node:\n // {x, y, width, height, area, borderWidth}\n var ecWidth = api.getWidth();\n var ecHeight = api.getHeight();\n var seriesOption = seriesModel.option;\n var layoutInfo = layout.getLayoutRect(seriesModel.getBoxLayoutParams(), {\n width: api.getWidth(),\n height: api.getHeight()\n });\n var size = seriesOption.size || []; // Compatible with ec2.\n\n var containerWidth = parsePercent(retrieveValue(layoutInfo.width, size[0]), ecWidth);\n var containerHeight = parsePercent(retrieveValue(layoutInfo.height, size[1]), ecHeight); // Fetch payload info.\n\n var payloadType = payload && payload.type;\n var types = ['treemapZoomToNode', 'treemapRootToNode'];\n var targetInfo = helper.retrieveTargetInfo(payload, types, seriesModel);\n var rootRect = payloadType === 'treemapRender' || payloadType === 'treemapMove' ? payload.rootRect : null;\n var viewRoot = seriesModel.getViewRoot();\n var viewAbovePath = helper.getPathToRoot(viewRoot);\n\n if (payloadType !== 'treemapMove') {\n var rootSize = payloadType === 'treemapZoomToNode' ? estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) : rootRect ? [rootRect.width, rootRect.height] : [containerWidth, containerHeight];\n var sort = seriesOption.sort;\n\n if (sort && sort !== 'asc' && sort !== 'desc') {\n sort = 'desc';\n }\n\n var options = {\n squareRatio: seriesOption.squareRatio,\n sort: sort,\n leafDepth: seriesOption.leafDepth\n }; // layout should be cleared because using updateView but not update.\n\n viewRoot.hostTree.clearLayouts(); // TODO\n // optimize: if out of view clip, do not layout.\n // But take care that if do not render node out of view clip,\n // how to calculate start po\n\n var viewRootLayout = {\n x: 0,\n y: 0,\n width: rootSize[0],\n height: rootSize[1],\n area: rootSize[0] * rootSize[1]\n };\n viewRoot.setLayout(viewRootLayout);\n squarify(viewRoot, options, false, 0); // Supplement layout.\n\n var viewRootLayout = viewRoot.getLayout();\n each(viewAbovePath, function (node, index) {\n var childValue = (viewAbovePath[index + 1] || viewRoot).getValue();\n node.setLayout(zrUtil.extend({\n dataExtent: [childValue, childValue],\n borderWidth: 0,\n upperHeight: 0\n }, viewRootLayout));\n });\n }\n\n var treeRoot = seriesModel.getData().tree.root;\n treeRoot.setLayout(calculateRootPosition(layoutInfo, rootRect, targetInfo), true);\n seriesModel.setLayoutInfo(layoutInfo); // FIXME\n // 现在没有clip功能,暂时取ec高宽。\n\n prunning(treeRoot, // Transform to base element coordinate system.\n new BoundingRect(-layoutInfo.x, -layoutInfo.y, ecWidth, ecHeight), viewAbovePath, viewRoot, 0);\n }\n};\n/**\n * Layout treemap with squarify algorithm.\n * The original presentation of this algorithm\n * was made by Mark Bruls, Kees Huizing, and Jarke J. van Wijk\n * .\n * The implementation of this algorithm was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n *\n * @protected\n * @param {module:echarts/data/Tree~TreeNode} node\n * @param {Object} options\n * @param {string} options.sort 'asc' or 'desc'\n * @param {number} options.squareRatio\n * @param {boolean} hideChildren\n * @param {number} depth\n */\n\nfunction squarify(node, options, hideChildren, depth) {\n var width;\n var height;\n\n if (node.isRemoved()) {\n return;\n }\n\n var thisLayout = node.getLayout();\n width = thisLayout.width;\n height = thisLayout.height; // Considering border and gap\n\n var nodeModel = node.getModel();\n var borderWidth = nodeModel.get(PATH_BORDER_WIDTH);\n var halfGapWidth = nodeModel.get(PATH_GAP_WIDTH) / 2;\n var upperLabelHeight = getUpperLabelHeight(nodeModel);\n var upperHeight = Math.max(borderWidth, upperLabelHeight);\n var layoutOffset = borderWidth - halfGapWidth;\n var layoutOffsetUpper = upperHeight - halfGapWidth;\n var nodeModel = node.getModel();\n node.setLayout({\n borderWidth: borderWidth,\n upperHeight: upperHeight,\n upperLabelHeight: upperLabelHeight\n }, true);\n width = mathMax(width - 2 * layoutOffset, 0);\n height = mathMax(height - layoutOffset - layoutOffsetUpper, 0);\n var totalArea = width * height;\n var viewChildren = initChildren(node, nodeModel, totalArea, options, hideChildren, depth);\n\n if (!viewChildren.length) {\n return;\n }\n\n var rect = {\n x: layoutOffset,\n y: layoutOffsetUpper,\n width: width,\n height: height\n };\n var rowFixedLength = mathMin(width, height);\n var best = Infinity; // the best row score so far\n\n var row = [];\n row.area = 0;\n\n for (var i = 0, len = viewChildren.length; i < len;) {\n var child = viewChildren[i];\n row.push(child);\n row.area += child.getLayout().area;\n var score = worst(row, rowFixedLength, options.squareRatio); // continue with this orientation\n\n if (score <= best) {\n i++;\n best = score;\n } // abort, and try a different orientation\n else {\n row.area -= row.pop().getLayout().area;\n position(row, rowFixedLength, rect, halfGapWidth, false);\n rowFixedLength = mathMin(rect.width, rect.height);\n row.length = row.area = 0;\n best = Infinity;\n }\n }\n\n if (row.length) {\n position(row, rowFixedLength, rect, halfGapWidth, true);\n }\n\n if (!hideChildren) {\n var childrenVisibleMin = nodeModel.get('childrenVisibleMin');\n\n if (childrenVisibleMin != null && totalArea < childrenVisibleMin) {\n hideChildren = true;\n }\n }\n\n for (var i = 0, len = viewChildren.length; i < len; i++) {\n squarify(viewChildren[i], options, hideChildren, depth + 1);\n }\n}\n/**\n * Set area to each child, and calculate data extent for visual coding.\n */\n\n\nfunction initChildren(node, nodeModel, totalArea, options, hideChildren, depth) {\n var viewChildren = node.children || [];\n var orderBy = options.sort;\n orderBy !== 'asc' && orderBy !== 'desc' && (orderBy = null);\n var overLeafDepth = options.leafDepth != null && options.leafDepth <= depth; // leafDepth has higher priority.\n\n if (hideChildren && !overLeafDepth) {\n return node.viewChildren = [];\n } // Sort children, order by desc.\n\n\n viewChildren = zrUtil.filter(viewChildren, function (child) {\n return !child.isRemoved();\n });\n sort(viewChildren, orderBy);\n var info = statistic(nodeModel, viewChildren, orderBy);\n\n if (info.sum === 0) {\n return node.viewChildren = [];\n }\n\n info.sum = filterByThreshold(nodeModel, totalArea, info.sum, orderBy, viewChildren);\n\n if (info.sum === 0) {\n return node.viewChildren = [];\n } // Set area to each child.\n\n\n for (var i = 0, len = viewChildren.length; i < len; i++) {\n var area = viewChildren[i].getValue() / info.sum * totalArea; // Do not use setLayout({...}, true), because it is needed to clear last layout.\n\n viewChildren[i].setLayout({\n area: area\n });\n }\n\n if (overLeafDepth) {\n viewChildren.length && node.setLayout({\n isLeafRoot: true\n }, true);\n viewChildren.length = 0;\n }\n\n node.viewChildren = viewChildren;\n node.setLayout({\n dataExtent: info.dataExtent\n }, true);\n return viewChildren;\n}\n/**\n * Consider 'visibleMin'. Modify viewChildren and get new sum.\n */\n\n\nfunction filterByThreshold(nodeModel, totalArea, sum, orderBy, orderedChildren) {\n // visibleMin is not supported yet when no option.sort.\n if (!orderBy) {\n return sum;\n }\n\n var visibleMin = nodeModel.get('visibleMin');\n var len = orderedChildren.length;\n var deletePoint = len; // Always travel from little value to big value.\n\n for (var i = len - 1; i >= 0; i--) {\n var value = orderedChildren[orderBy === 'asc' ? len - i - 1 : i].getValue();\n\n if (value / sum * totalArea < visibleMin) {\n deletePoint = i;\n sum -= value;\n }\n }\n\n orderBy === 'asc' ? orderedChildren.splice(0, len - deletePoint) : orderedChildren.splice(deletePoint, len - deletePoint);\n return sum;\n}\n/**\n * Sort\n */\n\n\nfunction sort(viewChildren, orderBy) {\n if (orderBy) {\n viewChildren.sort(function (a, b) {\n var diff = orderBy === 'asc' ? a.getValue() - b.getValue() : b.getValue() - a.getValue();\n return diff === 0 ? orderBy === 'asc' ? a.dataIndex - b.dataIndex : b.dataIndex - a.dataIndex : diff;\n });\n }\n\n return viewChildren;\n}\n/**\n * Statistic\n */\n\n\nfunction statistic(nodeModel, children, orderBy) {\n // Calculate sum.\n var sum = 0;\n\n for (var i = 0, len = children.length; i < len; i++) {\n sum += children[i].getValue();\n } // Statistic data extent for latter visual coding.\n // Notice: data extent should be calculate based on raw children\n // but not filtered view children, otherwise visual mapping will not\n // be stable when zoom (where children is filtered by visibleMin).\n\n\n var dimension = nodeModel.get('visualDimension');\n var dataExtent; // The same as area dimension.\n\n if (!children || !children.length) {\n dataExtent = [NaN, NaN];\n } else if (dimension === 'value' && orderBy) {\n dataExtent = [children[children.length - 1].getValue(), children[0].getValue()];\n orderBy === 'asc' && dataExtent.reverse();\n } // Other dimension.\n else {\n var dataExtent = [Infinity, -Infinity];\n each(children, function (child) {\n var value = child.getValue(dimension);\n value < dataExtent[0] && (dataExtent[0] = value);\n value > dataExtent[1] && (dataExtent[1] = value);\n });\n }\n\n return {\n sum: sum,\n dataExtent: dataExtent\n };\n}\n/**\n * Computes the score for the specified row,\n * as the worst aspect ratio.\n */\n\n\nfunction worst(row, rowFixedLength, ratio) {\n var areaMax = 0;\n var areaMin = Infinity;\n\n for (var i = 0, area, len = row.length; i < len; i++) {\n area = row[i].getLayout().area;\n\n if (area) {\n area < areaMin && (areaMin = area);\n area > areaMax && (areaMax = area);\n }\n }\n\n var squareArea = row.area * row.area;\n var f = rowFixedLength * rowFixedLength * ratio;\n return squareArea ? mathMax(f * areaMax / squareArea, squareArea / (f * areaMin)) : Infinity;\n}\n/**\n * Positions the specified row of nodes. Modifies `rect`.\n */\n\n\nfunction position(row, rowFixedLength, rect, halfGapWidth, flush) {\n // When rowFixedLength === rect.width,\n // it is horizontal subdivision,\n // rowFixedLength is the width of the subdivision,\n // rowOtherLength is the height of the subdivision,\n // and nodes will be positioned from left to right.\n // wh[idx0WhenH] means: when horizontal,\n // wh[idx0WhenH] => wh[0] => 'width'.\n // xy[idx1WhenH] => xy[1] => 'y'.\n var idx0WhenH = rowFixedLength === rect.width ? 0 : 1;\n var idx1WhenH = 1 - idx0WhenH;\n var xy = ['x', 'y'];\n var wh = ['width', 'height'];\n var last = rect[xy[idx0WhenH]];\n var rowOtherLength = rowFixedLength ? row.area / rowFixedLength : 0;\n\n if (flush || rowOtherLength > rect[wh[idx1WhenH]]) {\n rowOtherLength = rect[wh[idx1WhenH]]; // over+underflow\n }\n\n for (var i = 0, rowLen = row.length; i < rowLen; i++) {\n var node = row[i];\n var nodeLayout = {};\n var step = rowOtherLength ? node.getLayout().area / rowOtherLength : 0;\n var wh1 = nodeLayout[wh[idx1WhenH]] = mathMax(rowOtherLength - 2 * halfGapWidth, 0); // We use Math.max/min to avoid negative width/height when considering gap width.\n\n var remain = rect[xy[idx0WhenH]] + rect[wh[idx0WhenH]] - last;\n var modWH = i === rowLen - 1 || remain < step ? remain : step;\n var wh0 = nodeLayout[wh[idx0WhenH]] = mathMax(modWH - 2 * halfGapWidth, 0);\n nodeLayout[xy[idx1WhenH]] = rect[xy[idx1WhenH]] + mathMin(halfGapWidth, wh1 / 2);\n nodeLayout[xy[idx0WhenH]] = last + mathMin(halfGapWidth, wh0 / 2);\n last += modWH;\n node.setLayout(nodeLayout, true);\n }\n\n rect[xy[idx1WhenH]] += rowOtherLength;\n rect[wh[idx1WhenH]] -= rowOtherLength;\n} // Return [containerWidth, containerHeight] as default.\n\n\nfunction estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) {\n // If targetInfo.node exists, we zoom to the node,\n // so estimate whold width and heigth by target node.\n var currNode = (targetInfo || {}).node;\n var defaultSize = [containerWidth, containerHeight];\n\n if (!currNode || currNode === viewRoot) {\n return defaultSize;\n }\n\n var parent;\n var viewArea = containerWidth * containerHeight;\n var area = viewArea * seriesModel.option.zoomToNodeRatio;\n\n while (parent = currNode.parentNode) {\n // jshint ignore:line\n var sum = 0;\n var siblings = parent.children;\n\n for (var i = 0, len = siblings.length; i < len; i++) {\n sum += siblings[i].getValue();\n }\n\n var currNodeValue = currNode.getValue();\n\n if (currNodeValue === 0) {\n return defaultSize;\n }\n\n area *= sum / currNodeValue; // Considering border, suppose aspect ratio is 1.\n\n var parentModel = parent.getModel();\n var borderWidth = parentModel.get(PATH_BORDER_WIDTH);\n var upperHeight = Math.max(borderWidth, getUpperLabelHeight(parentModel, borderWidth));\n area += 4 * borderWidth * borderWidth + (3 * borderWidth + upperHeight) * Math.pow(area, 0.5);\n area > MAX_SAFE_INTEGER && (area = MAX_SAFE_INTEGER);\n currNode = parent;\n }\n\n area < viewArea && (area = viewArea);\n var scale = Math.pow(area / viewArea, 0.5);\n return [containerWidth * scale, containerHeight * scale];\n} // Root postion base on coord of containerGroup\n\n\nfunction calculateRootPosition(layoutInfo, rootRect, targetInfo) {\n if (rootRect) {\n return {\n x: rootRect.x,\n y: rootRect.y\n };\n }\n\n var defaultPosition = {\n x: 0,\n y: 0\n };\n\n if (!targetInfo) {\n return defaultPosition;\n } // If targetInfo is fetched by 'retrieveTargetInfo',\n // old tree and new tree are the same tree,\n // so the node still exists and we can visit it.\n\n\n var targetNode = targetInfo.node;\n var layout = targetNode.getLayout();\n\n if (!layout) {\n return defaultPosition;\n } // Transform coord from local to container.\n\n\n var targetCenter = [layout.width / 2, layout.height / 2];\n var node = targetNode;\n\n while (node) {\n var nodeLayout = node.getLayout();\n targetCenter[0] += nodeLayout.x;\n targetCenter[1] += nodeLayout.y;\n node = node.parentNode;\n }\n\n return {\n x: layoutInfo.width / 2 - targetCenter[0],\n y: layoutInfo.height / 2 - targetCenter[1]\n };\n} // Mark nodes visible for prunning when visual coding and rendering.\n// Prunning depends on layout and root position, so we have to do it after layout.\n\n\nfunction prunning(node, clipRect, viewAbovePath, viewRoot, depth) {\n var nodeLayout = node.getLayout();\n var nodeInViewAbovePath = viewAbovePath[depth];\n var isAboveViewRoot = nodeInViewAbovePath && nodeInViewAbovePath === node;\n\n if (nodeInViewAbovePath && !isAboveViewRoot || depth === viewAbovePath.length && node !== viewRoot) {\n return;\n }\n\n node.setLayout({\n // isInView means: viewRoot sub tree + viewAbovePath\n isInView: true,\n // invisible only means: outside view clip so that the node can not\n // see but still layout for animation preparation but not render.\n invisible: !isAboveViewRoot && !clipRect.intersect(nodeLayout),\n isAboveViewRoot: isAboveViewRoot\n }, true); // Transform to child coordinate.\n\n var childClipRect = new BoundingRect(clipRect.x - nodeLayout.x, clipRect.y - nodeLayout.y, clipRect.width, clipRect.height);\n each(node.viewChildren || [], function (child) {\n prunning(child, childClipRect, viewAbovePath, viewRoot, depth + 1);\n });\n}\n\nfunction getUpperLabelHeight(model) {\n return model.get(PATH_UPPER_LABEL_SHOW) ? model.get(PATH_UPPER_LABEL_HEIGHT) : 0;\n}\n\nmodule.exports = _default;","\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\nvar VisualMapping = require(\"../../visual/VisualMapping\");\n\nvar zrColor = require(\"zrender/lib/tool/color\");\n\nvar zrUtil = require(\"zrender/lib/core/util\");\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*/\nvar isArray = zrUtil.isArray;\nvar ITEM_STYLE_NORMAL = 'itemStyle';\nvar _default = {\n seriesType: 'treemap',\n reset: function (seriesModel, ecModel, api, payload) {\n var tree = seriesModel.getData().tree;\n var root = tree.root;\n\n if (root.isRemoved()) {\n return;\n }\n\n travelTree(root, // Visual should calculate from tree root but not view root.\n {}, seriesModel.getViewRoot().getAncestors(), seriesModel);\n }\n};\n\nfunction travelTree(node, designatedVisual, viewRootAncestors, seriesModel) {\n var nodeModel = node.getModel();\n var nodeLayout = node.getLayout(); // Optimize\n\n if (!nodeLayout || nodeLayout.invisible || !nodeLayout.isInView) {\n return;\n }\n\n var nodeItemStyleModel = node.getModel(ITEM_STYLE_NORMAL);\n var visuals = buildVisuals(nodeItemStyleModel, designatedVisual, seriesModel); // calculate border color\n\n var borderColor = nodeItemStyleModel.get('borderColor');\n var borderColorSaturation = nodeItemStyleModel.get('borderColorSaturation');\n var thisNodeColor;\n\n if (borderColorSaturation != null) {\n // For performance, do not always execute 'calculateColor'.\n thisNodeColor = calculateColor(visuals, node);\n borderColor = calculateBorderColor(borderColorSaturation, thisNodeColor);\n }\n\n node.setVisual('borderColor', borderColor);\n var viewChildren = node.viewChildren;\n\n if (!viewChildren || !viewChildren.length) {\n thisNodeColor = calculateColor(visuals, node); // Apply visual to this node.\n\n node.setVisual('color', thisNodeColor);\n } else {\n var mapping = buildVisualMapping(node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren); // Designate visual to children.\n\n zrUtil.each(viewChildren, function (child, index) {\n // If higher than viewRoot, only ancestors of viewRoot is needed to visit.\n if (child.depth >= viewRootAncestors.length || child === viewRootAncestors[child.depth]) {\n var childVisual = mapVisual(nodeModel, visuals, child, index, mapping, seriesModel);\n travelTree(child, childVisual, viewRootAncestors, seriesModel);\n }\n });\n }\n}\n\nfunction buildVisuals(nodeItemStyleModel, designatedVisual, seriesModel) {\n var visuals = zrUtil.extend({}, designatedVisual);\n var designatedVisualItemStyle = seriesModel.designatedVisualItemStyle;\n zrUtil.each(['color', 'colorAlpha', 'colorSaturation'], function (visualName) {\n // Priority: thisNode > thisLevel > parentNodeDesignated > seriesModel\n designatedVisualItemStyle[visualName] = designatedVisual[visualName];\n var val = nodeItemStyleModel.get(visualName);\n designatedVisualItemStyle[visualName] = null;\n val != null && (visuals[visualName] = val);\n });\n return visuals;\n}\n\nfunction calculateColor(visuals) {\n var color = getValueVisualDefine(visuals, 'color');\n\n if (color) {\n var colorAlpha = getValueVisualDefine(visuals, 'colorAlpha');\n var colorSaturation = getValueVisualDefine(visuals, 'colorSaturation');\n\n if (colorSaturation) {\n color = zrColor.modifyHSL(color, null, null, colorSaturation);\n }\n\n if (colorAlpha) {\n color = zrColor.modifyAlpha(color, colorAlpha);\n }\n\n return color;\n }\n}\n\nfunction calculateBorderColor(borderColorSaturation, thisNodeColor) {\n return thisNodeColor != null ? zrColor.modifyHSL(thisNodeColor, null, null, borderColorSaturation) : null;\n}\n\nfunction getValueVisualDefine(visuals, name) {\n var value = visuals[name];\n\n if (value != null && value !== 'none') {\n return value;\n }\n}\n\nfunction buildVisualMapping(node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren) {\n if (!viewChildren || !viewChildren.length) {\n return;\n }\n\n var rangeVisual = getRangeVisual(nodeModel, 'color') || visuals.color != null && visuals.color !== 'none' && (getRangeVisual(nodeModel, 'colorAlpha') || getRangeVisual(nodeModel, 'colorSaturation'));\n\n if (!rangeVisual) {\n return;\n }\n\n var visualMin = nodeModel.get('visualMin');\n var visualMax = nodeModel.get('visualMax');\n var dataExtent = nodeLayout.dataExtent.slice();\n visualMin != null && visualMin < dataExtent[0] && (dataExtent[0] = visualMin);\n visualMax != null && visualMax > dataExtent[1] && (dataExtent[1] = visualMax);\n var colorMappingBy = nodeModel.get('colorMappingBy');\n var opt = {\n type: rangeVisual.name,\n dataExtent: dataExtent,\n visual: rangeVisual.range\n };\n\n if (opt.type === 'color' && (colorMappingBy === 'index' || colorMappingBy === 'id')) {\n opt.mappingMethod = 'category';\n opt.loop = true; // categories is ordinal, so do not set opt.categories.\n } else {\n opt.mappingMethod = 'linear';\n }\n\n var mapping = new VisualMapping(opt);\n mapping.__drColorMappingBy = colorMappingBy;\n return mapping;\n} // Notice: If we dont have the attribute 'colorRange', but only use\n// attribute 'color' to represent both concepts of 'colorRange' and 'color',\n// (It means 'colorRange' when 'color' is Array, means 'color' when not array),\n// this problem will be encountered:\n// If a level-1 node dont have children, and its siblings has children,\n// and colorRange is set on level-1, then the node can not be colored.\n// So we separate 'colorRange' and 'color' to different attributes.\n\n\nfunction getRangeVisual(nodeModel, name) {\n // 'colorRange', 'colorARange', 'colorSRange'.\n // If not exsits on this node, fetch from levels and series.\n var range = nodeModel.get(name);\n return isArray(range) && range.length ? {\n name: name,\n range: range\n } : null;\n}\n\nfunction mapVisual(nodeModel, visuals, child, index, mapping, seriesModel) {\n var childVisuals = zrUtil.extend({}, visuals);\n\n if (mapping) {\n var mappingType = mapping.type;\n var colorMappingBy = mappingType === 'color' && mapping.__drColorMappingBy;\n var value = colorMappingBy === 'index' ? index : colorMappingBy === 'id' ? seriesModel.mapIdToIndex(child.getId()) : child.getValue(nodeModel.get('visualDimension'));\n childVisuals[mappingType] = mapping.mapValueToVisual(value);\n }\n\n return childVisuals;\n}\n\nmodule.exports = _default;"],"names":["echarts","zrUtil","dataColor","sunburstLayout","dataFilter","registerVisual","curry","registerLayout","registerProcessor","graphic","NodeHighlightPolicy","NONE","DESCENDANT","ANCESTOR","SELF","DEFAULT_SECTOR_Z","DEFAULT_TEXT_Z","SunburstPiece","node","seriesModel","ecModel","Group","call","this","sector","Sector","z2","seriesIndex","text","Text","silent","getModel","get","onEmphasis","ignore","hoverIgnore","onNormal","normalIgnore","add","updateData","on","SunburstPieceProto","prototype","firstCreate","state","piece","_seriesModel","_ecModel","childAt","dataIndex","itemModel","layout","getLayout","sectorShape","extend","label","visualColor","getNodeColor","fillDefaultColor","style","normalStyle","getItemStyle","stateStyle","merge","defaults","lineJoin","fill","setShape","shape","r","r0","updateProps","useStyle","type","_updateLabel","cursorStyle","getShallow","attr","highlightPolicy","_initEvents","setHoverStyle","that","hostTree","root","eachNode","n","isNodeHighlighted","trigger","onHighlight","onDownplay","normalModel","labelModel","labelHoverModel","labelFormatter","labelState","retrieve","getFormattedLabel","name","getLabelAttr","labelMinAngle","Math","PI","angle","endAngle","startAngle","abs","setLabelStyle","hoverStyle","defaultText","autoColor","useInsideStyle","midAngle","dx","cos","dy","sin","labelPosition","labelPadding","textAlign","textVerticalAlign","opacity","textX","cx","textY","cy","rotateType","rotate","stateAttr","off","isAnimationEnabled","inherits","_default","getVisual","visualMetaList","length","color","depth","option","getRootId","ancestor","parentNode","virtualRoot","getAncestors","indexOf","children","activeNode","policy","isAncestorOf","isDescendantOf","data","getData","setItemVisual","module","exports","SeriesModel","Tree","Model","_treeHelper","wrapTreePathInfo","_viewRoot","getInitialData","completeTreeValue","levelModels","map","levels","levelDefine","tree","createTree","beforeLink","nodeData","wrapMethod","model","idx","getNodeByDataIndex","levelModel","parentModel","optionUpdated","resetViewRoot","getDataParams","params","apply","arguments","treePathInfo","defaultOption","zlevel","z","center","radius","clockwise","minAngle","percentPrecision","stillShowZeroSum","nodeClick","renderLabelForZeroData","show","align","position","distance","itemStyle","borderWidth","borderColor","borderType","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","highlight","downplay","animationType","animationDuration","animationDurationUpdate","animationEasing","sort","getViewRoot","viewRoot","getRawData","contains","dataNode","sum","each","child","childValue","value","isArray","thisValue","isNaN","ChartView","DataDiffer","_format","windowOpen","ROOT_TO_NODE_ACTION","SunburstView","init","render","api","payload","newRoot","group","newChildren","push","oldChildren","_oldChildren","dualTravel","renderRollUp","unhighlight","virtualPiece","getKey","getId","processNode","newId","oldId","newNode","oldNode","doRenderNode","update","remove","execute","getValue","setItemGraphicEl","removeNode","_onclickEvent","event","e","_rootToNode","dispose","targetFound","target","link","linkTarget","dispatchAction","from","uid","seriesId","id","targetNode","containPoint","point","treeRoot","itemLayout","getItemLayout","sqrt","helper","registerAction","handleRootToNode","index","targetInfo","retrieveTargetInfo","originViewRoot","direction","aboveViewRoot","eachComponent","mainType","subType","query","HIGHLIGHT_ACTION","handleHighlight","UNHIGHLIGHT_ACTION","handleUnhighlight","_number","parsePercent","RADIAN","seriesType","eachSeriesByType","width","getWidth","height","getHeight","size","min","rootDepth","initChildren","validDataCount","unitRadian","renderRollupNode","rPerLevel","dir","renderNode","rStart","rEnd","setLayout","siblingAngle","isAsc","sortOrder","a","b","diff","themeRiverLayout","themeRiverVisual","createDimensions","_dimensionHelper","getDimensionTypeByAxis","List","_model","groupData","encodeHTML","LegendVisualProvider","DATA_NAME_INDEX","ThemeRiverSeries","dependencies","nameMap","superApply","legendVisualProvider","bind","fixData","rawDataLength","timeValueKeys","groupResult","item","hasOwnProperty","layData","buckets","items","key","dataList","layerNum","k","j","timeValue","singleAxisModel","queryComponents","axisType","filterData","filter","dataItem","undefined","nameList","createHashMap","count","i","set","dimensionsInfo","coordDimensions","dimensionsDefine","encodeDefine","single","itemName","list","initData","getLayerSeries","lenCount","indexArr","timeDim","mapDimension","layerSeries","index1","index2","indices","getAxisTooltipData","dim","baseAxis","nestestValue","minDist","Number","MAX_VALUE","nearestIdx","pointNum","theValue","dist","dataIndices","formatTooltip","htmlName","getName","htmlValue","coordinateSystem","boundaryGap","singleAxisIndex","margin","fontSize","emphasis","_poly","Polygon","_util","extendChartView","_layers","layoutInfo","rect","keyGetter","y","dataDiffer","_layersSeries","newLayersGroups","process","status","oldIdx","oldLayersGroups","polygon","points0","points1","x","y0","getItemVisual","textLayout","getItemModel","layerGroup","points","stackedOnPoints","smooth","stackedOnSmooth","smoothConstraint","setClipPath","createGridClipShape","getBoundingRect","removeClipPath","hoverItemStyleModel","itemStyleModel","setTextStyle","setStyle","cb","rectEl","Rect","initProps","numberUtil","getRect","axis","getAxis","orient","baseY0","coordSys","valueDim","layerPoints","singleLayer","pt","dataToPoint","base","computeBaseline","baseLine","ky","max","m","setItemLayout","layerIndex","sums","temp","l","rawData","colorList","idxMap","getRawIndex","rawIndex","visualSymbol","treeLayout","layoutMode","leaves","leavesModel","isExpand","treeDepth","expandAndCollapse","expandTreeDepth","initialTreeDepth","getRawDataItem","collapsed","getOrient","setZoom","zoom","setCenter","realRoot","left","top","right","bottom","edgeShape","edgeForkPosition","roam","nodeScaleRatio","symbol","symbolSize","lineStyle","curveness","SymbolClz","_layoutHelper","radialCoordinate","bbox","View","roamHelper","RoamController","_cursorHelper","onIrrelevantElement","_config","__DEV__","TreeShape","extendShape","parentPoint","childPoints","forkPosition","stroke","buildPath","ctx","childLen","firstChildPos","lastChildPos","moveTo","lineTo","forkDim","otherDim","tmpPoint","_oldTree","_mainGroup","_controller","getZr","_controllerHost","_updateViewCoordSys","_updateController","oldData","_data","seriesScope","curvature","symbolRotate","symbolOffset","hoverAnimation","useNameLabel","fadeIn","newIdx","symbolNeedsDraw","updateNode","symbolEl","getItemGraphicEl","_nodeScaleRatio","_updateNodeAndLinkScale","eachItemGraphicEl","el","fromPoints","oldMin","_min","oldMax","_max","viewCoordSys","zoomLimit","setBoundingRect","scale","_viewCoordSys","controller","controllerHost","setPointerChecker","applyTransform","transform","contain","enable","getZoom","updateViewOnPan","updateViewOnZoom","originX","originY","nodeScale","_getNodeGlobalScale","invScale","groupScale","groupZoom","roamZoom","removeAll","getTreeNodeStyle","hoverItemStyle","getLineStyle","hoverLabelModel","symbolInnerColor","isInit","source","sourceSymbolEl","sourceLayout","sourceOldLayout","rawX","__radialOldRawX","rawY","__radialOldRawY","targetLayout","__radialRawX","__radialRawY","symbolPath","getSymbolPath","rad","isLeft","rootLayout","atan2","textPosition","labelRotateRadian","textRotation","textOrigin","verticalAlign","drawEdge","edge","__edge","BezierCurve","getEdgeShape","strokeNoScale","childLayout","fadeOut","keepLabel","sourceEdge","cpx1","cpy1","cpx2","cpy2","x1","x2","y1","y2","radialCoor1","radialCoor2","radialCoor3","radialCoor4","hierNode","defaultAncestor","prelim","modifier","change","shift","thread","nodes","pop","firstWalk","separation","siblings","subtreeW","executeShifts","midPoint","apportion","secondWalk","nodeX","defaultSeparation","radialCoor","getViewRect","getLayoutRect","getBoxLayoutParams","subtreeV","nodeOutRight","nodeInRight","nodeOutLeft","nodeInLeft","sumOutRight","sumInRight","sumOutLeft","sumInLeft","nextRight","nextLeft","moveSubtree","nextAncestor","wl","wr","node1","node2","eachAfter","callback","next","eachBefore","_roamHelper","updateCenterAndZoom","res","_traversalHelper","sep","commonLayout","delta","tx","kx","coorX","coorY","finalCoor","treemapVisual","treemapLayout","TEXT_PADDING","ITEM_GAP","ARRAY_LENGTH","Breadcrumb","containerGroup","makeItemPoints","itemWidth","itemHeight","head","tail","splice","packEventData","itemNode","eventData","componentType","componentSubType","componentIndex","seriesName","selfType","constructor","onSelect","thisGroup","normalStyleModel","textStyleModel","layoutParam","pos","box","emptyItemWidth","totalWidth","renderList","_prepare","_renderContent","positionElement","textRect","getTextRect","lastX","availableSize","getAvailableSize","textFill","getTextColor","textFont","getFont","onclick","addCommas","preventUsingHoverLayer","progressive","clipWindow","squareRatio","leafDepth","drillDownIcon","zoomToNodeRatio","animation","breadcrumb","textStyle","padding","ellipsis","upperLabel","colorAlpha","colorSaturation","gapWidth","borderColorSaturation","visualDimension","visualMin","visualMax","colorMappingBy","visibleMin","childrenVisibleMin","designatedVisualItemStyle","designatedVisualModel","setDefault","getRawValue","formattedValue","setLayoutInfo","mapIdToIndex","idIndexMap","_idIndexMap","_idIndexMapCount","globalColorList","hasColorDefine","modelColor","level0","slice","BoundingRect","matrix","animationUtil","makeStyleMapper","DRAG_THRESHOLD","PATH_LABEL_NOAMAL","PATH_LABEL_EMPHASIS","PATH_UPPERLABEL_NORMAL","PATH_UPPERLABEL_EMPHASIS","Z_BASE","Z_BG","Z_CONTENT","getItemStyleEmphasis","getItemStyleNormal","lineWidth","o","_containerGroup","_storage","createStorage","_breadcrumb","_state","models","findComponents","types","payloadType","thisStorage","reRoot","rootNodeGroup","nodeGroup","_giveContainerGroup","renderResult","_doRender","renderFinally","_doAnimation","_resetController","_renderBreadcrumb","thisTree","oldTree","lastsForAnimation","oldStorage","willInvisibleEls","willDeleteEls","clearStorage","thisViewChildren","oldViewChildren","parentGroup","sameTree","newIndex","oldIndex","thisNode","viewChildren","isRemoved","storage","store","storageName","delEls","__tmWillDelete","els","parent","invisible","dirty","duration","easing","animationWrap","createWrap","__tmNodeWidth","__tmNodeHeight","targetX","targetY","last","old","fadein","done","start","_onPan","_onZoom","_clearController","rootRect","mouseX","mouseY","create","translate","findTarget","offsetX","offsetY","isLeafRoot","_zoomToNode","order","bgEl","background","transformCoordToLocal","content","thisLayout","isInView","thisWidth","thisHeight","thisInvisible","thisRawIndex","oldRawIndex","upperHeight","isParent","itemStyleNormalModel","itemStyleEmphasisModel","giveGraphic","isAboveViewRoot","nodeModel","bg","renderBackground","upperLabelHeight","isHighDownDispatcher","setAsHighDownDispatcher","renderContent","useUpperLabel","processInvisible","visualBorderColor","emphasisBorderColor","emphasisStyle","upperLabelWidth","prepareText","setElementHoverStyle","contentWidth","contentHeight","culling","element","upperLabelRect","normalLabelModel","emphasisLabelModel","isShow","isRectText","labelFetcher","labelDataIndex","labelProp","addDrillDownIcon","clone","truncate","outerWidth","outerHeight","minChar","iconChar","Ctor","lasts","prepareAnimationWhenHasOld","calculateZ","__tmDepth","__tmStorageName","prepareAnimationWhenNoOld","lastCfg","parentOldX","parentOldY","parentOldBg","zInLevel","zb","noop","actionTypes","MAX_SAFE_INTEGER","mathMax","mathMin","retrieveValue","PATH_BORDER_WIDTH","PATH_GAP_WIDTH","PATH_UPPER_LABEL_SHOW","PATH_UPPER_LABEL_HEIGHT","reset","ecWidth","ecHeight","seriesOption","containerWidth","containerHeight","viewAbovePath","getPathToRoot","rootSize","estimateRootSize","options","clearLayouts","viewRootLayout","area","squarify","dataExtent","calculateRootPosition","prunning","hideChildren","halfGapWidth","getUpperLabelHeight","layoutOffset","layoutOffsetUpper","totalArea","rowFixedLength","best","Infinity","row","len","score","worst","orderBy","overLeafDepth","info","statistic","filterByThreshold","orderedChildren","deletePoint","dimension","reverse","NaN","ratio","areaMax","areaMin","squareArea","f","flush","idx0WhenH","idx1WhenH","xy","wh","rowOtherLength","rowLen","nodeLayout","step","wh1","remain","modWH","wh0","currNode","defaultSize","viewArea","currNodeValue","pow","defaultPosition","targetCenter","clipRect","nodeInViewAbovePath","intersect","childClipRect","VisualMapping","zrColor","ITEM_STYLE_NORMAL","travelTree","designatedVisual","viewRootAncestors","thisNodeColor","nodeItemStyleModel","visuals","buildVisuals","calculateColor","calculateBorderColor","setVisual","mapping","buildVisualMapping","childVisual","mapVisual","visualName","val","getValueVisualDefine","modifyHSL","modifyAlpha","rangeVisual","getRangeVisual","opt","visual","range","mappingMethod","loop","__drColorMappingBy","childVisuals","mappingType","mapValueToVisual"],"sourceRoot":""}