Learn D3.js
✓ Published1🌍 Public
This example shows worldwide operating system market share percentages in a static pie chart drawn with SVG. The code uses D3 v4’s `d3.pie()` to compute arc angles from three data objects and `d3.arc()` with `outerRadius` and `innerRadius` to generate the path shapes. A single `<text>` element per slice, positioned via `label.centroid(d)`, displays the platform name and percentage. Categorical colors come from `d3.scaleOrdinal(d3.schemeCategory10)`. The visualization is rendered inside an `svg.pie-chart` element in the HTML, with data hard-coded in the JavaScript array.
AI-generated descriptionMIT Licensed