Skip to main content
Public

Share visualization

Loading preview…

Data Analysis

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportHTML, source ZIP

Viewing a saved revision (read-only)

RKJfMmhK-OCdhC9rSp8Mc

Data Analysis

0 stars16Public
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_age is 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 font
  • index.jsx — mounts <App />
  • App.jsx — loads data, header, tooltip element, source note
  • viz.js — render entry point
  • renderScatter.js — grayscale scatter plot
  • useContainerDimensions.js — responsive container sizing
  • styles.css — design tokens and layout styles
  • README.md — this documentation