Animated Chart
A React component renders an SVG bar chart of annual values, with three bars for the years 2020 through 2022. A button click swaps the dataset, triggering a smooth transition where the bars animate their height and vertical position over one second using d3’s `transition`. The chart uses `d3.scaleBand`, `d3.scaleLinear`, `d3.axisBottom`, `d3.axisLeft`, and `d3.selectAll` to build and update the visualization within a `useEffect` hook on data changes.