Charts and dashboards
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 that Bonnard drew before.
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 examine the numbers first.render_charttakes the SQL and the chart options. It runs the query and returns the chart that 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 come from named slots: the palette’s eight hues and grey, never hex. The call names each slice. A slice that the call does not name takes the next palette colour, which can repeat a colour that the call 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 SQL groups the small categories and returns seven rows instead of nine. Other takes its place by size, the same as the other slices: 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 for each 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.
- The pie drops zero and negative values. When no value is positive, the pie draws the negatives’ sizes and says so in a caption.
- Labels show each share in whole percent, and the shares sum to 100%. The value is in the tooltip.
- A slice under 6 degrees, approximately 1.7% of the whole, draws no label. Its tooltip 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. Bonnard refuses a call that sets one, and the error names the options that a pie takes.
When Bonnard draws something else
- Shares over time: a 100% stacked bar, one bar for each period.
- If the call does not set a chart type, Bonnard draws a category breakdown as bars. A pie needs
chartType: "pie"in the call.