# Slope chart

> Use a slope chart to compare each item at two moments, so both the change and any re-ordering show as the tilt and crossing of lines.

- Data type: Values per item (`compare`)
- Free (MIT): install with `npx chartreuse add slope-chart`, or registry item `/r/slope-chart.json`
- Example: **India went from 1 in 13 people online in 2010 to nearly 2 in 3** (Share of the population using the internet, %, 2010 and 2024, selected large countries and the world)
- How to read it: Each line joins a country's 2010 share (left) to its 2024 share (right); steeper lines are faster growth, and India is in blue.
- Phone: Adapts to mobile (Draws its own phone layout below 520px) · Video formats: 16:9 (best 9:16)

## Use it when
- exactly two time points or two conditions per item
- the change in rank matters as well as the change in value
- 5 to 15 items

## Avoid it when
- more than two time points (use a line chart)
- items cluster so tightly that labels cannot be placed
- the values are in different units

## Fields (data.json)
- `country` (place): the item; the row named hints.reference ("World" in the example), if present, is the dashed reference
- `y2010` (number, unit "%", format percent): the start value: share of people online in 2010, % (the left column is labelled hints.from, else the year in this description)
- `latest` (number, unit "%", format percent): share of people online in the latest year, %
- `latestYear` (year): optional: the latest year with data, the right column's label (else hints.to, else the year in latest's description)

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 line to isolate it and read both values
- Motion: Every line starts flat at its start value and tilts to its end value; the focus line (India) follows a beat later.
- Sound: A pop pitched by row 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": "slope-chart",
  "title": "India went from 1 in 13 people online in 2010 to nearly 2 in 3",
  "subtitle": "Share of the population using the internet, %, 2010 and 2024, selected large countries and the world",
  "data": "/charts/slope-chart.data.json"
}
```

## Source
Share of the population using the internet (ITU, via World Bank WDI IT.NET.USER.ZS), Our World in Data (CC BY 4.0), retrieved 2026-12-01: https://ourworldindata.org/grapher/share-of-individuals-using-the-internet

Live: /charts/slope-chart · Manifest: /charts/slope-chart.json · Tags: slope chart, slopegraph, before and after, internet, technology, two points
