# Nested squares

> Use nested squares when each part is a slice of the one around it: a chain of ever-smaller wholes, zoomed one step at a time.

- Data type: Shares of a total (`parts`)
- Pro · not released yet: its code is not available; try it on its page, or use a free chart of the same data type (`parts`)
- Example: **Only 2.5% of Earth's water is fresh, and rivers hold 0.0002% of it all** (Where Earth's water is, cubic kilometres; each square's area is its volume)
- How to read it: Each square sits inside the one before it, its area its share of that square; step down the ladder to zoom in, since rivers are too small to see from the top.
- Interactive: zoom
- Phone: Adapts to mobile (Draws its own phone layout below 520px) · Video formats: 16:9 (best 16:9)

## Use it when
- a chain of wholes, each a part of the last (a funnel of scale)
- shares span many orders of magnitude
- zooming in tells the story better than one view

## Avoid it when
- the parts are siblings, not nested (use a treemap or bars)
- readers need every level in one static view
- the chain has more than about six steps

## Fields (data.json)
- `level` (category): the whole at this step
- `km3` (number, unit "km³", format count): water volume, cubic kilometres
- `otherKm3` (number, unit "km³", format count): the volume in this square that is not in the next one
- `otherNote` (text): what that remainder is

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 square or a step to read its volume and share
- tap a step on the ladder, or a square, to zoom to it
- Play zooms down the chain from all water to rivers
- Motion: Squares unfold from the corner largest first; each step zooms smoothly so the next square grows to fill the frame.
- Sound: A whoosh for each zoom. 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": "nested-squares",
  "title": "Only 2.5% of Earth's water is fresh, and rivers hold 0.0002% of it all",
  "subtitle": "Where Earth's water is, cubic kilometres; each square's area is its volume",
  "data": "/charts/nested-squares.data.json"
}
```

## Source
Where is Earth's water? (Water Science School, after Shiklomanov 1993), U.S. Geological Survey (Public domain (U.S. Government work)), retrieved 2026-12-01: https://www.usgs.gov/special-topics/water-science-school/science/where-earths-water

Note: Fresh water here is ice, fresh groundwater, soil moisture, permafrost, fresh lakes, swamps, the atmosphere, rivers and living things; totals are summed from the USGS table.

Live: /charts/nested-squares · Manifest: /charts/nested-squares.json · Tags: nested squares, zoom, scale, orders of magnitude, part to whole, water, earth science, rivers
