# Bubble

> Use a bubble chart when a scatter needs a third measure, shown as each dot's area, usually how big or how many.

- Data type: Several measures per item (`relationships`)
- Free (MIT): install with `npx chartreuse add bubble`, or registry item `/r/bubble.json`
- Example: **Where families are small, lives are long** (Children per woman and life expectancy at birth, 2023; bubble area is population; 160 countries over 1 million people)
- How to read it: Each bubble is a country: left means fewer children, higher means longer lives, and bigger bubbles hold more people.
- Phone: Not recommended for mobile (On a phone labels are hard to read or overlap (checked by eye)) · Video formats: 16:9 (best 16:9)

## Use it when
- each item has two measures plus a size worth seeing
- the big items should dominate the eye on purpose
- 20 to 200 items

## Avoid it when
- readers must compare the sizes exactly (use bars)
- the third measure is not a size (use colour or small multiples)
- thousands of items would bury each other
- more than six colour groups (the rest share one grey "other")

## Fields (data.json)
- `country` (category): the item
- `continent` (category): colour group: any labels; up to six get their own colour, the rest share one grey "other"
- `fertility` (number, unit "births per woman", format decimal): children per woman (total fertility rate)
- `lifeExp` (number, unit "years", format decimal): life expectancy at birth, years
- `population` (number, unit "people", format count): people; sets the bubble's area

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 bubble to read all three measures
- hover a continent in the key to light its countries
- Motion: Bubbles pop up from nothing, biggest first, with a small overshoot; the biggest names fade in after.
- Sound: A pop on hover pitched by continent. 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": "bubble",
  "title": "Where families are small, lives are long",
  "subtitle": "Children per woman and life expectancy at birth, 2023; bubble area is population; 160 countries over 1 million people",
  "data": "/charts/bubble.data.json"
}
```

## Source
Fertility rate; life expectancy; population, Our World in Data (UN World Population Prospects 2024) (CC BY 4.0), retrieved 2026-12-01: https://ourworldindata.org/grapher/children-per-woman-un

Inspired by: [Gapminder Trendalyzer bubble chart](https://www.gapminder.org/tools/), Hans Rosling, Gapminder (linked, not copied).

Live: /charts/bubble · Manifest: /charts/bubble.json · Tags: bubble, gapminder, three measures, population, health, fertility, life expectancy
