# Alluvial

> Use an alluvial to show how the same items move between categories across a few steps: who stayed, who switched and where to. Takes the example's three-year table or any tracked items as { steps: [...], items: [{ name, value?, path: [category per step] }] }, with 2 to 5 steps.

- Data type: Movement between stages (`flow`)
- Pro · not released yet: its code is not available; try it on its page, or use a free chart of the same data type (`flow`)
- Example: **Eight countries now get the most power from wind, solar and other renewables; none did in 2000** (Largest source of electricity in each country generating at least 20 TWh, 2000, 2012 and 2024)
- How to read it: Each strand is one country; it sits in the block of its largest electricity source in each year, so a strand that changes block switched.
- Phone: Not recommended for mobile (Smallest labels are 5.9 px on a 390 px phone) · Video formats: 16:9 (best 16:9)

## Use it when
- the same items are classified again at each step
- you want to see switching, not just totals
- there are 2 to 5 steps and up to about 8 categories
- customers moving between plans, users between states, anything re-classified at each step: pass { steps, items } with each item's path

## Avoid it when
- items are not tracked individually (use stacked bars per step)
- flows have volumes that split one item (use a Sankey)
- there are many steps (use a slope or a bump chart)

## Fields (data.json)
- `years` (year): the steps
- `sources` (category): the categories, in ink order
- `countries[].country` (place): one strand
- `countries[].twh2024` (number, unit "TWh", format count): electricity generated in 2024, terawatt-hours
- `countries[].y2000, y2012, y2024` (category): the country's largest source in each year

Units are the example's: with your own data, set each number field's `unit` and `format` (percent, count, decimal, currency, compact) in the meta you pass to mount, or `chartreuse render --unit field=text --format field=count`. Scales and labels follow your data.

## Interactions, motion, sound
- hover or tap a strand to read one country's route
- hover a block to count its countries
- the button recolours strands by where they ended
- Motion: The strands flow from 2000 to 2024 once, left to right, when the chart comes into view.
- Sound: A pop on hover pitched by source; a chime on recolour. Quiet while it draws and between steps; mute it from its card. (sound is off until the viewer turns it on)

## Example spec
```json
{
  "chart": "alluvial",
  "title": "Eight countries now get the most power from wind, solar and other renewables; none did in 2000",
  "subtitle": "Largest source of electricity in each country generating at least 20 TWh, 2000, 2012 and 2024",
  "data": "/charts/alluvial.data.json"
}
```

## Source
Energy dataset (electricity generation by source), Our World in Data (Ember, Energy Institute Statistical Review of World Energy) (CC BY 4.0), retrieved 2026-12-01: https://github.com/owid/energy-data

Note: "Wind, solar and other" also includes bioenergy and other renewables. 83 countries with complete data for all three years.

Live: /charts/alluvial · Manifest: /charts/alluvial.json · Tags: switching, categories over time, parallel sets, energy, electricity, transition
