🌍 Public
Making a Bar Chart with React & D3
This example shows how to build a bar chart with React and D3, displaying the top 10 countries by population from a 2019 UN dataset. The chart renders SVG rectangles, with countries on the y-axis using `scaleBand` and population values on the x-axis using `scaleLinear`. The data is loaded asynchronously via `d3.csv`, and React state manages the loading and storage of the parsed dataset. The visualization demonstrates a clean separation of concerns, where D3 handles scales and data loading while React manages component rendering and state updates.
AI-generated descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React state to keep track of the data.
MIT Licensed
Comments
Sign in to join the discussion.