IM工作的网络图highcharts每个节点都应该有一个新的孩子,但它不应该与其他子节点合并,如果它具有相同的名称,像child1,的child2,child3,指着subchild1,每一个人,我们应该有单独的节点指向每一个
fiddle链接 - > https://jsfiddle.net/GnanaSagar/36k2wmry/1/
您也可以使用数据标签formatter
功能:
series: [{
dataLabels: {
enabled: true,
format: undefined,
formatter: function() {
if (this.key.indexOf('subchild') >= 0) {
return 'subchild1'
}
return this.key
}
},
data: [...,
{
from: 'child1',
to: 'subchild1'
},
{
from: 'child2',
to: 'subchild2'
},
{
from: 'child3',
to: 'subchild3'
}
]
}]
现场演示:https://jsfiddle.net/BlackLabel/n4gd8v3r/
API:https://api.highcharts.com/highcharts/series.networkgraph.dataLabels.formatter
因此很明显,series.networkgraph.nodes作品。
series: [{
dataLabels: {
enabled: true
},
data: [
{from: 'parent', to: 'child1'},
{from: 'parent', to: 'child2'},
{from: 'parent', to: 'child3'},
{from: 'child1', to: 'subchild1.1'},
{from: 'child2', to: 'subchild2.1'},
{from: 'child3', to: 'subchild3.1'}
],
nodes: [{
id: 'subchild1.1',
name: 'subchild1'
},
{
id: 'subchild2.1',
name: 'subchild1'
},
{
id: 'subchild3.1',
name: 'subchild1'
}
]
}]
的jsfiddle:https://jsfiddle.net/9g42nqza/(我必须注释掉一些你原来的代码,因为它被扔的错误)。