Sankey图highchart问题

时间:2020-03-28 18:14:22

标签: highcharts angular6

我想生成一个如下所示的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]
        ]

但这会生成三个节点图 enter image description here

我应该使用哪种数据来获得与图像1中给出的图类似的图

1 个答案:

答案 0 :(得分:1)

对于平台,您可以创建两种类型的节点:“平台X从”和“平台X至”。然后,您可以使用private void showPopupMenu(View view) { // inflate menu PopupMenu popup = new PopupMenu(mContext, view); MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.menu_album, popup.getMenu()); popup.setOnMenuItemClickListener(new MyMenuItemClickListener()); popup.show(); } 部分重新定义它们,以便它们具有相同的名称和相同的颜色:

nodes