Skip to main content
100%

E23 - Refactoring a Bar Chart

✓ Published1🌍 Public
VVanessa
Last edited Mar 16, 2021
Created on Mar 16, 2021

This bar chart shows the number of trips per region, rendered as horizontal bars using SVG within a React component. The code imports `scaleBand` and `scaleLinear` from d3 to map data to pixel coordinates, while React’s `useState` and `useEffect` handle asynchronous CSV loading via d3’s `csv` method. The `AxisBottom`, `AxisLeft`, and `Marks` components are separated for reuse, producing a clean, refactored visualization with a left margin aligned to the region labels.

AI-generated description

A program that loads in some using D3 utilities, and uses React to render the data as a radial burst! Refactored to made it simplier and smaller

Episode 23

<iframe width="560" height="315" src="https://www.youtube.com/watch?v=pEslJER9ekM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
MIT Licensed

Similar vizzes