Note: This component is in alpha.
import {Sankey} from 'react-vis';
const nodes = [{name: 'a'}, {name: 'b'}, {name: 'c'}];
const links = [
{source: 0, target: 1, value: 10},
{source: 0, target: 2, value: 20},
{source: 1, target: 2, value: 20}
];
<Sankey
nodes={nodes}
links={links}
width={200}
height={200}
/>
An array of objects matching the following shape:
{
color: String,
opacity: Number,
key: String
}
All these fields are optional.
An array of objects matching the following shape, where both source
and target
are the indexes of the nodes they intent to represent, and value
that would
match the height of the path link.
{
// required
source: Number,
target: Number,
value: Number,
// optional
color: String,
opacity: Number,
key: String
}
The margin that will be applied to each side of the Sankey.
Defaults to 20
.
Width of the nodes.
Defaults to 10
.
Padding between each node.
Defaults to 10
.
The alignment used for the sankey (example).
Can be justify
, center
, left
, right
.
Defaults to justify
.
The number of passes the sankey algorithm will do in order to arrange positioning.
Defaults to 50
.
Determine if the node selection will be done using a voronoi or not. Although less precise, it can help providing a better interactive experience to the user.
Defaults to false
.
Callback when clicking a node, or the voronoi assigned to this node, pass the node.
Callback when hovering a node, or the voronoi assigned to this node, pass the node.
Callback when bluring a node, or the voronoi assigned to this node, pass the node.