Skip to main content
100%

Render D3 + React

✓ Published0🌍 Public
MMayank Kumar
Last edited Sep 24, 2023
Created on Sep 24, 2023
Forked from Load data with d3

This example shows how React renders a pie chart from CSS named colors, where each slice’s fill matches its corresponding RGB hex value. The code loads CSV data via `d3.csv` inside a React component, using `useState` to hold the data while displaying a loading message. The chart is drawn with `d3.pie` and `d3.arc` to generate SVG paths, translated to the center of a 960×500 viewport. React 18 and D3 v7 are loaded from CDNs, with SVG output handled declaratively through JSX.

AI-generated description

Load data with React and use d3

MIT Licensed

Similar vizzes