Skip to main content
100%

Stacked Bar Chart

✓ Published0🌍 Public
JJdlv00
Last edited Oct 24, 2017
Created on Oct 24, 2017

A stacked bar chart displays the frequency of responses to a survey question about playing habits, broken down by occupational categories. Population totals across all categories are shown per response frequency, with each bar segment color-coded by profession. The chart is built using D3 v4 APIs including d3.csv for loading data, d3.stack for computing stacked positions, d3.scaleBand and d3.scaleLinear for positioning, and d3.scaleOrdinal for colors. Data is parsed from a CSV file and rendered as SVG with axes generated via d3.axisBottom and d3.axisLeft.

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

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/3886208'>Stacked Bar Chart</a>

forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/614b5d5d6df20fb06867760f124636dd'>Stacked Bar Chart</a>

forked from <a href='http://bl.ocks.org/Jdlv00/'>Jdlv00</a>'s block: <a href='http://bl.ocks.org/Jdlv00/d763d4c91ceb3a81b8545a303507b2ce'>Stacked Bar Chart</a>

gpl-3.0 Licensed

Similar vizzes