Skip to content

Pie grid

As the name suggests, a pie grid is a grid of small single-value pie charts. Here is a simple example:

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.
labelstring
valuestring

If you would like to use different columns instead of the standard "label" and "value" columns, you may specify one or both using the label and/or value parameters like this:

html
<piegrid
data='[
  { "category": "Apples", "value": 10 },
  { "category": "Bananas", "value": 20 },
  { "category": "Cherries", "value": 15 },
  { "category": "Grapes", "value": 25 }
]'
  width=500
  height=150
  colors='deep'
  label='category'
>
</piegrid>
columnsinteger

Specifies the number of pie charts per row. The default is 3.

show_percentagesBoolean

If true, the percentage that the value is of the sum of the values is added to the chart.

bg_arc_colorstring
text_colorstring
percent_colorstring
total_colorstring

The colors of the chart elements may be specified using these four optional parameters. The meanings of each parameter are as follows:

ParamDefaultComponent
bg_arc_color#2b2b2fThe portion of the circle not representing the value
text_color#aaaThe color of the label text
percent_color#eb0707If show_percent is true, the color of its text
total_color#aaaThe color of the value text

Released under the MIT License. | Privacy Policy