Skip to main content
100%

Fork of CV: pie chart

✓ Published0🌍 Public
AAddiga Himesh Chander
Last edited Mar 29, 2026
Created on Mar 29, 2026

This pie chart visualizes the distribution of device usage across four categories with varying values. A React component renders an SVG, using d3.pie to compute arc segments and d3.arc to generate the paths. The d3.scaleOrdinal function assigns a distinct color to each device. Text labels are positioned at each slice’s centroid with arc.centroid, displaying the device names directly on the chart. The visualization updates automatically when the container size changes, thanks to a ResizeObserver hook that feeds dimensions into the rendering logic.

AI-generated description
MIT Licensed

Similar vizzes