Sector
A slice of a pie
A pie or a donut. Goes in a Chart's marks, and takes the same data as every other mark: x names the slice, y is how big it is. A chart holding a Sector draws no axes, because a slice has an angle rather than a position.
Methods
Sector(options)AnyA pie or a donut: one slice per value, sized by its share of the total.
- options Any required
- data [Any] required
The slices, as { x, y }. x names the slice and labels it, y is its size.
- innerRadius Number
A fraction of the circle, 0 to 1. Above 0 it becomes a donut. Default 0.
- outerRadius Number
A fraction of the circle, 0 to 1. Default 1.
- angularInset Number
The gap between slices, in points. Default 1.
- cornerRadius Number
Rounds the corners of each slice. Default 0.
- opacity Number
0 to 1. Default 1.
- data [Any] required
Examples
A donut of this week's categories
Chart({
marks: [Sector({
data: [
{ x: "Food", y: 420 },
{ x: "Transport", y: 180 },
{ x: "Rent", y: 900 },
],
innerRadius: 0.6,
cornerRadius: 4,
})],
})