Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Loading Data with React & D3

Public visualization

Viewing a saved revision (read-only)

a61514ba57e648f795d4f7010f4e9edb

Loading Data with React & D3

0 stars0🌍 Public
Zzhangwbhi
Last edited Sep 6, 2021
Created on Sep 6, 2021

This example shows how React state and D3 utilities work together to load and summarize a remote CSV dataset. The app fetches CSS named colors data from a GitHub gist URL using D3’s `csv` method, then stores the parsed result in React’s `useState` hook via `useEffect`. While loading, it displays “Loading…”, and once the data arrives, it renders a text summary computed by a custom `message` function that uses `d3.csvFormat` to report the dataset size in kilobytes, row count, and column count. The visualization relies on React 16.9 and D3 v5.

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.