|  |  | 
|  | <!-- | 
|  | 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"> | 
|  | <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', | 
|  | 'theme/vintage' | 
|  | ], function (echarts) { | 
|  |  | 
|  | function getOption(focusNodeAdjacency) { | 
|  | return { | 
|  | tooltip: {}, | 
|  | animationDurationUpdate: 1500, | 
|  | animationEasingUpdate: 'quinticInOut', | 
|  | series : [ | 
|  | { | 
|  | type: 'graph', | 
|  | symbolSize: 20, | 
|  | roam: true, | 
|  | label: { | 
|  | normal: { | 
|  | show: true | 
|  | } | 
|  | }, | 
|  | center: ['30%', '80%'], | 
|  | edgeSymbol: ['circle', 'arrow'], | 
|  | edgeSymbolSize: [4, 10], | 
|  | edgeLabel: { | 
|  | normal: { | 
|  | textStyle: { | 
|  | color: 'green', | 
|  | fontSize: 30 | 
|  | } | 
|  | }, | 
|  | emphasis: { | 
|  | textStyle: { | 
|  | color: '#987654' | 
|  | } | 
|  | } | 
|  | }, | 
|  | focusNodeAdjacency: focusNodeAdjacency, | 
|  | data: [{ | 
|  | name: '节点1', | 
|  | x: 300, | 
|  | y: 300, | 
|  | value: 'set_style_on_item' | 
|  | }, { | 
|  | name: '节点2', | 
|  | x: 800, | 
|  | y: 300 | 
|  | }, { | 
|  | name: '节点3', | 
|  | x: 550, | 
|  | y: 100 | 
|  | }, { | 
|  | name: '节点4', | 
|  | x: 550, | 
|  | y: 500 | 
|  | }], | 
|  | lineStyle: { | 
|  | normal: { | 
|  | width: 3, | 
|  | color: '#184029', | 
|  | curveness: 0 | 
|  | } | 
|  | }, | 
|  | links: [{ | 
|  | source: 0, | 
|  | target: 1, | 
|  | symbolSize: [5, 20], | 
|  | label: { | 
|  | normal: { | 
|  | show: true | 
|  | // position: 'end' | 
|  | } | 
|  | }, | 
|  | lineStyle: { | 
|  | width: 5, | 
|  | opacity: 1, | 
|  | curveness: 0.2 | 
|  | }, | 
|  | emphasis: { | 
|  | lineStyle: { | 
|  | color: 'blue', | 
|  | width: 20, | 
|  | opacity: 0.1 | 
|  | }, | 
|  | label: { | 
|  | fontSize: 40, | 
|  | color: 'red' | 
|  | } | 
|  | } | 
|  | }, { | 
|  | source: '节点2', | 
|  | target: '节点1', | 
|  | label: { | 
|  | normal: { | 
|  | show: true | 
|  | } | 
|  | }, | 
|  | lineStyle: { | 
|  | normal: { | 
|  | curveness: 0.2 | 
|  | } | 
|  | } | 
|  | }, { | 
|  | source: '节点1', | 
|  | target: '节点3', | 
|  | emphasis: { | 
|  | label: { | 
|  | show: true | 
|  | } | 
|  | } | 
|  | }, { | 
|  | source: '节点2', | 
|  | target: '节点3' | 
|  | }, { | 
|  | source: '节点2', | 
|  | target: '节点4' | 
|  | }, { | 
|  | source: '节点1', | 
|  | target: '节点4' | 
|  | }] | 
|  | } | 
|  | ] | 
|  | }; | 
|  | } | 
|  |  | 
|  | var chart0 = testHelper.create(echarts, 'main0', { | 
|  | title: [ | 
|  | '[focusNodeAdjacency: **true**]', | 
|  | 'hover node3, edge label should be displayed.', | 
|  | '节点1 should display value in tooltip.', | 
|  | 'series.lineStyle: 5', | 
|  | 'hover set_style_on_item, lineStyle: {opacity 0.1, color: "blue", width: 20}, label: {color: "red", fontSize: 40}.', | 
|  | 'focusNodeAdjacency triggered and returned, opacity change MUST NOT be kept' | 
|  | ], | 
|  | option: getOption(true), | 
|  | height: 500 | 
|  | }); | 
|  |  | 
|  | var chart1 = testHelper.create(echarts, 'main1', { | 
|  | title: [ | 
|  | '[focusNodeAdjacency: **false**]', | 
|  | 'hover node3, edge label should be displayed.', | 
|  | '节点1 should display value in tooltip.', | 
|  | 'hover set_style_on_item, lineStyle: {opacity 0.1, color: "blue", width: 20}, label: {color: "red", fontSize: 40}.', | 
|  | 'focusNodeAdjacency triggered and returned, opacity change MUST NOT be kept' | 
|  | ], | 
|  | option: getOption(false), | 
|  | height: 500 | 
|  | }); | 
|  | }); | 
|  |  | 
|  |  | 
|  |  | 
|  | </script> | 
|  | </body> | 
|  | </html> |