Skip to main content
100%

Stacked Bar Chart

✓ Published0🌍 Public
Mmbostock
Last edited Oct 7, 2018
Created on Oct 13, 2012

This stacked bar chart displays the population distribution across seven age groups for each U.S. state, sorted by total population. Data is loaded from a CSV file using d3-dsv. The chart uses d3.scaleBand for the x-axis, d3.scaleLinear for the y-axis with SI-prefix formatting via d3-format, and d3.scaleOrdinal for color encoding. d3-shape’s d3.stack computes the stacked positions, while d3.axisBottom and d3.axisLeft render the axes.

AI-generated description

This stacked bar chart is constructed from a CSV file storing the populations of different states by age group. The chart employs conventional margins and a number of D3 features:

  • d3-dsv - load and parse data
  • d3-scale - x- and y-position, and color encoding
  • d3-format - SI prefix formatting (e.g., “10M” for 10,000,000)
  • d3-array - compute simple statistics (e.g., max)
  • d3-axis - display axes
  • d3-shape - computed stacked positions
gpl-3.0 Licensed

Similar vizzes