Skip to main content
100%

Stacked Bar Chart with d3.js

✓ Published0🌍 Public
Aakshayvenishetty1437
Last edited Jul 21, 2023
Created on Jul 21, 2023
Forked from Hello VizHub

This example creates a stacked bar chart from sample data using D3.js v6, displaying three quantitative values (valueA, valueB, valueC) across three categories. The chart renders as an SVG, with bars stacked using the D3 `d3.stack()` generator and colored via `d3.schemeCategory10`. Axes and labels are added using `d3.axisBottom` and `d3.axisLeft`, with scaling handled by `d3.scaleBand` and `d3.scaleLinear`. The code demonstrates importing D3 via a CDN and using local ES6 modules.

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