Skip to main content
100%

Activity6_Question2

✓ Published0🌍 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
MIT Licensed

Similar vizzes