# Alluvial (Sankey example)

> WestCoast Charts 1.1.5, release, public Core release, on npm. HTML: https://westcoast-charts.com/gallery/sankey/alluvial/ · Index for agents: https://westcoast-charts.com/llms.txt

Plan changes across three yearly snapshots; stage labels above the columns.

- Chart type: `sankey` (Sankey)
- Collection: Sankey · Sankey
- Raw configuration: https://westcoast-charts.com/gallery-src/sankey/alluvial.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/premium/sankey/alluvial.html

## Setup

```js
import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'
import premium from 'west-coast-charts/premium'

WestCoastCharts.use(types).use(premium)
const WestCoastChartsPremium = premium
WestCoastCharts.setLicenseKey(LICENCE_KEY) // paid production licence; localhost evaluation needs no key
```

## Options

```js
const options = {
  chart: {
    height: 420,
    toolbar: {
      show: false
    },
    type: "sankey"
  },
  series: [
    {
      data: [
        {
          stage: 0,
          from: "Free",
          to: "Free",
          value: 173
        },
        {
          stage: 0,
          from: "Free",
          to: "Pro",
          value: 38
        },
        {
          stage: 0,
          from: "Free",
          to: "Team",
          value: 47
        },
        {
          stage: 0,
          from: "Free",
          to: "Churned",
          value: 73
        },
        {
          stage: 0,
          from: "Pro",
          to: "Free",
          value: 68
        },
        {
          stage: 0,
          from: "Pro",
          to: "Pro",
          value: 218
        },
        {
          stage: 0,
          from: "Pro",
          to: "Team",
          value: 53
        },
        {
          stage: 0,
          from: "Pro",
          to: "Churned",
          value: 65
        },
        {
          stage: 0,
          from: "Team",
          to: "Free",
          value: 54
        },
        {
          stage: 0,
          from: "Team",
          to: "Pro",
          value: 77
        },
        {
          stage: 0,
          from: "Team",
          to: "Team",
          value: 168
        },
        {
          stage: 0,
          from: "Team",
          to: "Churned",
          value: 72
        },
        {
          stage: 0,
          from: "Churned",
          to: "Free",
          value: 72
        },
        {
          stage: 0,
          from: "Churned",
          to: "Churned",
          value: 60
        },
        {
          stage: 1,
          from: "Free",
          to: "Free",
          value: 211
        },
        {
          stage: 1,
          from: "Free",
          to: "Pro",
          value: 38
        },
        {
          stage: 1,
          from: "Free",
          to: "Team",
          value: 31
        },
        {
          stage: 1,
          from: "Free",
          to: "Churned",
          value: 42
        },
        {
          stage: 1,
          from: "Pro",
          to: "Free",
          value: 28
        },
        {
          stage: 1,
          from: "Pro",
          to: "Pro",
          value: 242
        },
        {
          stage: 1,
          from: "Pro",
          to: "Team",
          value: 41
        },
        {
          stage: 1,
          from: "Pro",
          to: "Churned",
          value: 30
        },
        {
          stage: 1,
          from: "Team",
          to: "Free",
          value: 23
        },
        {
          stage: 1,
          from: "Team",
          to: "Pro",
          value: 54
        },
        {
          stage: 1,
          from: "Team",
          to: "Team",
          value: 61
        },
        {
          stage: 1,
          from: "Team",
          to: "Churned",
          value: 55
        },
        {
          stage: 1,
          from: "Churned",
          to: "Free",
          value: 70
        },
        {
          stage: 1,
          from: "Churned",
          to: "Churned",
          value: 84
        }
      ]
    }
  ],
  plotOptions: {
    sankey: {
      alluvial: {
        enabled: true,
        stages: ["2024", "2025", "2026"]
      },
      nodeWidth: 10,
      nodes: [
        {
          id: "Churned",
          color: "#94a3b8"
        }
      ]
    }
  },
  theme: {
    mode: "light",
    preset: "coastal"
  }
}

const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render()
```

## Verify

- Text check (Library 1.1.5): load `west-coast-charts/agent/describe` and call `chart.describe({ format: "json" })` for the actual drawn state. The live reader is on this example’s HTML page.
- Command line (Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm, https://westcoast-charts.com/docs/cli/index.md): `wcc chart export sankey-alluvial.json --out sankey-alluvial.svg --with-table` (save the options above as JSON first)
