Usage
SankeyChart is based on the Sankey recharts component.
It visualizes flow between nodes where the width of each link is proportional to the flow value:
Data
Pass an object with nodes and links arrays to the data prop.
Each link references its source and target nodes by their zero-based index in the nodes array.
Links must not form a cycle:
Node color
Set color on a node in the data to change its color. Theme colors and any valid CSS color are accepted:
Custom colors
Use colors prop to set colors for nodes that do not have color. Colors repeat when there are more nodes than colors:
Node and link color
By default, each link has the color of its source node.
Set linkColor prop to use one color for all links.
Set nodeColor prop to use one color for all nodes that do not have color:
Node width and padding
Use nodeWidth to control the width of each node and nodePadding to control
the spacing between nodes:
Link opacity
Use linkOpacity prop to control the opacity of links between nodes:
Value formatter
Use valueFormatter to format values in node labels and in the tooltip:
Disable tooltip
To disable the tooltip, set withTooltip={false}: