Charts
Pie charts in your AI client
Bonnard draws a pie chart to show how one whole splits into a few shares.


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:
explore_schemafinds the tables and their columns: hereorders, withorder_date,channelandrevenue.sql_queryruns a read-only query, so the agent can check the numbers first.render_charttakes 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
Revenue by channel last quarter as a pie, with marketplace highlighted.


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
Revenue by channel last quarter as a pie: online green, retail stores amber, wholesale teal, marketplace violet.


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
September revenue by category as a pie, with anything under 10% 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
| 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, one bar per period.
- Left to choose, Bonnard draws a category breakdown as bars. A pie needs
chartType: "pie"in the call.