Datavis 2020 Episode 21 - Making a Bar Chart with React & D3
✓ Published1🌍 Public
This example shows a horizontal bar chart of the top ten countries by 2020 population, loaded from an external CSV of UN Population data. The React component uses `useState` and `useEffect` to fetch and parse the data with `d3.csv`, then renders SVG `<rect>` elements. Scales are created with `d3.scaleBand` for the categorical country axis and `d3.scaleLinear` for the quantitative population axis, with bar widths proportional to population values. Rendering is handled entirely through React JSX, while D3 v5 provides the data loading and scaling functions.
AI-generated descriptionFinished product of this lesson
MIT Licensed