{
  "id": "stacked-bars",
  "name": "Stacked bars",
  "family": "parts",
  "tier": "free",
  "summary": "Use stacked bars to compare totals across items and see what each total is made of, with a switch to compare the mix instead.",
  "title": "The US and China tied on gold at Paris 2024, but the US won 35 more medals",
  "subtitle": "Paris 2024 Olympic medals, top 12 nations by golds, count of medals",
  "howToRead": "Each bar is one nation's medals stacked gold, silver, bronze; switch to % to compare the mix rather than the haul.",
  "useWhen": [
    "a few items (5 to 15) each split into the same 2 to 5 parts",
    "both the totals and the mix matter",
    "readers can turn parts off to compare just one"
  ],
  "avoidWhen": [
    "more than five parts (the middle segments are hard to compare)",
    "only the mix matters (use a 100% bar or a marimekko)",
    "the parts don't add to a meaningful total",
    "values below zero (bars stack from zero)"
  ],
  "fields": [
    {
      "name": "code",
      "type": "id",
      "description": "a short unique code for the row (IOC country code)"
    },
    {
      "name": "country",
      "type": "category",
      "description": "the bar's name (the nation)"
    },
    {
      "name": "gold",
      "series": true,
      "type": "number",
      "sign": "non-negative",
      "description": "one stacked part per number key, in the data's order; 2 to 5 parts (more fold into Other), any names. Here: gold medals",
      "unit": "medals",
      "format": "count"
    },
    {
      "name": "silver",
      "series": true,
      "type": "number",
      "sign": "non-negative",
      "description": "silver medals",
      "unit": "medals",
      "format": "count"
    },
    {
      "name": "bronze",
      "series": true,
      "type": "number",
      "sign": "non-negative",
      "description": "bronze medals",
      "unit": "medals",
      "format": "count"
    }
  ],
  "hints": {
    "item": "country"
  },
  "interactive": [
    "filter"
  ],
  "interactions": [
    "hover or tap a segment to read the medal count and its share of the nation's haul",
    "a button per part (Gold, Silver, Bronze) switches it on or off and restacks the bars",
    "the % button rescales every bar to 100%"
  ],
  "motion": "Gold segments grow first, then silver, then bronze; toggles and the % switch restack the bars smoothly.",
  "sound": "A chime on toggles; a whoosh on the % switch; a pop on hover. Quiet while it draws and between steps; mute it from its card.",
  "annotations": [
    {
      "type": "underline",
      "words": "35 more medals",
      "in": "title"
    }
  ],
  "tags": [
    "stacked bar",
    "part to whole",
    "olympics",
    "sport",
    "medals",
    "legend toggle",
    "percent"
  ],
  "mobile": "adapts",
  "mobileNote": "Draws its own phone layout below 520px",
  "mobileChecked": "2026-12-02",
  "ratios": [
    "16:9"
  ],
  "bestRatio": "16:9",
  "source": {
    "title": "2024 Summer Olympics medal table",
    "publisher": "Wikipedia",
    "url": "https://en.wikipedia.org/wiki/2024_Summer_Olympics_medal_table",
    "license": "CC BY-SA 4.0",
    "retrieved": "2026-12-01"
  },
  "note": "Ordered as the official table: by golds, then silvers. Twelve of the 92 teams (NOCs) that won at least one medal."
}