veda_piechart7
✓ Published1🌍 Public
This example shows a pie chart of GDP per capita across countries from the 2019 World Happiness Report, with each slice labeled by country name and accompanied by a color-coded legend. The visualization first computes the pie arcs using `d3.pie()` and renders them as SVG paths via `d3.arc()`, coloring each slice with a categorical scale (`d3.scaleOrdinal`). Country labels are positioned at the centroid of each arc using `d3.arc().centroid()`, and a legend is built from the color domain with appended rectangles and text. The code loads CSV data from a GitHub raw URL and uses D3 v6 within a React-compatible HTML page.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.
MIT Licensed