Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Activity6_Question2

Public visualization

Viewing a saved revision (read-only)

0d210fa36e794e20b41ca7d396387568

Activity6_Question2

0 stars0🌍 Public
Ssjannaikode@gmail.com
Last edited Apr 3, 2025
Created on Apr 3, 2025
Forked from Hello VizHub

This stacked bar chart displays the proportional contribution of five energy sources—coal, gas, nuclear, hydro, and renewable—to electricity generation across six countries. Each bar segments by source share using percentages. The visualization uses D3 v7’s `d3.stack()` and `d3.scaleOrdinal` for coloring, with `d3.axisBottom` and `d3.axisLeft` for scales. Hovering over a segment reveals a tooltip showing the exact percentage via `d3.select` and `event.pageX`/`pageY` positioning, with data loaded from a local CSV.

AI-generated description