桑基图高图问题
Sankey Diagram highchart Issue
我想生成如下所示的 Sankey 图,截至目前,我正在使用这样的系列数据:
keys: ['from', 'to' ,'weight'],
data: [
['Entrance A', 'Platform 1' , 10 ],
['Entrance A', 'Platform 2' , 2 ],
['Entrance B', 'Platform 2' , 3 ],
['Entrance C', 'Platform 3' , 5 ],
['Entrance D', 'Platform 4' , 7 ],
['Entrance E', 'Platform 1' , 6 ],
['Entrance F', 'Platform 2' , 10 ],
['Entrance F', 'Platform 4' , 4 ],
['Entrance G', 'Platform 1' , 13 ],
['Platform 1', 'Exit F' , 9 ],
['Platform 2', 'Exit D' , 10 ],
['Platform 2', 'Exit F' , 4 ],
['Platform 3', 'Exit G' , 5 ],
['Platform 3', 'Exit B' , 11 ],
['Platform 4', 'Exit C' , 5 ],
['Platform 4', 'Exit E' , 6]
]
但这会生成三个节点图
我应该使用什么样的数据来获得与图像 1 中给出的类似图表
对于平台,您可以创建两种类型的节点:'Platform X from' 和 'Platform X to'。然后,您可以使用 nodes
部分重新定义它们,使它们具有相同的名称和相同的颜色:
series: [{
type: 'sankey',
keys: ['from', 'to' ,'weight'],
data: [
['Entrance A', 'Platform 1 to' , 10 ],
['Entrance A', 'Platform 2 to' , 2 ],
['Entrance B', 'Platform 2 to' , 3 ],
['Entrance C', 'Platform 3 to' , 5 ],
['Entrance D', 'Platform 4 to' , 7 ],
['Entrance E', 'Platform 1 to' , 6 ],
['Entrance F', 'Platform 2 to' , 10 ],
['Entrance F', 'Platform 4 to' , 4 ],
['Entrance G', 'Platform 1 to' , 13 ],
['Platform 1 from', 'Exit F' , 9 ],
['Platform 2 from', 'Exit D' , 10 ],
['Platform 2 from', 'Exit F' , 4 ],
['Platform 3 from', 'Exit G' , 5 ],
['Platform 3 from', 'Exit B' , 11 ],
['Platform 4 from', 'Exit C' , 5 ],
['Platform 4 from', 'Exit E' , 6]
],
nodes: [
{id: 'Platform 1 from', 'name': 'Platform 1', colorIndex: 0},
{id: 'Platform 1 to', 'name': 'Platform 1', colorIndex: 0},
{id: 'Platform 2 from', 'name': 'Platform 2', colorIndex: 1},
{id: 'Platform 2 to', 'name': 'Platform 2', colorIndex: 1},
{id: 'Platform 3 from', 'name': 'Platform 3', colorIndex: 2},
{id: 'Platform 3 to', 'name': 'Platform 3', colorIndex: 2},
{id: 'Platform 4 from', 'name': 'Platform 4', colorIndex: 3},
{id: 'Platform 4 to', 'name': 'Platform 4', colorIndex: 3},
]
}]
我想生成如下所示的 Sankey 图,截至目前,我正在使用这样的系列数据:
keys: ['from', 'to' ,'weight'],
data: [
['Entrance A', 'Platform 1' , 10 ],
['Entrance A', 'Platform 2' , 2 ],
['Entrance B', 'Platform 2' , 3 ],
['Entrance C', 'Platform 3' , 5 ],
['Entrance D', 'Platform 4' , 7 ],
['Entrance E', 'Platform 1' , 6 ],
['Entrance F', 'Platform 2' , 10 ],
['Entrance F', 'Platform 4' , 4 ],
['Entrance G', 'Platform 1' , 13 ],
['Platform 1', 'Exit F' , 9 ],
['Platform 2', 'Exit D' , 10 ],
['Platform 2', 'Exit F' , 4 ],
['Platform 3', 'Exit G' , 5 ],
['Platform 3', 'Exit B' , 11 ],
['Platform 4', 'Exit C' , 5 ],
['Platform 4', 'Exit E' , 6]
]
但这会生成三个节点图
我应该使用什么样的数据来获得与图像 1 中给出的类似图表
对于平台,您可以创建两种类型的节点:'Platform X from' 和 'Platform X to'。然后,您可以使用 nodes
部分重新定义它们,使它们具有相同的名称和相同的颜色:
series: [{
type: 'sankey',
keys: ['from', 'to' ,'weight'],
data: [
['Entrance A', 'Platform 1 to' , 10 ],
['Entrance A', 'Platform 2 to' , 2 ],
['Entrance B', 'Platform 2 to' , 3 ],
['Entrance C', 'Platform 3 to' , 5 ],
['Entrance D', 'Platform 4 to' , 7 ],
['Entrance E', 'Platform 1 to' , 6 ],
['Entrance F', 'Platform 2 to' , 10 ],
['Entrance F', 'Platform 4 to' , 4 ],
['Entrance G', 'Platform 1 to' , 13 ],
['Platform 1 from', 'Exit F' , 9 ],
['Platform 2 from', 'Exit D' , 10 ],
['Platform 2 from', 'Exit F' , 4 ],
['Platform 3 from', 'Exit G' , 5 ],
['Platform 3 from', 'Exit B' , 11 ],
['Platform 4 from', 'Exit C' , 5 ],
['Platform 4 from', 'Exit E' , 6]
],
nodes: [
{id: 'Platform 1 from', 'name': 'Platform 1', colorIndex: 0},
{id: 'Platform 1 to', 'name': 'Platform 1', colorIndex: 0},
{id: 'Platform 2 from', 'name': 'Platform 2', colorIndex: 1},
{id: 'Platform 2 to', 'name': 'Platform 2', colorIndex: 1},
{id: 'Platform 3 from', 'name': 'Platform 3', colorIndex: 2},
{id: 'Platform 3 to', 'name': 'Platform 3', colorIndex: 2},
{id: 'Platform 4 from', 'name': 'Platform 4', colorIndex: 3},
{id: 'Platform 4 to', 'name': 'Platform 4', colorIndex: 3},
]
}]