Skip to main content
100%

Normalized Stacked Bar Chart

✓ Published0🌍 Public
LLauraCortes
Last edited May 19, 2017
Created on May 2, 2017

This normalized stacked bar chart displays each category’s composition as percentages of a whole, using horizontal segments that always fill the full bar height. The code loads a JSON array of time values, computes the satisfied portion by subtracting left hours from total hours, and sorts categories by total descending. Using d3.stack with the stackOffsetExpand offset, it converts raw counts into proportional shares, then renders SVG rectangles via d3.scaleBand for the x-axis and d3.scaleLinear for the y-axis. The legend lines and text are positioned at each segment’s midpoint, while the y-axis labels show percentage ticks.

AI-generated description

This variation of a stacked bar chart shows percentages rather than absolute numbers.

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

gpl-3.0 Licensed

Similar vizzes