|  |  | 
|  | <!-- | 
|  | Licensed to the Apache Software Foundation (ASF) under one | 
|  | or more contributor license agreements.  See the NOTICE file | 
|  | distributed with this work for additional information | 
|  | regarding copyright ownership.  The ASF licenses this file | 
|  | to you under the Apache License, Version 2.0 (the | 
|  | "License"); you may not use this file except in compliance | 
|  | with the License.  You may obtain a copy of the License at | 
|  |  | 
|  | http://www.apache.org/licenses/LICENSE-2.0 | 
|  |  | 
|  | Unless required by applicable law or agreed to in writing, | 
|  | software distributed under the License is distributed on an | 
|  | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
|  | KIND, either express or implied.  See the License for the | 
|  | specific language governing permissions and limitations | 
|  | under the License. | 
|  | --> | 
|  |  | 
|  | <html> | 
|  | <head> | 
|  | <meta charset="utf-8" /> | 
|  | <meta name="viewport" content="width=device-width, initial-scale=1" /> | 
|  | <script src="lib/simpleRequire.js"></script> | 
|  | <script src="lib/config.js"></script> | 
|  | <script src="lib/jquery.min.js"></script> | 
|  | <script src="lib/testHelper.js"></script> | 
|  | <link rel="stylesheet" href="lib/reset.css" /> | 
|  | </head> | 
|  | <body> | 
|  |  | 
|  | <div id="main0"></div> | 
|  | <div id="main1"></div> | 
|  |  | 
|  | <script> | 
|  | require([ | 
|  | 'echarts' | 
|  | ], function (echarts) { | 
|  |  | 
|  | window.onresize = function () { | 
|  | chart0.resize(); | 
|  | chart1.resize(); | 
|  | }; | 
|  |  | 
|  | var data = { | 
|  | "name": "flare", | 
|  | "value": 111, | 
|  | "children": [ | 
|  | { | 
|  | "name": "flex", | 
|  | "value": 222, | 
|  | "children": [ | 
|  | {"name": "FlareVis", "value": 4116, symbolSize: 20} | 
|  | ] | 
|  | }, | 
|  | { | 
|  | "name": "scale", | 
|  | "value": 333, | 
|  | "children": [ | 
|  | {"name": "IScaleMap", "value": 2105}, | 
|  | {"name": "LinearScale", "value": 1316}, | 
|  | {"name": "LogScale", "value": 3151}, | 
|  | {"name": "OrdinalScale", "value": 3770}, | 
|  | {"name": "QuantileScale", "value": 2435}, | 
|  | {"name": "QuantitativeScale", "value": 4839}, | 
|  | {"name": "RootScale", "value": 1756}, | 
|  | {"name": "Scale", "value": 4268}, | 
|  | {"name": "ScaleType", "value": 1821}, | 
|  | {"name": "TimeScale", "value": 5833} | 
|  | ] | 
|  | }, | 
|  | { | 
|  | "name": "display", | 
|  | "value": 444, | 
|  | "children": [ | 
|  | {"name": "DirtySprite", "value": 8833} | 
|  | ] | 
|  | } | 
|  | ] | 
|  | }; | 
|  |  | 
|  | function getOption(edgeShape, id) { | 
|  | return { | 
|  | tooltip: { | 
|  | trigger: 'item', | 
|  | triggerOn: 'mousemove' | 
|  | }, | 
|  |  | 
|  | legend: { | 
|  | top: '2%', | 
|  | left: '3%', | 
|  | orient: 'vertical', | 
|  | data: [{ | 
|  | name: 'tree1', | 
|  | icon: 'rectangle' | 
|  | }], | 
|  | borderColor: '#c23531' | 
|  | }, | 
|  |  | 
|  | series:[ | 
|  | { | 
|  | type: 'tree', | 
|  | id: id, | 
|  | name: 'tree1', | 
|  | data: [data], | 
|  | // Used to test when the data is null whether it is work well. | 
|  | // data: [], | 
|  |  | 
|  | top: '20%', | 
|  | left: '30%', | 
|  | bottom: '22%', | 
|  | right: '20%', | 
|  |  | 
|  | roam: true, | 
|  |  | 
|  | edgeShape: edgeShape, | 
|  |  | 
|  | symbolSize: 15, | 
|  | orient: 'RL', | 
|  |  | 
|  | label: { | 
|  | position: 'right', | 
|  | verticalAlign: 'middle', | 
|  | align: 'left', | 
|  | formatter: '{b}: {c}' | 
|  | }, | 
|  |  | 
|  | leaves: { | 
|  | label: { | 
|  | position: 'left', | 
|  | verticalAlign: 'middle', | 
|  | align: 'right', | 
|  | formatter: function (params) { | 
|  | return params.data.name + params.dataIndex; | 
|  | } | 
|  | } | 
|  | }, | 
|  |  | 
|  | expandAndCollapse: true, | 
|  | animationDuration: 550, | 
|  | animationDurationUpdate: 750 | 
|  | } | 
|  | ] | 
|  | } | 
|  | } | 
|  |  | 
|  | var chart0 = testHelper.create(echarts, 'main0', { | 
|  | title: [ | 
|  | '[edgeShape: **curve**]' | 
|  | ], | 
|  | option: getOption('curve', '0'), | 
|  | height: 500 | 
|  | }); | 
|  |  | 
|  | var chart1 = testHelper.create(echarts, 'main1', { | 
|  | title: [ | 
|  | '[edgeShape: **polyline**]' | 
|  | ], | 
|  | option: getOption('polyline', '1'), | 
|  | height: 500 | 
|  | }); | 
|  |  | 
|  | setTimeout(function() { | 
|  | var cloneData = echarts.util.clone(data); | 
|  | var appendNode = cloneData.children[1].children.splice(2, 1); | 
|  | cloneData.children.push(appendNode[0]); | 
|  |  | 
|  | chart0.setOption({ | 
|  | series: [{ | 
|  | type: 'tree', | 
|  | id: '0', | 
|  | data: [cloneData] | 
|  | }] | 
|  | }, false); | 
|  |  | 
|  | chart1.setOption({ | 
|  | series: [{ | 
|  | type: 'tree', | 
|  | id: '1', | 
|  | data: [cloneData] | 
|  | }] | 
|  | }, false); | 
|  | }, 1000); | 
|  |  | 
|  | }); | 
|  | </script> | 
|  | </body> | 
|  | </html> |