# SQL Scripts & Charts

ChartSQL visualizes plain SQL. Your SQL scripts live in folders on your file system (or in ChartSQL Studio Cloud) in what we call a **Folder**. Typically, you will have your SQL scripts in source control like git.

Each chart is a self contained SQL file and set of `@directives` (we say 'at directives' or 'directives'). Directives define how you want your chart to display. Any SQL file can be a visualization if it has appropriate columns that can be used for categories and series.

```sql
-- @chart: column
-- @category: product
-- @series: units_sold
SELECT 'Shoes' AS product, 120 AS units_sold
UNION ALL
SELECT 'T-Shirts', 200
UNION ALL
SELECT 'Jeans', 80
UNION ALL
SELECT 'Sunglasses', 150
UNION ALL
SELECT 'Hats', 90;
```

You can manage your charts for the currently open Folder from the file list

<div align="left"><figure><img src="/files/jYN6IpnxEeenAYh5S0kT" alt=""><figcaption></figcaption></figure></div>

## Filtering

Typing into the “Filtering Folder Charts…” input will begin searching from your package files. You can also begin filtering with ctrl + f. You can exit filtering by hitting ESC.

{% hint style="info" %}
If you are already filtering, hitting ctrl + f again will bring up the browser’s default find.
{% endhint %}

You can filter on the following content:

* The name of the physical sql file
* The [@title](/reference/directives/title.md) directive of the SQL script&#x20;
* Tags defined in the script using [@tags](/reference/directives/overlay-series-1.md) directive

## Previewing & Opening

Clicking on any file in the list will open it in your editor. Only one file is open in Preview at a time, if you click a different file it will take the first file’s place. When you start editing the file it will convert to being an open file.

<figure><img src="/files/8y2D0MmecnPwNtLkqYtB" alt=""><figcaption><p>An open SQL script and chart preview</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/basic-concepts/sql-scripts-and-charts.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.
