Line Chart
A line chart connects values in order, which makes it the natural choice for showing how a number changes over time or across an ordered sequence.
Building a line chart
Return your time or sequence column and the metric:
SELECT
DATE(created_at) AS "Day",
COUNT(*) AS "Signups"
FROM users
GROUP BY DATE(created_at)
ORDER BY DATE(created_at);
In the chart settings choose
Line, pick Day as X axis values (the x-axis) and add a dataset with
Signups as its Datasource (the line). Set the dataset's Area to Yes
to fill the area below the line.
Multiple lines
Return more numeric columns and add a dataset for each to plot several lines on the same axes — useful for comparing related metrics:
SELECT
DATE(created_at) AS "Day",
COUNT(*) AS "Orders",
SUM(total) AS "Revenue"
FROM orders
GROUP BY DATE(created_at)
ORDER BY DATE(created_at);
Tips
- Always
ORDER BYyour time column. A line chart connects points in row order, so unsorted rows produce a tangled line. - Fill gaps in the date range in SQL if you need a continuous axis — missing days otherwise collapse together.
- All lines share one value axis: chart series of a similar scale together. A mixed chart pairs lines with bars on that same axis.