Activity-6 Question-2
✓ Published0🌍 Public
This example presents a stacked bar chart of city ratings, showing the percentage distribution across rating categories (from below 4.0 to above 8.0) for 19 U.S. cities. The visualization uses a horizontal layout with a color-mapped legend on the right. Built with D3 v7, the code loads data from a CSV file via `d3.csv` and employs `d3.stack()` to compute the stacked segments, `d3.scaleBand()` for the y-axis city categories, and `d3.axisBottom()` for the x-axis. Interactive tooltips appear on mouseover, displaying the exact percentage for each rating segment.
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.
MIT Licensed