# Circle packing

> Use circle packing to show a hierarchy by size as circles inside circles: groups hold their members, each circle's area its value.

- Data type: Groups within groups (`hierarchy`)
- Free (MIT): install with `npx chartreuse add circle-packing`, or registry item `/r/circle-packing.json`
- Example: **India and China each have almost as many people as all of Africa** (Population by country, grouped by continent, 2023)
- How to read it: Each small circle is a country, its area its population; the big circles gather them by continent.
- Phone: Not recommended for mobile (On a phone labels are hard to read or overlap (checked by eye)) · Video formats: none passed; closest 9:16

## Use it when
- a hierarchy where the groups and the few biggest members are the story
- a friendly overview of 50 to 300 items
- exact comparison matters less than the gestalt

## Avoid it when
- precise comparison (circle packing wastes space and areas are hard to judge; use a treemap or bars)
- deep hierarchies (use a zoomable pack)
- few items (use bars)

## Fields (data.json)
- `country` (place): the country
- `continent` (category): the group
- `people` (number, unit "people", format count): population
- `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 country to read its population and shares
- hover or tap a continent's ring for its total
- Motion: Continents open like bubbles one after another, then their countries pop in, biggest first.
- Sound: A pop on hover. 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": "circle-packing",
  "title": "India and China each have almost as many people as all of Africa",
  "subtitle": "Population by country, grouped by continent, 2023",
  "data": "/charts/circle-packing.data.json"
}
```

## Source
Population; continents according to Our World in Data, Our World in Data (HYDE, Gapminder, UN World Population Prospects) (CC BY 4.0), retrieved 2026-12-01: https://ourworldindata.org/grapher/population

Note: Countries and territories with at least 100,000 people.

Live: /charts/circle-packing · Manifest: /charts/circle-packing.json · Tags: circle packing, bubbles, hierarchy, population, countries, continents, people
