# Pie charts in your AI client

> The words that change a pie chart in Bonnard, and the options and limits the product enforces.

Updated: 2026-10-12

Bonnard draws a pie chart to show how one whole splits into a few shares.

[Image: A chat with the question "Revenue by channel last quarter, as a pie chart.", three tool calls, and the pie chart Bonnard drew: revenue by channel for Q3 2026, online the largest share at 47%]

The examples use Acme, a demo retailer that reports in pounds. Each variant is a few words in the question. A follow-up changes a chart already drawn.

## How an agent draws it

The chat above ran three tools, in this order:

1. `explore_schema` finds the tables and their columns: here `orders`, with `order_date`, `channel` and `revenue`.
2. `sql_query` runs a read-only query, so the agent can check the numbers first.
3. `render_chart` takes the SQL and the chart options. It runs the query and returns the chart the chat draws.

The `render_chart` call behind the chart above:

```json
{
  "charts": [
    {
      "sql": "SELECT channel, SUM(revenue) AS revenue FROM orders WHERE order_date >= DATE '2026-07-01' AND order_date < DATE '2026-10-01' GROUP BY channel",
      "chartType": "pie",
      "title": "Revenue by channel, Q3 2026",
      "encode": { "x": "channel", "y": "revenue" },
      "fields": [
        { "name": "revenue", "format": "currency", "currency": "GBP" }
      ]
    }
  ]
}
```

A call takes up to 10 charts, shown as a carousel. Each example below shows its one entry. A connected agent reads the full option reference with `explore_docs`, topic `charts/pie`.

## One slice highlighted

```prompt
Revenue by channel last quarter as a pie, with marketplace highlighted.
```

[Image: The channel pie with the marketplace slice in blue and the other three in grey]

```json
{
  "sql": "SELECT channel, SUM(revenue) AS revenue FROM orders WHERE order_date >= DATE '2026-07-01' AND order_date < DATE '2026-10-01' GROUP BY channel",
  "chartType": "pie",
  "title": "Revenue by channel, Q3 2026",
  "encode": { "x": "channel", "y": "revenue" },
  "fields": [
    { "name": "revenue", "format": "currency", "currency": "GBP" }
  ],
  "highlight": "Marketplace"
}
```

The named slice keeps a colour and the rest turn grey. Up to three slices stand out, in blue, then amber, then green.

## Slice colours

```prompt
Revenue by channel last quarter as a pie: online green, retail stores amber, wholesale teal, marketplace violet.
```

[Image: The channel pie with each slice in the colour the question named]

```json
{
  "sql": "SELECT channel, SUM(revenue) AS revenue FROM orders WHERE order_date >= DATE '2026-07-01' AND order_date < DATE '2026-10-01' GROUP BY channel",
  "chartType": "pie",
  "title": "Revenue by channel, Q3 2026",
  "encode": { "x": "channel", "y": "revenue" },
  "fields": [
    { "name": "revenue", "format": "currency", "currency": "GBP" }
  ],
  "series": {
    "Online": { "color": "green" },
    "Retail stores": { "color": "amber" },
    "Wholesale": { "color": "teal" },
    "Marketplace": { "color": "violet" }
  }
}
```

Colours are named slots: the palette's eight hues and grey, never hex. The call names every slice, because one left out takes the next palette colour and can repeat one already set.

## Small slices as Other

```prompt
September revenue by category as a pie, with anything under 10% grouped as Other.
```

[Image: September revenue by category in seven slices, the three smallest categories grouped as Other]

```json
{
  "sql": "WITH c AS (SELECT category, SUM(revenue) AS revenue FROM order_lines WHERE order_date >= DATE '2026-09-01' AND order_date < DATE '2026-10-01' GROUP BY category) SELECT CASE WHEN revenue >= 0.1 * (SELECT SUM(revenue) FROM c) THEN category ELSE 'Other' END AS category, SUM(revenue) AS revenue FROM c GROUP BY 1",
  "chartType": "pie",
  "title": "Revenue by category, September 2026",
  "encode": { "x": "category", "y": "revenue" },
  "fields": [
    { "name": "revenue", "format": "currency", "currency": "GBP" }
  ]
}
```

The grouping happens in the SQL, which returns seven rows instead of nine. Other still takes its place by size, fourth.

## Options and limits

Table: What a pie chart takes

| Ask for | What Bonnard draws |
| --- | --- |
| "as a pie" or "as a donut" | The same chart: a ring of slices, largest first, each labelled with its share |
| "make marketplace stand out" | Up to three slices in colour, the rest grey |
| "online in green" | A named colour per slice |
| "in pounds" | Each slice's value as currency, in its tooltip |
| "without a legend" or "the legend on top" | The slice list hidden, or moved above the ring |

- One category and one measure. Given two measures, the pie draws the first and tells the agent.
- Slices run largest first, whatever order the query returns.
- Zero and negative values are dropped. When no value is positive, the pie draws the negatives' sizes and says so in a caption.
- Labels show each share in whole percent, summing to 100%. The value is in the tooltip.
- A slice under 6 degrees, about 1.7% of the whole, draws no label. Its tooltip still names it.
- The palette has eight colours, so a ninth slice repeats the first.
- A pie takes no axes, stacking, reference lines or line styles. A call that sets one is refused with the options a pie takes.

## When Bonnard draws something else

- Shares over time: a [100% stacked bar](https://bonnard.ai/docs/charts/bar.md#stacked-bars), one bar per period.
- Left to choose, Bonnard draws a category breakdown as bars. A pie needs `chartType: "pie"` in the call.
