Skip to main content
100%

Datavis 2020 Episode 21 - Making a Bar Chart with React & D3

✓ Published1🌍 Public
RRichard Burd
Last edited Jan 23, 2022
Created on Jan 11, 2022
Forked from HTML Starter

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 description

Finished product of this lesson

MIT Licensed

Similar vizzes