Pie chart
The venerable pie chart uses slices of a circle (the "pie") to indicate how much of the whole each of a set of values represents.
Parameters
- data
List[dict], DataFrame, Series Contains inline data to use for the chart. In Markdown, the value must be a JSON string representing a list of dictionaries, as shown in the example below. Each dictionary must contain a
labelelement, with the label for the respective slice, and avalueelement, representing the extent of the slice (which will be scaled appropriately).In Python,
datamay be any of:- A Python list of dictionaries, as above
- A Pandas, FireDucks, Polars or pyarrow DataFrame with a
labelandvaluecolumn. - A Series whose index supplies the labels and entries supply the value.
- donut
Boolean If
true, the center of the pie chart will be removed, causing the chart to resemble a donut.- continuous_rotation
Boolean If
true, the chart will be continuously rotated around its center.- show_percentages
Boolean If true, the percentage of the total occupied by each slice will be added to the label inside the slice.
In addition to all of the standard parameters the following apply to pie charts.
Examples
Here is a simple example in HTML/Markdown:
<piechart
data='[
{ "label": "Apples", "value": 10 },
{ "label": "Bananas", "value": 20 },
{ "label": "Cherries", "value": 15 },
{ "label": "Grapes", "value": 25 }
]'
width=500
height=500
colors='deep'
>
</piechart>which renders like this:
Here is an example with donut and continuous_rotation set to true: