kurkle / chartjs-chart-sankey

Chart.js module for creating sankey diagrams
MIT License
152 stars 29 forks source link

Bidirectional relationships #89

Closed arcaweb-ch closed 1 year ago

arcaweb-ch commented 1 year ago

Hi, loving this library thank you for your effort!

Here is my issue: I have the same elements in both From and To, every element shares data with each other, eg:

[
{"From": "a", "To": "b", "Flow":5}
{"From": "a", "To": "c", "Flow":10},
{"From": "b", "To": "a", "Flow":15},
{"From": "b", "To": "c", "Flow":20},
{"From": "c", "To": "a", "Flow":35},
{"From": "c", "To": "b", "Flow":2},
]

I am trying to put all elements on left and right sides to show relations, like this (sort of): 487118_sankey

Any idea on how to accomplish this?

kurkle commented 1 year ago

You just need to use labels, colors etc to make the different sides appear to be same things, while actually being different nodes. https://codepen.io/kurkle/pen/eYvNXqM