Skip to main content
100%

Cohort Trails

✓ Published0🌍 Public
TThanaporn-sk
Last edited Mar 31, 2017
Created on Mar 31, 2017

Cohort Trails visualizes U.S. census population data, tracking five-year birth cohorts from 1850 to 2010. Animated dots represent each cohort’s population, with trailing lines showing decline as cohorts age; increases reflect net immigration exceeding mortality. The animation runs on a slider, toggled by the space bar. Built with d3.v4 and rendered using both SVG and Canvas, the code employs d3.nest for data aggregation and d3.scaleThreshold for year interpolation. Data originates from the Minnesota Population Center.

AI-generated description

Block-a-Day #15. An alternative presentation of data from Mike Bostock's Population Pyramid block. Census observations of population cohorts, those born in the same five-year span, are shown as dots animated over time, with trailing lines showing the decline in population as the cohort ages (increases correspond to net immigration exceeding mortality for the cohort).

Space bar toggles animation.

Data Source: Minnesota Population Center via Mike Bostock.

What I Learned: The animation/slider logic was a good exercise in boiling down more complex code to the bare necessities (all in, it's about 50 lines). The most fiddly bit is at line 177, where we adjust the slider width to account for the extra space to the left and right of the bar.

What I'd Do With More Time: Highlight a cohort to emphasize it trajectory over time. Break out male and female population. Could be very cool to toggle between absolute and relative (i.e. mortality) values.

Block-a-Day

Just what it sounds like. For fifteen days, I will make a D3.js v4 block every single day. Rules:

  1. Ideas over implementation. Do something novel, don't sweat the details.
  2. No more than two hours can be spent on coding (give or take).
  3. Every. Single. Day.

Previously

forked from <a href='http://bl.ocks.org/cmgiven/'>cmgiven</a>'s block: <a href='http://bl.ocks.org/cmgiven/48f76b7b7e8c482e1d227ab5410fcdcb'>Cohort Trails</a>

mit Licensed

Similar vizzes