Skip to main content
100%

Use D3 Arcs to make pie chart of colors

✓ Published1🌍 Public
SSam Hege
Last edited Sep 12, 2022
Created on Sep 12, 2022

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 description

A program that loads and visualizes some data

MIT Licensed

Similar vizzes