# Bar race

> Use a bar race to show a ranking re-forming year by year, when the drama of overtaking is the point.

- Data type: Values over time (`time`)
- Pro · not released yet: its code is not available; try it on its page, or use a free chart of the same data type (`time`)
- Example: **China passed the United States as the largest CO₂ emitter in 2006** (Annual carbon dioxide emissions from fossil fuels and industry, top ten countries, million tonnes, 1950 to 2025)
- How to read it: Each bar is one country's emissions that year; press Play to watch the top ten re-rank.
- Phone: Adapts to mobile (Draws its own phone layout below 520px) · Video formats: 9:16 (best 9:16)

## Use it when
- a ranking changes over many time steps
- an audience will watch it play, like a video
- the leader changing is the story

## Avoid it when
- readers need to compare trends precisely (use lines)
- the ranking barely changes
- it will be read as a still image only

## Fields (data.json)
- `years` (year): the time steps
- `countries[].name` (category): every item that was ever in the top ten (2 or more; the top ten of each year are drawn)
- `countries[].mt` (number, unit "million tonnes", format count): CO₂ emissions, million tonnes, one per year (the value each bar shows)

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
- Play races through the years; the slider jumps to any year
- hover or tap a bar to read its emissions and rank
- Motion: Bars grow at first view; while playing they slide to their new rank and stretch to their new length each year.
- Sound: A chime in the year the last leader passes the first one; a pop on hover; a settle at the last year. Quiet while it draws and between years; mute it from its card. (sound is off until the viewer turns it on)

## Example spec
```json
{
  "chart": "bar-race",
  "title": "China passed the United States as the largest CO₂ emitter in 2006",
  "subtitle": "Annual carbon dioxide emissions from fossil fuels and industry, top ten countries, million tonnes, 1950 to 2025",
  "data": "/charts/bar-race.data.json"
}
```

## Source
Annual CO₂ emissions, Our World in Data (Global Carbon Budget, Global Carbon Project) (CC BY 4.0), retrieved 2026-12-01: https://ourworldindata.org/grapher/annual-co2-emissions-per-country

Note: Territorial emissions; countries' borders as today, with earlier years reconstructed by the source.

Live: /charts/bar-race · Manifest: /charts/bar-race.json · Tags: bar race, racing bars, ranking over time, climate, emissions, CO2
