Skip to content

Sankey Diagram ^0.1.20 ​

Flow diagram showing quantity transfer between nodes. Perfect for energy flows, user journeys, revenue splits, and transition analysis.

Basic ​

A · 15B · 20C · 18D · 17
vue
<VxSankeyChart
  :nodes="[{ id: 'A' }, { id: 'B' }, { id: 'C' }, { id: 'D' }]"
  :links="[
    { source: 'A', target: 'C', value: 10 },
    { source: 'A', target: 'D', value: 5 },
    { source: 'B', target: 'C', value: 8 },
    { source: 'B', target: 'D', value: 12 },
  ]"
/>

Website traffic flow ​

direct · 320search · 1.0ksocial · 250referral · 300email · 210landing · 1.3kpricing · 870docs · 420signup · 820checkout · 700bounce · 880
vue
<VxSankeyChart :nodes="traffic.nodes" :links="traffic.links" :height="460" />

Energy flow ​

Coal · 120Gas · 315Nuclear · 140Wind · 65Solar · 55Hydro · 70Electricity · 630Heating · 90Industry · 260Residential · 270Commercial · 190Transport · 80
vue
<VxSankeyChart :nodes="energy.nodes" :links="energy.links" />

Budget allocation with custom colors ​

Revenue · 1.1kEngineering · 400Sales · 220Marketing · 180Admin · 80Salaries · 580Tooling · 80Ads · 190Office · 30Profit · 220
vue
<VxSankeyChart
  :nodes="[
    { id: 'Revenue', color: '#22c55e' },
    { id: 'Engineering', color: '#6366f1' },
    { id: 'Tooling', color: '#f59e0b' },
    ...
  ]"
  :links="[...]"
/>

Career paths ​

School · 160University · 120Bootcamp · 40Junior dev · 105Designer · 25PM · 25Senior dev · 80Lead · 75Founder · 37
vue
<VxSankeyChart :nodes="career.nodes" :links="career.links" />

Omit nodes — the chart builds them from the union of link sources and targets.

A · 15C · 18D · 17B · 20
vue
<VxSankeyChart
  :links="[
    { source: 'A', target: 'C', value: 10 },
    { source: 'A', target: 'D', value: 5 },
    ...
  ]"
/>

Compact (thin nodes) ​

direct · 320search · 1.0ksocial · 250referral · 300email · 210landing · 1.3kpricing · 870docs · 420signup · 820checkout · 700bounce · 880
vue
<VxSankeyChart :nodes="nodes" :links="links" :nodeWidth="8" :linkOpacity="0.45" />

Without values in labels ​

CoalGasNuclearWindSolarHydroElectricityHeatingIndustryResidentialCommercialTransport
vue
<VxSankeyChart :nodes="nodes" :links="links" :showValues="false" />

Props ​

PropTypeDefaultDescription
nodesSankeyNode[][]{ id, name?, color? } — inferred from links if empty
linksSankeyLink[][]{ source, target, value, color? }
heightnumber420SVG height
nodeWidthnumber16Node bar width
nodeGapnumber14Vertical gap between nodes
nodeRadiusnumber3Node corner radius
colorsstring[][]Palette override
linkOpacitynumber0.35Base link opacity
showLabelsbooleantrueShow node names
showValuesbooleantrueAppend values in labels
tooltipbooleantrueHover tooltip
animatebooleantrueFade in on mount
iterationsnumber12Layout relaxation steps

Events ​

EventPayload
hover-node{ node }
hover-link{ link }
click-node{ node }
click-link{ link }