Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Loading Data with D3 and React

Public visualization

Loading Data with D3 and React

0 stars0🌍 Public
WWaseem Medhat
Last edited Oct 17, 2020
Created on Oct 17, 2020

This example shows a bar chart of the top 10 countries by projected 2020 population, using a dataset loaded asynchronously from a CSV file hosted on GitHub. The visualization renders as SVG rectangles scaled with `d3.scaleLinear` and `d3.scaleBand`. React’s `useState` and `useEffect` hooks manage the data-fetching lifecycle, calling `d3.csv` to parse the data and updating state once it arrives. A loading placeholder displays until the data is ready, then the bars appear.

AI-generated description

A program that loads data with D3 and uses React state to keep track of the data.

Comments

Sign in to join the discussion.

MIT Licensed