Activity-6_Question-2
This example visualizes the impact of movie genres on ratings using a stacked bar chart, where each genre (represented by vegetables in the data) is broken down into rating-level percentages that sum to 1. Hovering over any segment displays a tooltip with the precise percentage for that rating category. The chart is built with D3 v7, using `d3.stack()` to create stacked bars, `d3.scaleBand()` for the y-axis, and `d3.scaleLinear()` for the x-axis. User interactions are handled through `.on('mouseover')`, `.on('mousemove')`, and `.on('mouseout')` events, with data loaded from an embedded CSV.
AI-generated descriptionThe impact of genre on movie ratings
This stacked bar chart gives the percentage of each rating level within different movie genres. The aim is to show the impact of genre on movie ratings. When the mouse hovers over each bar, you can see pop-ups of accurate percentage of each rating level within each genre. Total percentage is 1, representing 100%.