🌍 Public
Activity6_Question2
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 descriptionMIT Licensed
Comments
Sign in to join the discussion.