Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Rendering data with react (pie chart)

Public visualization

Viewing a saved revision (read-only)

097eed5178f84ac4b0c6b9bf62113bdb

Fork of Rendering data with react (pie chart)

0 stars1🌍 Public
SSabin Bhandari
Last edited May 29, 2021
Created on May 29, 2021

This example shows a horizontal bar chart of the ten most populous countries, using United Nations population data for 2020. It loads the data with `d3.csv` and renders each country as an SVG `<rect>` element. React hooks (`useState` and `useEffect`) manage the asynchronous data loading, while `d3.scaleBand` and `d3.scaleLinear` map country names and population values to pixel positions and bar widths. The visualization updates from a loading state to the final chart once the CSV resolves.

AI-generated description

A program that loads in some data about CSS named colors using D3 utilities, and uses React to render data.