Viewing a saved revision (read-only)
37cda4d3a0ab4817877fc95fd0051004
Activity-6 Task2
This stacked bar chart visualizes the distribution of IMDb movie ratings across six genres, showing the proportion of films falling into five rating bands from below 5.0 to above 8.5. Each genre’s stacked bar sums to 100%, with color-coded segments revealing how documentary and animation films skew toward higher ratings while action movies concentrate in lower ranges. The visualization uses d3.stack() to compute layered data, d3.scaleOrdinal() with a custom color palette, and d3.scaleBand() for the genre axis. Hovering over any segment triggers a tooltip displaying the precise percentage, implemented through mouse events on SVG rectangles created via d3.selectAll().enter().append(). The data comes from a CSV file containing pre-aggregated percentages for each genre and rating category.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.