Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Bar Chart with React & D3

Public visualization

Viewing a saved revision (read-only)

fdd9c7bf128649b9893f1acbd562d499

Making a Bar Chart with React & D3

0 stars0🌍 Public
MMGamboa
Last edited May 6, 2021
Created on May 5, 2021

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 description

A program that loads in some data about CSS named colors using D3 utilities, and uses React state to keep track of the data.