Testing how a Sankey with circular links may be constructed.
This chart detects circular links, and then uses top and bottom 'channels' to layout those links back to the target node. The middle channel is for "forward" links through the process.
~~This needs more work in terms in aligning the nodes better - the nodes which have circular links are pushed to the top or bottom, but perhaps a bit too rigourously.~~ This version lays out the nodes based on incoming/outgoing circular links, and takes into account whether its in the first or last column.
This version of the sankey code works out padding based on a proportion of the height and max values/nodes in each column.
Need to consider how circular links could work going down the middle if that makes sense, eg from process4 to process1 in this example. Perhaps if the nodes a close in terms of depth, and the risk of crossing other links is lower?
This version improves the lay out of nodes and links to prevent cross overs. Still need to work out how to avoid overlap of nodes on links
But ultimately, this needs a load more sankey datasets thrown at it, to break the layout functions
forked from tomshanley's block: Sankey with circular links
forked from tomshanley's block: Sankey with circular links v2
https://d3js.org/d3.v4.min.js
https://d3js.org/d3-scale-chromatic.v1.min.js