Skip to content

feat: allow fixing the vertical order of Sankey nodes#7873

Open
adamreeve wants to merge 5 commits into
plotly:v4.0from
adamreeve:sankey-order
Open

feat: allow fixing the vertical order of Sankey nodes#7873
adamreeve wants to merge 5 commits into
plotly:v4.0from
adamreeve:sankey-order

Conversation

@adamreeve

@adamreeve adamreeve commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #4373

Follow up to #7830

This exposes the nodeSort method added to d3-sankey, to allow disabling the default ordering algorithm and enforcing that the vertical order should match the order of nodes in the input data.

Note that the nodeSort method in d3-sankey can be a method that compared two nodes (see the docs), but for many users I think just providing a way to pass null instead of the default undefined is sufficient. But maybe this could be future-proofed somehow to support using a comparison method in future? Although I'm not sure how feasible it is to make that work in plotly.

The nodeSort option is not supported by d3-sankey-circular, so is not used for circular Sankey diagrams (see #7689 (comment) for more context).

@adamreeve adamreeve marked this pull request as ready for review June 29, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant