Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Loading Data with React and D3

Public visualization

Viewing a saved revision (read-only)

20c50a4c38b7480389284ea3ccef4024

Loading Data with React and D3

0 stars0🌍 Public
JJasmine Ye Han
Last edited Jan 2, 2022
Created on Jan 1, 2022
Forked from Mouse Follower

This example demonstrates how to load external data in a React application using D3 utilities, displaying the dataset’s size in kilobytes, row count, and column count as formatted text. The code uses React’s `useState` and `useEffect` hooks to manage the asynchronous loading state, while `d3.csv` fetches the CSS named colors dataset from a GitHub gist. The `d3.csvFormat` function calculates the data size for the message. Rendering is handled through React DOM, producing an SVG-backed text output that transitions from a “Loading…” placeholder to the final statistics.

AI-generated description

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