Skip to main content
100%

CV: Stacked Bar Chart with Interactive Color Legend

✓ Published3🌍 Public
CCurran Kelleher
Last edited Nov 14, 2025
Created on Nov 14, 2025

This example presents a stacked bar chart visualizing the religious composition of populations across countries, using data from the CSV. An interactive color legend allows users to hover over religions to highlight corresponding segments while dimming others, and clicking a bar selects it with a black outline. Built with React and D3.js v7, the visualization uses `d3.stack` for data processing, `d3.scaleBand`, `d3.scaleLinear`, and `d3.scaleOrdinal` for scales, and renders SVG elements with smooth opacity transitions. The chart includes custom axes and labels, leveraging D3's data join mechanism for efficient updates.

AI-generated description
MIT Licensed

Similar vizzes