Skip to main content
100%

Question2_Activity_6

✓ Published0🌍 Public
SSai Sandhya Nannapaneni
Last edited Oct 23, 2024
Created on Oct 23, 2024
Forked from Hello VizHub

This example shows a stacked bar chart that breaks down sales of three products—productA, productB, and productC—across four regions (North, South, East, West). The code reads a local `data.csv` file using `d3.csv` and `d3.autoType`, then builds the chart with D3 v7’s `scaleBand` for the x-axis, `scaleLinear` for the y-axis, and `d3.stack` to accumulate the segment values. Each region’s bar is divided into colored segments, with a legend identifying the product categories, and the y-axis is labeled “Sales.” The SVG output is generated directly through D3’s selection and append methods.

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