# Icicle

> Use an icicle to show a hierarchy as stacked rectangles by level: each level is a column, each box as tall as its share; click to zoom.

- Data type: Groups within groups (`hierarchy`)
- Free (MIT): install with `npx chartreuse add icicle`, or registry item `/r/icicle.json`
- Example: **China alone makes a third of the world's electricity, most of it from coal** (Electricity generation by continent, biggest countries and source, 2024, TWh)
- How to read it: Read left to right from the world to continents, countries and sources; each box's height is its electricity. Tap a box to zoom into it.
- Interactive: zoom
- Phone: Not recommended for mobile (On a phone the chart isn't the main thing on screen (checked by eye)) · Video formats: 16:9 (best 9:16)

## Use it when
- three or more levels of a hierarchy
- you want sizes comparable as straight lengths (easier than a sunburst's angles)
- readers drill down by clicking

## Avoid it when
- one or two levels (use a treemap or bars)
- hundreds of leaves at once (they become slivers; zoom helps only so much)
- values can be negative

## Fields (data.json)
- `continents[].name` (category): the continent
- `continents[].children[].name` (place): a country, or the rest of the continent
- `continents[].children[].mix` (number, unit "TWh", format count): electricity by source (Coal, Gas, Hydro, Nuclear, Wind and solar, Other), TWh
- `year` (year): the year measured

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 box to read its TWh and shares
- tap a box to zoom into it; tap it again to step back out
- Motion: Columns slide in from the left one level at a time; zooming stretches the chosen box to the full height.
- Sound: A whoosh on each zoom; a pop on hover pitched by source. 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": "icicle",
  "title": "China alone makes a third of the world's electricity, most of it from coal",
  "subtitle": "Electricity generation by continent, biggest countries and source, 2024, TWh",
  "data": "/charts/icicle.data.json"
}
```

## Source
Energy dataset (electricity generation by source); continents from Our World in Data, 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: Each continent shows its four biggest producers; the rest of the continent is one box. The world is the sum of the six continents.

Live: /charts/icicle · Manifest: /charts/icicle.json · Tags: icicle, partition, hierarchy, zoom, drill down, energy, electricity, coal, countries
