作者检索 作者合作关系图 option var ecConfig = require('echarts/config'); myChart.on(ecConfig.EVENT.CLICK, focus) myChart.on(ecConfig.EVENT.FORCE_LAYOUT_END, function () { console.log(myChart.chart.force.getPosition()); }); 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.filter(function (n) {return n.name == data.source})[0]; var targetNode = nodes.filter(function (n) {return n.name == data.target})[0]; console.log("选中了边 " + sourceNode.name + ' -> ' + targetNode.name + ' (' + data.weight + ')'); } else { // 点击的是点 console.log("选中了" + data.name + '(' + data.value + ')'); ajaxFunction(data.name); } } 刷 新 切换主题