amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
Other
358 stars 95 forks source link

How to specify correct order of Links in Sankey Diagram? #1185

Closed JessieNguyen closed 1 year ago

JessieNguyen commented 1 year ago

Hi, This is my first time asking question on github so I hope I can explain my question clear enough.

I'm plotting my data using Sankey Diagram:

https://codepen.io/jessienguyen123/pen/mdvMaPo image

My data is stored in the data variable.

According to the documentation, the actual Links in the Diagram will be drawn in exactly the same order as they are defined in data.

I have purposely ordered my data so that there's least crisscross as possible. For example, the links are sorted as:

However, the links shown in the diagram does not appear in the same order that I need. I expect links from story 2 will not crossed link from story 3, and so on.

Could you please help to guide me on how to make the links plot with as little crisscrossing as possible? Thanks.

Jessie

martynasma commented 1 year ago

You may find this tutorial useful: https://www.amcharts.com/docs/v5/charts/flow-charts/sankey-diagram/#Link_sort_order

JessieNguyen commented 1 year ago

Thanks for the link! It works now :)