Export Code

Claude 3.7 Test

Curran Kelleher

Last edited Feb 25, 2025
Created on Feb 24, 2025
Forked from D3 Starter

D3 Stacked Bar Chart Example

This is a simple example that demonstrates how to create a stacked bar chart using D3.js. The visualization includes:

  • A stacked bar chart with 4 groups and 5 categories
  • Grid lines that appear behind the bars
  • Axes showing groups and values
  • A legend showing each category
  • A title

The SVG is set to fill the entire page, and each segment has a different color with a white stroke for better visibility.

Features

  • Responsive layout that fills the browser window
  • Color-coded stacked segments
  • Grid lines positioned behind the bars
  • X and Y axis labels
  • Legend showing category names

Running the Example

  1. Install dependencies: npm install
  2. Build the project: npm run build
  3. Open index.html in your browser
MIT Licensed