Grouped Bar Chart
✓ Published0🌍 Public
Mmbostock
Last edited Mar 1, 2019
Created on Oct 14, 2012
This grouped bar chart displays the populations of six U.S. states across seven age groups, loaded from a CSV file via d3.csv. The visualization uses d3.scaleBand for the state and age-group positions, d3.scaleLinear for the population axis, and d3.scaleOrdinal with a categorical color range to distinguish age categories. Bars are rendered as SVG rectangles, with axes generated by d3.axisBottom and d3.axisLeft, while d3.format applies SI prefixes (e.g., “10M”) to tick labels. A legend maps colors to age groups.
AI-generated descriptionThis grouped 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.csv - load and parse data
- d3.scale.ordinal - x-position encoding and color encoding
- d3.scale.linear - y-position encoding
- d3.format - SI prefix formatting (e.g., “10M” for 10,000,000)
- d3.max - compute domains
- d3.keys - compute column names
- d3.svg.axis - display axes
gpl-3.0 Licensed