Activity6_Question2
This visualization shows how different food categories—fruit, vegetables, meat, dairy, grains, and snacks—are distributed across six rating bands, from below 4 to above 8, as stacked horizontal bars representing proportions that sum to 100%. Each segment’s width encodes the percentage of ratings in that band, with colors distinguishing rating levels and a tooltip revealing exact percentages on hover. The chart loads data from a CSV file and uses d3.stack() for stacking, d3.scaleBand() and d3.scaleLinear() for positioning, and d3.axisBottom and d3.axisLeft for axes. An ordinal color scale maps rating keys to a fixed palette, and mouse events update tooltip content dynamically.