# Pie

<table data-card-size="large" data-view="cards"><thead><tr><th data-card-target data-type="content-ref"></th><th data-hidden></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="/pages/t21pDYIGIJ3qrV5cFxqU#basic-pie-chart">/pages/t21pDYIGIJ3qrV5cFxqU#basic-pie-chart</a></td><td></td><td></td><td></td><td><a href="/files/xIVYZdbcMkmPoaBmXIG8">/files/xIVYZdbcMkmPoaBmXIG8</a></td></tr></tbody></table>

## Basic Pie Chart

```sql
-- @chart: pie
-- @title: Pie - Basic Pie Chart
-- @subtitle: Pie chart of sales won by channel
SELECT
	channel,
	count(*) as TotalSales
FROM sales
WHERE status = 'Won'
GROUP BY channel
ORDER BY TotalSales DESC;
```

<figure><img src="/files/xIVYZdbcMkmPoaBmXIG8" alt=""><figcaption><p>An example pie chart</p></figcaption></figure>

| CHANNEL  | TOTALSALES |
| -------- | ---------- |
| search   | 66.0       |
| coldcall | 37.0       |
| event    | 112.0      |
| referral | 243.0      |
| pr\_ad   | 21.0       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chartsql.com/charts/pie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
