Fork of Religion by Country
This stacked bar chart visualizes the estimated religious breakdown of the world’s 20 most populous countries in 2010, drawing data from the Pew Research Center’s Global Religious Landscape. Hovering over the legend highlights a single religion while dimming others. The visualization uses D3’s `flatRollup` and `stack` to aggregate and stack religions, along with `scaleBand` for the categorical country axis. Colors are assigned via `scaleOrdinal`, and the legend’s hover interactions are implemented through `mouseenter` and `mouseleave` events that update the `hoveredColorValue` state, controlling opacity and stroke emphasis.
AI-generated descriptionStacked bars showing estimated religion breakdown of the most populous 20 countries in 2010. Based on an example from the tutorial Splitting Charts. Interactions:
- Hover over the legend to highlight religions.
Data is from The Global Religious Landscape by Pew Research, generated using this processing script.