Pie

Pie and donut charts split a whole into slices, to show how each part contributes to a total.

LLMs

Basic

Pass the rows through pie and draw them with radialArc inside polar to split a whole into slices, one per browser.

No separator

Leave out stroke and strokeWidth on radialArc so the slices meet edge to edge with no gap between them.

Labels

Add a radialRule leader line and a radialText with anchor set to outside to print each slice's value beside it.

Labels without leaders

Use radialText alone with a radiusOffset to place each value just outside its slice, with no line connecting them.

Labels inside

Set the radialText radius below 1 and anchor to middle to write each browser's name inside its own slice.

Legend

Give the color scale a colorLegend with colorLegendItems to draw a row of colored swatches and names under the pie.

Donut

Set innerRadius on radialArc to cut a hole in the middle and turn the pie into a donut.

Active slice

Draw a second radialArc for one slice with a larger outerRadius to pull the top browser out of the ring.

Donut with total

Place two radialText marks at the center, at angle and radius zero, to show the total and its label inside the hole.

Stacked rings

Give two radialArc marks different innerRadius and outerRadius values to compare desktop and mobile months in one chart.

Selected month

Rebuild the definition when a Select changes to pull out the chosen month, add a ring around it and print its value.

Full pie

Use pie with its default angles and a tooltip format to compare how often the four most common English letters appear.

Named slices

Set color on radialText to the slice field so each letter's label beside the pie takes the color of its slice.

Proportional hole

Pass innerRadius a function of radius so the donut's hole stays the same share of the chart at any size.

Combined share

Sum the rows and print the result with a centered radialText to show the share three letters take together.

Gaps and rounded ends

Set gapAngle on pie and cornerRadius on radialArc to space the slices apart and round their corners.

Nested rings

Draw packages in an inner radialArc and their modules in an outer one to show how each total breaks down.

Active metric

Set the selection from onFocusChange or a vertical Segmented to pull out one browser and show its visitors in the center.