# Directives

Directives can be added to your SQL source code, or with the visual Directives Editor. See the reference of the various available [Directives](/reference/directives.md)

## Directives in SQL Code

```sql
-- @chart: column
-- @title: Column - Basic Column Chart
-- @subtitle: An example column chart showing sales by month
-- @formats: currency
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
```

Directives are specified as a SQL comment (any line starting wtih --) followed by '@' symbol and the directive name, followed by a colon:

```sql
-- @chart: Line
```

## Directives Editor

From any open SQL script, you can visually edit the directives. This allows you play with different directives. When you change directives in the editor, they are automatically updated in the SQL source code.

<div align="left"><figure><img src="/files/GcxsagPDmXUO5WFlk7HP" alt=""><figcaption><p>A screenshot of the directives visual editor</p></figcaption></figure></div>

## Directive Comments

When developing, sometimes you may wish to quickly toggle on/off the directive without removing it from your source code. ChartSQL supports "directive comments" which will disable that directive.

You comment a directive by adding two forward slashed directly before the @ symbol

```sql
-- @chart: column
-- @title: Directive Comments
-- @subtitle: An example of commenting out a directive
-- @formats: currency
-- @series: Sales
-- //@baselines: Sales
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/7ApLZsxVTaaxL5DxXXTj" alt=""><figcaption><p>An example chart that has @baselines defined but it is commented out</p></figcaption></figure>


---

# 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/chartsql-studio/creating-charts/directives.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.
