详细介绍
option = { title : { text: '人物关系:李小文', //subtext: '详细介绍', x:'right', y:'top' }, tooltip : { trigger: 'item', formatter: '{a} : {b}' }, legend_hidden: { x: 'left', data:['人物','中心人物'] }, series : [ { type:'force', name : "人物关系", categories : [ { name: '人物', itemStyle: { normal: { color : '#ff7f50' } } }, { name: '中心人物', itemStyle: { normal: { color : '#87cdfa' } } } ], itemStyle: { normal: { label: { show: true, textStyle: { color: '#fff' } }, nodeStyle : { brushType : 'both', strokeColor : 'rgba(255,255,255,0.4)', lineWidth : 10 } }, emphasis: { label: { show: true // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE }, nodeStyle : { //r: 30 }, linkStyle : {} } }, minRadius : 40, maxRadius : 50, density : 0.05, attractiveness: 0.5, linkSymbol: 'arrow', nodes:[{id:0 ,category:1, name: '李小文', value : 15}, {id:1 ,category:0, name: '钟秉林', value : 10}, {id:2 ,category:0, name: '刘昌明', value : 10}, {id:3 ,category:0, name: '史培军', value : 10}, {id:4 ,category:0, name: '晁福林', value : 10}, {id:5 ,category:0, name: '刘宝元', value : 10}, {id:6 ,category:0, name: '王英杰', value : 10}, {id:7 ,category:0, name: '周星', value : 10}, {id:8 ,category:0, name: '陈木法', value : 10}, {id:9 ,category:0, name: '方福康', value : 10}, {id:10 ,category:0, name: '高琼', value : 10}, {id:11 ,category:0, name: '黄祖洽', value : 10}, {id:12 ,category:0, name: '林学钰', value : 10}, {id:13 ,category:0, name: '林崇德', value : 10}, {id:14 ,category:0, name: '陆善镇', value : 10}, {id:15 ,category:0, name: '石中英', value : 10}, {id:16 ,category:0, name: '王永炎', value : 10}, {id:17 ,category:0, name: '王梓坤', value : 10}, {id:18 ,category:0, name: '杨耕', value : 10}, {id:19 ,category:0, name: '杨志峰', value : 10}, {id:20 ,category:0, name: '袁贵仁', value : 10}, {id:21 ,category:0, name: '董奇', value : 10}, {id:22 ,category:0, name: '顾明远', value : 10}, {id:23 ,category:0, name: '启功', value : 10}, {id:24 ,category:0, name: '许嘉璐', value : 10}, {id:25 ,category:0, name: '钟敬文', value : 10}, {id:26 ,category:0, name: '陶大镛', value : 10}, {id:27 ,category:0, name: '童庆炳', value : 10}], links :[{source : 0, target : 1, weight : 10}, {source : 0, target : 2, weight : 10}, {source : 0, target : 3, weight : 10}, {source : 0, target : 4, weight : 10}, {source : 0, target : 5, weight : 10}, {source : 0, target : 6, weight : 10}, {source : 0, target : 7, weight : 10}, {source : 0, target : 8, weight : 10}, {source : 0, target : 9, weight : 10}, {source : 0, target : 10, weight : 10}, {source : 0, target : 11, weight : 10}, {source : 0, target : 12, weight : 10}, {source : 0, target : 13, weight : 10}, {source : 0, target : 14, weight : 10}, {source : 0, target : 15, weight : 10}, {source : 0, target : 16, weight : 10}, {source : 0, target : 17, weight : 10}, {source : 0, target : 18, weight : 10}, {source : 0, target : 19, weight : 10}, {source : 0, target : 20, weight : 10}, {source : 1, target : 21, weight : 10}, {source : 17, target : 22, weight : 10}, {source : 17, target : 23, weight : 10}, {source : 9, target : 24, weight : 10}, {source : 23, target : 25, weight : 10}, {source : 23, target : 26, weight : 10}, {source : 22, target : 27, weight : 10}] } ] }; var ecConfig = require('echarts/config'); function focus(param) { var data = param.data; var links = option.series[0].links; var nodes = option.series[0].nodes; if ( data.source !== undefined && data.target !== undefined ) { //点击的是边 var sourceNode = nodes[data.source]; var targetNode = nodes[data.target]; window.parent.location = '/Stage?cat=' + encodeURI('人物') + '&keyword=' + encodeURI(sourceNode.name) + ',' + encodeURI(targetNode.name); //alert("选中了边 " + sourceNode.name + ' -> ' + targetNode.name + ' (' + data.weight + ')'); //console.log("选中了边 " + sourceNode.name + ' -> ' + targetNode.name + ' (' + data.weight + ')'); } else { // 点击的是点 if(data.category == 1) window.location = 'People_Detail?keyword=' + encodeURI(data.name); else window.location = '/People/People_Force?keyword=' + encodeURI(data.name) + '&category=' + encodeURI(data.category); //alert("选中了" + data.name + '(' + data.value + ')'); //console.log("选中了" + data.name + '(' + data.value + ')'); } //console.log(param); } myChart.on(ecConfig.EVENT.CLICK, focus)
Refresh ~