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 legacy h)
right-left — sources right, flow leftward (new)
top-down — sources top, flow downward (synonym of the legacy v)
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 of left-right)
bottom-up → matrix(0 -1 1 0 0 0), translateY += height (vertical mirror of top-down)
Touched files:
- attributes.js — extend the orientation enum + description.
- render.js — adjust orientation flags,
sankeyTransform and label flipText / text-anchor
- plot.js — adjust link-hover positioning
Backward compatibility
Existing figures using 'v'/'h' render identically; only additive enum values.
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/vkeep working; default staysh.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:
sankeyTransformand labelflipText/text-anchorBackward compatibility
Existing figures using 'v'/'h' render identically; only additive enum values.