Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Pie Chart (with labels) with d3

Public visualization

Fork of Pie Chart (with labels) with d3

0 stars0🌍 Public
HHaili0109
Last edited Nov 26, 2024
Created on Nov 26, 2024

This example displays a pie chart of the top five US states by GDP using D3 v4 within a React application. The chart visualizes state rankings, with each slice labeled by state name, alongside a legend that pairs colors with state names and GDP values. The code builds the visualization by computing arc paths with `d3.arc`, generating slice data via `d3.pie`, and applying color scales with `d3.scaleOrdinal`. Data is loaded from a remote CSV file using D3's `csv` function. The SVG rendering is handled directly through D3's append and attribute methods, with a React component managing the data-fetching lifecycle.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed