🌍 Public
Viewing a saved revision (read-only)
c0cfd14c33064af6871284a35706ae9e
V3_Loading data with React and D3
This example demonstrates how to build a React application that asynchronously loads a CSV file and visualizes it as a pie chart. The chart maps CSS color names from the loaded data into a semicircular arc, with each color’s RGB hex value filling its corresponding segment. The code combines React’s `useState` and `useEffect` hooks with D3’s `csv` parsing and `arc` generator to create the SVG paths. Data is fetched from a GitHub Gist URL, and a loading message displays while the data is pending.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.