Stacked Bar Chart (ratings by genre)
This example shows a 100% stacked bar chart of movie ratings (G, PG, PG-13, R) by genre, where each bar represents the proportion of ratings within a genre. The chart uses d3.csv with d3.autoType to load data, then normalizes counts to percentages and builds horizontal stacks via d3.scaleBand, d3.scaleLinear, and d3.stack. Rectangles are rendered in SVG with d3.select and .join, and axes are created with d3.axisBottom and d3.axisLeft, while a legend uses d3.scaleOrdinal for colors.