# Bubble pit

> Use a bubble pit to show sizes as bubbles readers can grab: each item is a bubble whose area is its value, and they tumble, stack and bump like real balls.

- Data type: Values per item (`compare`)
- Pro · not released yet: its code is not available; try it on its page, or use a free chart of the same data type (`compare`)
- Example: **China and India alone have 2.3 billion people online** (Internet users in the 16 countries with the most, latest year (2024 or 2025); bubble area is people)
- How to read it: Each bubble's area is the number of people online in one country, coloured by region; drag one to shove the others.
- Interactive: drag
- Phone: Not recommended for mobile (9 labels overlap on a phone) · Video formats: none passed; closest 16:9

## Use it when
- a playful look at 5 to 20 sizes
- the two or three biggest items dominate
- a touch screen or a talk where people can play with the data

## Avoid it when
- readers must compare close values (use sorted bars)
- positions should mean something (bubbles land where physics puts them)
- more than about 25 items

## Fields (data.json)
- `world.users` (number, unit "people", format count): internet users worldwide
- `world.year` (year): year of the world total
- `countries[].country` (place): country
- `countries[].users` (number, unit "people", format count): people using the internet
- `countries[].year` (year): latest year with data

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
- drag or fling a bubble to bump the rest
- hover or tap a bubble to read its users and world share
- Drop again pours them back in
- Motion: Bubbles drop into the pit and settle with Matter.js physics when the chart comes into view; dragging wakes the simulation, which goes back to sleep once everything is still.
- Sound: A plink when bubbles bump after you drop or shove them, louder for harder knocks, at most a few a second; a pop when you grab one. Quiet while they first pour in; mute it from its card. (sound is off until the viewer turns it on)
- Physics settings: gravity, restitution, friction, drag, seed (the Studio's Physics section, a look's `physics`, or `render --physics key=value`; docs/look-format.md)

## Example spec
```json
{
  "chart": "bubble-pit",
  "title": "China and India alone have 2.3 billion people online",
  "subtitle": "Internet users in the 16 countries with the most, latest year (2024 or 2025); bubble area is people",
  "data": "/charts/bubble-pit.data.json"
}
```

## Source
Number of people using the Internet, Our World in Data (International Telecommunication Union via World Bank) (CC BY 4.0), retrieved 2026-12-01: https://ourworldindata.org/grapher/number-of-internet-users

Note: Regions are added for colour only. China and India are 2025 estimates; the other countries are 2024.

Live: /charts/bubble-pit · Manifest: /charts/bubble-pit.json · Tags: physics, Matter.js, bubbles, drag, size, internet, technology
