Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Rendering Data with React & D3

Public visualization

Viewing a saved revision (read-only)

9312563a60b542259e9ae2190ddc7d89

Rendering Data with React & D3

0 stars1🌍 Public
JJanet Li
Last edited Aug 14, 2021
Created on Aug 14, 2021

This example renders a donut chart of CSS named colors, with each slice sized equally and filled using the color’s hex value from a CSV dataset. The code combines React state and hooks—`useState`, `useEffect`, and `useCallback`—with D3 utilities `csv`, `pie`, and `arc` to load data and compute path geometries. SVG paths are generated inside a React component, while the chart is centered via a `<g>` transform. Loading feedback displays the text "Loading..." until the CSV arrives.

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.