echarts3 graph java_Echarts中graph类型的运用求教
以下是百度Echarts官網上關系圖的源碼,但是這個關系圖的node節點和edge都是靜態文件里規定好的,我現在想動態實現,點擊其中一個節點A然后新產生一個新節點B,并且有A和B之間的edge,就類似于百度的人物關系圖譜那種動態生成,怎么實現啊?求教
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: '類目' + 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');
總結
以上是生活随笔為你收集整理的echarts3 graph java_Echarts中graph类型的运用求教的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java运行win10_win10配置j
- 下一篇: 旅游流的概念_2020年去张家界凤凰古城