Line

Line charts show how different numerical values compare, typically across time

Basic Line Chart

-- @chart: Line
-- @title: Line - Simple Line Chart
-- @subtitle: An example line chart with a detected category and series
-- @formats: currency
SELECT
	TRUNC(date_closed, 'MONTH') as Month,
	sum(amount) as Sales
FROM sales
GROUP BY Month
ORDER BY Month ASC;
MONTHSALES

January, 01 2017 00:00:00 +0000

2668855.0

February, 01 2017 00:00:00 +0000

3951547.0

March, 01 2017 00:00:00 +0000

4403443.0

April, 01 2017 00:00:00 +0000

3079040.0

May, 01 2017 00:00:00 +0000

2576305.0

June, 01 2017 00:00:00 +0000

3100093.0

July, 01 2017 00:00:00 +0000

3112476.0

Auto Line Chart

-- @title: Auto Line - Auto Generated Date Line Chart
-- @subtitle: An example chart which is auto detected to be a line
-- @formats: currency
SELECT 
	TRUNC(date_closed, 'MONTH') as Month,
	sum(amount) as Sales
FROM sales
GROUP BY Month
ORDER BY Month ASC;
MONTHSALES

January, 01 2017 00:00:00 +0000

2668855.0

February, 01 2017 00:00:00 +0000

3951547.0

March, 01 2017 00:00:00 +0000

4403443.0

April, 01 2017 00:00:00 +0000

3079040.0

May, 01 2017 00:00:00 +0000

2576305.0

Line with Series Title Spacing

-- @chart: Line
-- @title: Series Title Spacing
-- @subtitle: Spacing on series titles is determined by underscores
-- @formats: currency
SELECT
	TRUNC(date_closed, 'MONTH') as Month,
	sum(amount) as total_sales_amount
FROM sales
GROUP BY Month
ORDER BY Month ASC;
MONTHTOTAL_SALES_AMOUNT

January, 01 2017 00:00:00 +0000

2668855.0

February, 01 2017 00:00:00 +0000

3951547.0

March, 01 2017 00:00:00 +0000

4403443.0

April, 01 2017 00:00:00 +0000

3079040.0

May, 01 2017 00:00:00 +0000

2576305.0

June, 01 2017 00:00:00 +0000

3100093.0

July, 01 2017 00:00:00 +0000

3112476.0

Manual @Category and @series Line

-- @chart: line
-- @title: Manual Category and Series
-- @subtitle: An example chart manually setting the category and series
-- @category: Date_Closed
-- @series: Amount
SELECT 
    Sub.*,
    (
      SELECT channel
      FROM Sales
      WHERE Sales.Date_Closed = Sub.Date_Closed
      GROUP BY Channel
      ORDER BY count(*) DESC
      LIMIT 1
    ) as TopChannel
FROM (
    SELECT 
      Date_Closed,
      sum(Amount) as Amount,
      sum(Profit) as Profit
    FROM Sales
    WHERE Status = 'Won'
    GROUP BY Date_Closed
    ORDER BY Date_Closed ASC
) as Sub;

DATE_CLOSED

AMOUNT

PROFIT

TOPCHANNEL

January, 02 2017 00:00:00 +0000

78013.0

13263.0

referral

January, 06 2017 00:00:00 +0000

130899.0

40938.0

event

January, 12 2017 00:00:00 +0000

75705.0

21198.0

coldcall

January, 14 2017 00:00:00 +0000

72732.0

13092.0

event

January, 17 2017 00:00:00 +0000

84572.0

27064.0

search

January, 20 2017 00:00:00 +0000

76878.0

11532.0

event

January, 31 2017 00:00:00 +0000

127149.0

49589.0

referral

Last updated

Support

DiscordX

ChartSQL