Normalized Stacked Bar Chart
This example demonstrates a normalized stacked bar chart built with D3 v4, jQuery, and Underscore.js, rendering to SVG. The chart reads a CSV file containing any number of groups and up to eight categories, then calculates each category's percentage of the row total in JavaScript before drawing. The x-axis uses a linear scale from 0 to 100 percent, and each horizontal bar is subdivided into colored segments representing categories, with labels for values above 5%. A total row is computed dynamically and appended to the bottom of the chart, and a legend displays the category colors. The visualization is implemented without D3's stack layout, manually positioning the rectangles.
AI-generated descriptionCreate a normalized stacked bar chart in d3 (without the stack layout).
The CSV file can contain any number of groups and up to 8 categories. It must not have a total row at the bottom; that row is calculated with Javascript.
Libraries: d3.js, underscore.js, jQuery
forked from <a href='http://bl.ocks.org/HarryStevens/'>HarryStevens</a>'s block: <a href='http://bl.ocks.org/HarryStevens/dea8fdcdae7401ab486bfc7fcc9f6882'>Normalized Stacked Bar Chart</a>