[04] Animated bar chart - Using React Hooks with D3
✓ Published1🌍 Public
Ggjonor
Last edited Feb 22, 2020
Created on Feb 18, 2020
Forked from [03] Axes and scales - Using React Hooks with D3
This example shows an interactive animated bar chart where users can increment, decrement, filter, or append values to a dataset, with bars flipping vertically and transitioning smoothly to new heights. Built with React Hooks and D3 v5, it uses `scaleBand` for the categorical x-axis, `scaleLinear` for y and color interpolation, and `selection.transition()` to animate bar heights and fill colors based on a clamped color scale. The SVG rendering uses `transform: scale(1, -1)` to flip bars, with axes positioned via `axisBottom` and `axisRight`.
AI-generated description2020-w08-3
Tutorials by The Muratorium:
- [04] Animated bar chart
- scaleBand for mapping categorical scale to bands
- selection.transition() to animate properties
- Flipping bars with transform scale -1 to animate the upper end
- Linear scale color interpolation
- scale.clamp() to limit interpolation at domain ends
MIT Licensed