Pie Transform

The pie transform calculates the angular extents of arc segments laid out in a circle. The most common use case is to create pie charts and donut charts. This transform writes two properties to each datum, indicating the starting and ending angles (in radians) of an arc.

Example

Transform Parameters

Property Type Description
field Field The data values from this field will be encoded as angular spans. If omitted, all pie slices will have equal spans.
startAngle Number The starting angle of the pie in radians (default 0).
endAngle Number The end angle of the pie in radians (default 2 * PI).
sort Boolean If true, sorts the arcs according to field values (default false).
as String[ ] The output fields for the computed start and end angles for each arc. The default is ["startAngle", "endAngle"].

Usage

{"type": "pie", "field": "price"}

Computes angular extents for pie slices based on the field price.

{"type": "pie"}

Computes angular extents for equal-width pie slices.