echarts3 graph java_Echarts中graph类型的运用求教
以下是百度Echarts官網(wǎng)上關(guān)系圖的源碼,但是這個(gè)關(guān)系圖的node節(jié)點(diǎn)和edge都是靜態(tài)文件里規(guī)定好的,我現(xiàn)在想動(dòng)態(tài)實(shí)現(xiàn),點(diǎn)擊其中一個(gè)節(jié)點(diǎn)A然后新產(chǎn)生一個(gè)新節(jié)點(diǎn)B,并且有A和B之間的edge,就類(lèi)似于百度的人物關(guān)系圖譜那種動(dòng)態(tài)生成,怎么實(shí)現(xiàn)啊?求教
myChart.showLoading();
$.get('data/asset/data/les-miserables.gexf', function (xml) {
myChart.hideLoading();
var graph = echarts.dataTool.gexf.parse(xml);
var categories = [];
for (var i = 0; i < 9; i++) {
categories[i] = {
name: '類(lèi)目' + i
};
}
graph.nodes.forEach(function (node) {
node.itemStyle = null;
node.value = node.symbolSize;
node.label = {
normal: {
show: node.symbolSize > 30
}
};
node.category = node.attributes.modularity_class;
});
option = {
title: {
text: 'Les Miserables',
subtext: 'Default layout',
top: 'bottom',
left: 'right'
},
tooltip: {},
legend: [{
// selectedMode: 'single',
data: categories.map(function (a) {
return a.name;
})
}],
animationDuration: 1500,
animationEasingUpdate: 'quinticInOut',
series : [
{
name: 'Les Miserables',
type: 'graph',
layout: 'none',
data: graph.nodes,
links: graph.links,
categories: categories,
roam: true,
label: {
normal: {
position: 'right',
formatter: '{b}'
}
},
lineStyle: {
normal: {
curveness: 0.3
}
}
}
]
};
myChart.setOption(option);
}, 'xml');
總結(jié)
以上是生活随笔為你收集整理的echarts3 graph java_Echarts中graph类型的运用求教的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java运行win10_win10配置j
- 下一篇: 旅游流的概念_2020年去张家界凤凰古城