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)

03440178f09b41bfb6295234e4663402

Loading Data with React & D3

0 stars1🌍 Public
JJi Won Yeom
Last edited Jan 24, 2022
Created on Jan 24, 2022

This example visualizes 148 CSS named colors as slices of a pie chart, with each slice filled using the color’s RGB hex value from a CSV dataset loaded via `d3.csv`. The React component uses the `useState` and `useEffect` hooks to fetch the data asynchronously and display a “Loading” message until it arrives. Once loaded, the code builds the chart using D3’s `pie()` and `arc()` generators, rendering SVG paths within a React-managed `<svg>` element. The visualization highlights the integration of D3’s data-loading and layout utilities with React’s declarative state management.

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.