Skip to main content
100%

Activity-6 Question-2

✓ Published0🌍 Public
Ccharanshiva769@gmail.com
Last edited Oct 22, 2024
Created on Oct 22, 2024

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 description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes