[FEATURE]: Add Bottom-Up and Right-Left Sankey Diagram Option #7865
Copy link
Copy link
Closed
Labels
P2considered for next cycleconsidered for next cycleenhancementfeaturesomething newsomething newmerged-to-4.0size: 3
Milestone
Description
Summary
Sankey supports orientation: 'h' and 'v'. 'h' always runs left→right and 'v' always runs top-down, so there is no way to render a flow that builds up (sources at the bottom) or runs right→left. Both are common conventions and currently impossible.
Proposed change
Extend orientation with four explicit, direction-named values while keeping the existing values as synonyms:
left-right— sources left, flow rightward (synonym of the legacyh)right-left— sources right, flow leftward (new)top-down— sources top, flow downward (synonym of the legacyv)bottom-up— sources bottom, flow upward (new)
h/v keep working; default stays h.
The vertical/horizontal layout is already produced by transposing the horizontal layout via a single group-level SVG transform in sankeyTransform(). The two new directions are mirrors of the existing ones, each expressible as one matrix + translate:
right-left→matrix(-1 0 0 1 0 0),translateX += width(horizontal mirror ofleft-right)bottom-up→matrix(0 -1 1 0 0 0),translateY += height(vertical mirror oftop-down)
Touched files:
- attributes.js — extend the orientation enum + description.
- render.js — adjust orientation flags,
sankeyTransformand labelflipText/text-anchor - plot.js — adjust link-hover positioning
Backward compatibility
Existing figures using 'v'/'h' render identically; only additive enum values.
Metadata
Metadata
Assignees
Labels
P2considered for next cycleconsidered for next cycleenhancementfeaturesomething newsomething newmerged-to-4.0size: 3
Activity
[-]Add Bottom-up Sankey Diagram Option[/-][+][FEATURE]: Add Bottom-up Sankey Diagram Option[/+]camdecoster commentedon Jun 25, 2026
Thanks for the idea! If you'd like to work on a PR to add this, we'd be happy to help get it reviewed and merged. Also, would you please add example of a chart drawn like this? It will help me picture it.
[-][FEATURE]: Add Bottom-up Sankey Diagram Option[/-][+][FEATURE]: Add Bottom-Up and Right-Left Sankey Diagram Option[/+]wf-r commentedon Jun 26, 2026
Thanks, I will look into it (and while I am at it, I might as well add right-left)
wf-r commentedon Jun 26, 2026
Examples horizontal:
Examples vertical:
camdecoster commentedon Jun 26, 2026
That's quick work! Thanks for working on this.
wf-r commentedon Jun 29, 2026
You are welcome. If I missed anything (I did not run the tests) or if it needs more polishing please let me know.
camdecoster commentedon Jul 27, 2026
I'm going to keep this open for now until we release v4.