Skip to content

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

In addition to all of the standard parameters the following apply to pie charts.

dataList[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 label element, with the label for the respective slice, and a value element, representing the extent of the slice (which will be scaled appropriately).

In Python, data may be any of:

  • A Python list of dictionaries, as above
  • A Pandas, FireDucks, Polars or pyarrow DataFrame with a label and value column.
  • A Series whose index supplies the labels and entries supply the value.
donutBoolean

If true, the center of the pie chart will be removed, causing the chart to resemble a donut.

continuous_rotationBoolean

If true, the chart will be continuously rotated around its center.

show_percentagesBoolean

If true, the percentage of the total occupied by each slice will be added to the label inside the slice.

Examples

Here is a simple example in HTML/Markdown:

html
<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:

Released under the MIT License. | Privacy Policy