# @chart

## Quick Reference

```sql
-- @chart: pie
```

## Valid Values

Must be one and only one of the valid chart types supported by ChartSQL

`One Of`

* column
* bar
* pie
* line
* area
* combo

## Full Example

```sql
-- @chart: column
SELECT 
	TRUNC(date_closed, 'MONTH') as Month,
	sum(amount) as Sales
FROM sales
GROUP BY TRUNC(date_closed, 'MONTH')
ORDER BY TRUNC(date_closed, 'MONTH') ASC
```

<figure><img src="/files/WQgOpVgIlI8tPrFGt2dX" alt=""><figcaption></figcaption></figure>

## Use Cases

When you want to specify the type of chart exactly, or the full auto-detection does not meet your needs, you use the @chart directive.

If you have not specified @category, @series or @secondary, they will be inferred from the columns in the result set.


---

# 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/reference/directives/chart.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.
