← Categorical palette

color-01-categorical.A

Life expectancy at birth — 12 countries vs. world baselineAbove baselineBelow baseline5060708090world baseline 73.5yearsJapan84.0 (+10.6)France83.0 (+9.5)Germany80.8 (+7.3)United States78.9 (+5.4)China78.0 (+4.5)Brazil76.0 (+2.5)Mexico75.3 (+1.8)India72.2 (−1.3)Egypt, Arab Rep.71.8 (−1.7)Indonesia71.3 (−2.2)South Africa66.3 (−7.2)Nigeria54.6 (−18.9)
Arm
A · Claude default
Method
clean subagent, naive prompt
Mode
refine — the treated arms ran on the default arm's output, so the only difference is the lever
Fixture
table12
Runs
3 · shipped: median
Generated
2026-07-26

Verbatim prompt

Here is a dataset:

{
  "name": "table12",
  "source": "https://api.worldbank.org/v2/country/USA;JPN;DEU;BRA;IND;NGA;CHN;MEX;ZAF;FRA;IDN;EGY/indicator/SP.DYN.LE00.IN?format=json&mrnev=1 (FALLBACK: primary lichess explorer failed with \"lichess 401\"; using World Bank life expectancy at birth, 12 countries, baseline = world value)",
  "fetched": "2026-07-26",
  "baseline": 73.48,
  "unit": "years (life expectancy at birth)",
  "rows": [
    {
      "label": "Brazil",
      "value": 76.02,
      "delta": 2.54
    },
    {
      "label": "China",
      "value": 78.02,
      "delta": 4.54
    },
    {
      "label": "Germany",
      "value": 80.79,
      "delta": 7.31
    },
    {
      "label": "Egypt, Arab Rep.",
      "value": 71.81,
      "delta": -1.67
    },
    {
      "label": "France",
      "value": 82.98,
      "delta": 9.5
    },
    {
      "label": "Indonesia",
      "value": 71.29,
      "delta": -2.19
    },
    {
      "label": "India",
      "value": 72.23,
      "delta": -1.25
    },
    {
      "label": "Japan",
      "value": 84.04,
      "delta": 10.56
    },
    {
      "label": "Mexico",
      "value": 75.26,
      "delta": 1.78
    },
    {
      "label": "Nigeria",
      "value": 54.63,
      "delta": -18.85
    },
    {
      "label": "United States",
      "value": 78.89,
      "delta": 5.41
    },
    {
      "label": "South Africa",
      "value": 66.31,
      "delta": -7.17
    }
  ]
}

It is 12 countries' life expectancy at birth in years, and each country's difference from the World Bank world baseline of 73.48 years.

Write a chart of it as an ES module with exactly this shape:

export const meta = { fixture: "table12", width: 640, height: 400 };
export function render(svg, data) { /* mutate the passed <svg> element in place */ }

`data` is the object above. You get a real <svg> element in a jsdom document —
use svg.ownerDocument and createElementNS, or a d3 selection over it. No
network. No Date.now() or Math.random(). Return only the module code.