Viewing a saved revision (read-only)
RKJfMmhK-OCdhC9rSp8Mc
CCurran Kelleher
Last edited Nov 2, 2026
Created on Nov 2, 2026
Created from react-d3-starter template
UN WPP 2024 — Fertility vs. Life Expectancy (Grayscale Edition)
Dataset
- File:
/data/un_wpp_2024.csv(read-only virtual path) - 1,000 country-year rows, 16 countries, years 1960–2024
- Key columns used:
iso_code,location,region,year,total_population,fertility_rate,life_expectancy median_ageis entirely missing in the sample and is ignored.- Loaded at runtime with
d3.csv; the header may span multiple physical lines, so a real CSV parser is required (d3.csv satisfies this).
Visualization
Type: Scatter plot — fertility rate (x) vs. life expectancy (y), one marker per country at its latest available year.
Encodings (strictly monochromatic):
- x:
fertility_rate, linear scale, zero baseline - y:
life_expectancy, linear scale, higher is up - marker shape + gray level:
region— nominal categories use both a distinct shape (circle, square, diamond, triangle, star) and a distinct gray token, so categories remain distinguishable in grayscale/print - marker area:
total_population(sqrt scale, area-honest) - annotations: directional note about the demographic transition; source note with dataset provenance
Interactions:
- Hover/focus highlights a country in near-black and dims the others
- Custom HTML tooltip (white, thin gray border, 8px radius) with tabular numerals and explicit units
- Keyboard focusable marks with visible outlines and ARIA labels
- 180ms restrained transitions; disabled under
prefers-reduced-motion
Design tokens
All grayscale values live in one shared token object in renderScatter.js
mirroring the CSS custom properties in styles.css. Data, scales, and
interaction logic are separated from presentation.
Files
index.html— page shell, import map, Inter fontindex.jsx— mounts<App />App.jsx— loads data, header, tooltip element, source noteviz.js— render entry pointrenderScatter.js— grayscale scatter plotuseContainerDimensions.js— responsive container sizingstyles.css— design tokens and layout stylesREADME.md— this documentation