| |
| <!-- |
| 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", |
| "children": [ |
| { |
| "name": "flex", |
| "children": [ |
| {"name": "FlareVis", "value": 4116} |
| ] |
| }, |
| { |
| "name": "scale", |
| "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", |
| "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], |
| |
| top: '20%', |
| left: '30%', |
| bottom: '22%', |
| right: '20%', |
| |
| symbolSize: 7, |
| orient: 'RL', |
| |
| edgeShape: edgeShape, |
| |
| label: { |
| position: 'right', |
| verticalAlign: 'middle', |
| align: 'left' |
| }, |
| |
| leaves: { |
| label: { |
| position: 'left', |
| verticalAlign: 'middle', |
| align: 'right' |
| } |
| }, |
| |
| 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 |
| }); |
| |
| var cloneData = echarts.util.clone(data); |
| |
| setInterval(function() { |
| cloneData.children[1].children.splice(0, 1); |
| |
| chart0.setOption({ |
| series: [{ |
| type: 'tree', |
| id: '0', |
| data: [cloneData] |
| }] |
| }, false); |
| |
| chart1.setOption({ |
| series: [{ |
| type: 'tree', |
| id: '1', |
| data: [cloneData] |
| }] |
| }, false); |
| }, 1000); |
| }); |
| </script> |
| </body> |
| </html> |