Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Rendering Data with React and D3 2

Public visualization

Rendering Data with React and D3 2

0 stars0🌍 Public
JJoseIGuzman
Last edited May 10, 2021
Created on May 10, 2021

This example displays a horizontal bar chart of the top 10 countries by 2020 population, using data loaded from a CSV file via D3’s `csv` utility. It combines D3’s `scaleBand` and `scaleLinear` to map country names and population values to SVG `rect` elements, while React’s `useState`, `useEffect`, and `useCallback` manage the asynchronous data loading and rendering state. The chart updates only after the data arrives, showing a static list of bars scaled to the maximum population value.

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.

Comments

Sign in to join the discussion.

MIT Licensed