d3 / d3-sankey

Visualize flow between nodes in a directed acyclic network.

Home Page:https://observablehq.com/collection/@d3/d3-sankey

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Control/Understand node placement

DDDgfx opened this issue · comments

Ive got two issues with sankey right now. That are related. Attached is my current graphic that is being produced. The first problem is that the inputs vs. outputs to the center node are not equal. That is by design, but the result is that the output links are clustered near the top of the node rather than the vertical center, which doesn't make sense to me. Can I control this?

The second is the placement of the target nodes on rthe right side of the diagram. Why would they float to the bottom, rather than also centering themselves vertically? Hard to understand. Can I control it?

image

The layout algorithm has been substantially rewritten since you posted this issue, so hopefully the resulting layout is better. Please try upgrading to the latest version.

As for positioning of the links within the node, yes, the code assumes that total value of the incoming links and the total value of the outgoing links are equal to the node’s value. You could patch up the link positions by iterating over the resulting Sankey diagram yourself, or if you’re so inclined send a pull request to fix this case. Thank you!