详细介绍
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}], links :[] } ] }; 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 ~