Install
@graphysdk/react and nothing else. Register the plugin once with createGraphyKit, which adds kit.geom.sankey() and binds kit.GraphProvider to the same plugin:
A sankey diagram
Pass one row per flow. Map the node it leaves tosource, the node it reaches to target and its amount to value:
Color
Each node takes its own color from the palette, and each flow the color of the node it leaves, as above. Each node already carries its name, so the chart draws no legend for it unless you setconfig.legend.position.
Color always groups by node. Map it to your source or target column to choose which node a flow takes its color from:
A node keeps its own color either way. Any other column is refused with
UNSUPPORTED_MAPPING: a node has no value in it, so every node would fall into one group. Set color: { value: '#…' } to paint every node and flow one color.
Alignment
params.align chooses the column a node sits in:
Styling
A sankey paints three things, each with its own builder:
The outline keeps a name legible where it crosses a flow. The flows and the nodes read the
color scale, and the scale beats an entry in defaults, so an entry that replaces their color is an override. Every entry takes a where, which tests the observation it paints:
fill takes a pattern (diagonal, crosshatch or dots) or a gradient as well as a color, and so does a node’s.
Hover and highlight
Hovering a node raises it with every flow into and out of it; hovering a flow raises it with the two nodes it joins. Everything else dims. A node’s tooltip is headed by its name and gives its total; a flow’s is headed by the node it leaves, and names where it goes:highlight({ variable: 'twh', gt: 100 }) matches the nodes and the flows over 100.
Not yet supported
- The editor’s chart-type picker and the chart agent. In editable mode the sankey renders and takes annotations on a node’s center or a flow’s middle, but it is authored in code.
- Color by a column other than the source or target. Color groups by node.
- A flow colored from its source to its target. A flow takes one color; a gradient between its two nodes’ colors is not drawn.
- Node width and spacing. The nodes and the gaps between them are sized to the panel, and are not yet options.
- Loops. A flow that would close a loop is left out rather than drawn back around.
- Names that would overlap. A name is drawn however short its node is, so the names of two short nodes in one column can meet.

