Skip to content

[FEATURE]: Add Bottom-Up and Right-Left Sankey Diagram Option #7865

Closed

Description

@wf-r

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.

Activity

  1. changed the title [-]Add Bottom-up Sankey Diagram Option[/-] [+][FEATURE]: Add Bottom-up Sankey Diagram Option[/+] on Jun 25, 2026
  2. camdecoster commented on Jun 25, 2026

    @camdecoster
    Contributor

    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.

  3. changed the title [-][FEATURE]: Add Bottom-up Sankey Diagram Option[/-] [+][FEATURE]: Add Bottom-Up and Right-Left Sankey Diagram Option[/+] on Jun 26, 2026
  4. wf-r commented on Jun 26, 2026

    @wf-r
    Author

    Thanks, I will look into it (and while I am at it, I might as well add right-left)

  5. wf-r commented on Jun 26, 2026

    @wf-r
    Author

    Examples horizontal:

    Image

    Examples vertical:

    Image
  6. camdecoster commented on Jun 26, 2026

    @camdecoster
    Contributor

    That's quick work! Thanks for working on this.

  7. wf-r commented on Jun 29, 2026

    @wf-r
    Author

    You are welcome. If I missed anything (I did not run the tests) or if it needs more polishing please let me know.

  8. added this to the v4.0.0 milestone on Jul 27, 2026
  9. camdecoster commented on Jul 27, 2026

    @camdecoster
    Contributor

    I'm going to keep this open for now until we release v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions