Skip to content
On this page

Charts > Sankey diagram ​

The Sankey diagram represents a directed graph with no circular paths.

The Chart ​

Download example CSV
Copy HTML

Playground ​

Sankey node alignment strategy (left, right, justify, center)
Color of the links

Component API ​

The Sankey diagram represents a graph. The nodes are specified by the nodes data property and the links by the links property.

Data ​

js
{
  nodes: [
    { id: "A" },
    { id: "B" },
    { id: "C" },
    { id: "D" }
  ],
  links: [
    { source: "A", target: "B", value: 30 },
    { source: "A", target: "C", value: 10 },
    { source: "B", target: "C", value: 20 },
    { source: "B", target: "D", value: 20 }
  ],
}

Props ​

NameTypeDefaultDescription
dataObject() => ({ nodes: [{ id: "A" }, ...] })The dataset for the chart (nodes and links)
marginObject() => ({ top: 0, right: 0, ... })The margins of the chart (top, right, bottom, left)
durationNumber300The duration of the animation in milliseconds
nodeAlign[String, Function]'justify'Sankey node alignment strategy: left, right, justify, center
color[String, Object, Function]d3.schemeCategory10The color scheme for the chart
linkColor[String, Function]'#eee'The color of the links between nodes
highlighted[String, Array]nullThe highlighted section(s) on the chart
Data Shape for Uploadable CSV (example data)
sourcetargetvalue
Solar PanelBattery50
Solar PanelAppliance30
Wind TurbineBattery20
Wind TurbineAppliance10
BatteryDevice40
BatteryLights30
ApplianceDevice20
ApplianceLights10