Gallery
Each chart of the chart pages is here, with the query and the \chart line that make it. Each chart is the SVG file that file= writes. In a terminal that draws images, the same \chart without file= draws the chart in place.
The data
Section titled “The data”The charts use two tables of a small cafe: the cups sold each month, and the cups sold each hour of a day. Save this SQL as cafe.sql:
create table sales ( month_no integer primary key, month text not null, coffee integer not null, tea integer not null, cocoa integer not null);insert into sales values (1, 'Jan', 1240, 860, 610), (2, 'Feb', 1180, 820, 560), (3, 'Mar', 1310, 790, 420), (4, 'Apr', 1360, 740, 280), (5, 'May', 1420, 700, 150), (6, 'Jun', 1490, 680, 90);create table hours (hour integer primary key, cups integer not null);insert into hours values (7, 38), (8, 92), (9, 71), (10, 54), (11, 47), (12, 66), (13, 58), (14, 41), (15, 49), (16, 35), (17, 22);Then make the SQLite file cafe.db from it, and open it:
usql -X -q -f cafe.sql sq:cafe.dbusql cafe.dbBars of three series
Section titled “Bars of three series”select month, coffee, tea, cocoa from sales order by month_no\chart title='Cups sold' file=sales-bar.svgLines of three series
Section titled “Lines of three series”select month, coffee, tea, cocoa from sales order by month_no\chart title='Cups sold' type=line file=sales-line.svgA line of numbers only
Section titled “A line of numbers only”select hour, cups from hours order by hour\chart title='Cups by hour' file=hours.svgA title and a subtitle
Section titled “A title and a subtitle”select month, coffee as "Coffee", tea as "Tea"from sales order by month_no\chart title='Cups sold' subtitle='January to June 2026' file=titled.svgA smaller size
Section titled “A smaller size”select month, coffee as "Coffee", tea as "Tea"from sales order by month_no\chart title='Cups sold' size=640x320 file=small.svgOne series
Section titled “One series”select month, coffee from sales order by month_no\chart title='Coffee sold' file=coffee.svg