Add bottom-up and right-left orientations for Sankey diagrams#7870
Open
wf-r wants to merge 4 commits into
Open
Add bottom-up and right-left orientations for Sankey diagrams#7870wf-r wants to merge 4 commits into
wf-r wants to merge 4 commits into
Conversation
added 4 commits
June 26, 2026 07:25
\Extend the Sankey 'orientation' attribute with four direction-namedvalues while keeping the legacy ones as synonyms: - left-right (synonym of h): sources left, flow rightward - right-left: sources right, flow leftward (new) - top-down (synonym of v): sources top, flow downward - bottom-up: sources bottom, flow upward (new)right-left and bottom-up are mirrors of the existing horizontal andvertical layouts, each expressed as a single group-level matrix plustranslate in sankeyTransform(). right-left counts as horizontal forlayout sizing, dragging and hover-axis mapping; only the group ismirrored. Node labels get an updated counter-transform so glyphs stayupright, and right-left flips the outer-side text-anchor.plot.js: replace the '=== v' link-hover check with a proper verticaltest so left-right/right-left are not transposed, and mirror the flowaxis for bottom-up (y) and right-left (x).Default stays h; existing h/v figures render identically.Tests: orientation coercion for all values plus invalid fallback, anda group-transform assertion per orientation.
Adjust node label alignment for vertical case (labels below still need work)
Finalize node label alignment for vertical cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
See #7865
Adds two new flow directions to Sankey traces and gives the existing horizontal/vertical modes explicit, direction-named aliases, fully backward compatible.
orientationnow accepts:h— horizontal, default (unchanged)left-right— sources left, flow rightward (synonym ofh)right-left— sources right, flow leftward (new)v— vertical (unchanged)top-down— sources top, flow downward (synonym ofv)bottom-up— sources bottom, flow upward (new)Why
So far,
his always left→right andvis always top-down. Right-to-left and build-up (bottom-up) flows are common conventions with no equivalent today. This closes both gaps additively, without changing any existing rendering.Backward compatibility
Purely additive. Existing figures using
h/vrender identically; the default is unchanged.