Vesture

Charts

SankeyChartNew in 0.8.0

Flow diagram where link thickness is proportional to value. Hover or focus a node to isolate its flows.

SankeyChart

Preview

Node width
Link opacity
Ads → Visits: 400Organic → Visits: 600Visits → Sign-up: 350Visits → Bounced: 650Sign-up → Trial: 300Sign-up → Churned: 50Trial → Paid: 120Trial → Churned: 180Ads 400Organic 600Visits 1000Sign-up 350Trial 300Bounced 650Paid 120Churned 230

Hover or focus a node to isolate its flows; click a link or node for details.

Usage

tsx
import { SankeyChart } from "@vesture/react";

<SankeyChart
  width={760}
  height={380}
  linkColor="gradient"
  nodes={[{ key: "visits", label: "Visits" }, { key: "signup", label: "Sign-up" }, { key: "paid", label: "Paid" }]}
  links={[
    { source: "visits", target: "signup", value: 350 },
    { source: "signup", target: "paid", value: 120 },
  ]}
/>

Behavior

  • Columns are assigned by longest path from the sources; links that would close a cycle are ignored for layering.
  • linkColor accepts a mode (source, target, gradient, neutral) or a function for per-link colors.

Props

PropTypeDefaultDescription
nodes{ key; label?; color? }[]—Required.
links{ source; target; value }[]—Required. Keys refer to nodes.
width / heightnumber—Required, in px.
nodeWidth / nodePaddingnumber14 / 14Node geometry.
align"left" | "justify""justify"Whether sinks are pushed to the last column.
linkColor"source" | "target" | "gradient" | "neutral" | (link, layout) => string"source"Link coloring.
linkOpacity / dimmedOpacitynumber0.35 / 0.08Normal and de-emphasised link opacity.
colorsstring[]—Palette cycled by node index.
renderNodeLabel(node, info) => ReactNode—Replaces the label.
onNodeClick / onLinkClickfunction—Make nodes / links interactive.