Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

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

Public visualization

Viewing a saved revision (read-only)

d48d5edb5dd34d55a45231bf746f4bc9

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

0 stars1🌍 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