🌍 Public
Viewing a saved revision (read-only)
db23dabc717f48118a024f75a6d0cf0d
Simple Pie Chart
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