Skip to main content
100%

Simple Pie Chart

✓ Published1🌍 Public
Ss-pranathi
Last edited Mar 28, 2022
Created on Mar 24, 2022
Forked from D3 Starter

This example shows a simple pie chart displaying market share values for five smartphone companies, with each segment labeled by its numeric value and accompanied by a legend showing company names. The chart is rendered as an SVG using D3.js v5, with data defined inline as JavaScript objects. It uses the `d3.pie()` generator to compute segment angles and the `d3.arc()` function to draw the donut-shaped segments, which have an inner radius, outer radius, and padding between arcs. Color encoding relies on `d3.scaleOrdinal` with the `d3.schemePastel2` palette, and legends are manually appended as SVG groups with rectangles and text elements.

AI-generated description
MIT Licensed

Similar vizzes