SQL Scripts & Charts
Explanation of SQL scripts and 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.
-- @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

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.
You can filter on the following content:
The name of the physical sql file
The @title directive of the SQL script
Tags defined in the script using @tags 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.

Last updated
Was this helpful?