Activity 7 Task2
This stacked bar chart visualizes how movie genres affect rating distributions, showing the percentage of films falling into five rating brackets (below 5.0, 5.0–6.5, 6.5–7.5, 7.5–8.5, and above 8.5) for genres like Documentary, Drama, Comedy, Romance, Animation, and Action. The chart reads horizontally, with each genre as a bar segmented by rating category, and hovering over any segment reveals the exact percentage via a tooltip. The visualization is built with D3.js (v7) using `d3.stack`, `d3.scaleLinear`, `d3.scaleBand`, and `d3.scaleOrdinal` for the color scheme, rendering as an SVG. Data is loaded from a local CSV file, and the tooltip formatting uses `d3.format` to display percentages.
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%.