🌍 Public
Viewing a saved revision (read-only)
045c8f9858a344ba97aeaf129e3426ff
Loading Data with React & D3
This example demonstrates loading a CSV dataset of CSS named colors using D3’s `csv` utility and managing the asynchronous state with React’s `useState` and `useEffect` hooks. Once loaded, the data is rendered as a pie chart in SVG, where each slice is colored with the hex value from its corresponding row, using d3’s `pie` and `arc` generators. The chart fills the browser window, centered on the screen, and displays a “Loading…” message until the data arrives.
AI-generated descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React state to keep track of the data.