🌍 Public
Viewing a saved revision (read-only)
4e99952de12a4e3bbd102903eb7bb460
Use D3 Arcs to make pie chart of colors
SSam Hege
Last edited Sep 12, 2022
Created on Sep 12, 2022
Forked from Visualizing Named Colors with React and D3
This example creates a pie chart of colors from a CSV file, with each slice representing a color from the dataset. It uses React with D3’s `arc` and `pie` APIs to generate SVG paths for the pie slices. The data is loaded asynchronously via `d3.csv`, and each slice’s fill is set to the RGB hex value from the CSV. The chart is centered in a 960-by-500 viewport, with arcs computed using `Math.PI` angles based on the data length.
AI-generated descriptionA program that loads and visualizes some data