Skip to main content
100%

Fork of D3 and React Hooks

✓ Published0🌍 Public
AAdriana Rodriguez Sanabria
Last edited Nov 23, 2021
Created on Nov 12, 2021
Forked from D3 and React Hooks

A React hook-based pie chart example demonstrates how to render D3-generated SVG arcs with state-managed data updates. Using `useState` and `useEffect`, the app generates random numeric data with `d3.range` and `Math.random`, then passes it to a `PieSvg` component that computes arc paths via `d3.pie()` and `d3.arc()`. A button click triggers `setData` to regenerate values, while a separate `ColorLegend` component renders interactive colored circles with hover effects that fade non-hovered ticks using opacity. The visualization shows D3-created SVG elements managed entirely by React’s render cycle.

AI-generated description
MIT Licensed

Similar vizzes