Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Question 2

Public visualization

Question 2

0 stars0🌍 Public
Rragasrikakarla27@gmail.com
Last edited Oct 30, 2025
Created on Oct 30, 2025
Forked from D3 Starter

This stacked bar chart visualizes energy consumption by source across five countries (USA, China, India, Germany, Brazil) for 2023. The chart uses D3 v7 with `d3.scaleBand` for the x-axis and `d3.scaleLinear` for the y-axis, rendering stacked segments via `d3.stack().keys()` to represent Coal, Oil, Natural Gas, Renewable, and Nuclear proportions. Data loads from `energy_data.csv` using `d3.csv()`. A legend, generated with SVG groups, identifies each energy source, while custom colors are assigned through `d3.scaleOrdinal`.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed