Pie chart

Each row is a slice. The slices start at the top and go clockwise, in the order of the table. The names are shown in a legend under the pie.

A pie is a donut without a hole. It has the same colours, gaps and animation.

Where the crop went
thousands of apples
Juiced 38.2
Eaten fresh 18.1
Sold whole 12.4
Composted 5.8
HTML
<figure data-chart="pie">
	<figcaption><b>Where the crop went</b><br><span>thousands of apples</span></figcaption>
	<table>
		<tbody>
			<tr><th>Juiced</th><td>38.2</td></tr>
			<tr><th>Eaten fresh</th><td>18.1</td></tr>
			<tr><th>Sold whole</th><td>12.4</td></tr>
			<tr><th>Composted</th><td>5.8</td></tr>
		</tbody>
	</table>
</figure>

Numbers inside

If a number fits inside its slice, it is shown there. If it does not fit, such as on a small slice or a narrow screen, it is next to the slice, with a short line.

The numbers inside all have one colour. It gets to be the one with enough contrast on the most slices, with the same settings as a number inside a bar. On a slice where that colour has too little contrast, the number is next to the slice. If you want all numbers next to their slices, add data-chart-labels="outside" to the figure.

A total row

A pie has no middle, so it does not show a total. If a row has data-kind="total", it is not a slice. Screen readers read it in the table. If there is no total row, Tablechart adds a hidden row with the sum, as on a donut.

Gaps and corners

The gaps between the slices go from the middle to the edge. If you want wider or no gaps, set --tablechart-slice-gap. With --tablechart-slice-radius, the outer corners of the slices are round.

CSS
.round-pie {
	--tablechart-slice-gap: 6;
	--tablechart-slice-radius: 6px;
}
Elstar 42
Jonagold 28
Braeburn 18
Gala 12
HTML
<figure class="round-pie" data-chart="pie">
	<table>
		<tbody>
			<tr><th>Elstar</th><td>42</td></tr>
			<tr><th>Jonagold</th><td>28</td></tr>
			<tr><th>Braeburn</th><td>18</td></tr>
			<tr><th>Gala</th><td>12</td></tr>
		</tbody>
	</table>
</figure>

A sweep

With data-chart-animate="sweep", the slices go round in one motion, at one speed. See Grow or sweep.

Elstar 42
Jonagold 28
Braeburn 18
Gala 12
HTML
<figure data-chart="pie" data-chart-animate="sweep">
	<table>
		<tbody>
			<tr><th>Elstar</th><td>42</td></tr>
			<tr><th>Jonagold</th><td>28</td></tr>
			<tr><th>Braeburn</th><td>18</td></tr>
			<tr><th>Gala</th><td>12</td></tr>
		</tbody>
	</table>
</figure>

Next

By default, all slices use one colour, each one a bit lighter. If you want to set a colour for each slice, see Colours.