我想生成一个像下面这样的Sankey Diagram,到目前为止,我使用的数据是这样的系列:
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中给出的类似类型的图形
发布于 2020-03-29 21:06:19
对于平台,您可以创建两种类型的节点:'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},
]
}]https://stackoverflow.com/questions/60904956
复制相似问题