ChartSQL
AboutProductDownloadCommunity
  • Basics
    • Intro
    • Quick Start
  • CHARTS
    • Overview
    • Auto Charts
    • Area
    • Bar
    • Bubble
    • Column
    • Combo
    • Gauge
    • Heatmap
    • Line
    • Pie
    • Radar
    • Scatter
    • Formatting & Rendering
      • Baselines
      • Formats
      • Series Titles
      • Series Labels
      • Stacked Charts
      • Grouped Category
  • ChartSQL Studio
    • Overview
    • ChartSQL Studio Cloud
    • Installing Studio Desktop
    • Basic Concepts
      • Interface Overview
      • Workspace
      • SQL Scripts & Charts
      • Folders
      • Datasources
      • Thinking in ChartSQL
    • Creating Charts
      • Editor Panels
      • Column Data Types
      • Chart Types
      • Directives
      • Stacking
      • Baselines
      • Series Titles
      • Dynamic SQL Charts
      • Dynamic Data Functions
    • Presenting
    • Settings & Customization
    • Troubleshooting & Support
    • Datasources
      • Overview
      • CSV File
      • HyperSQL
      • MongoDB
      • MySQL
      • PostgreSQL
      • SQLite
      • Custom Datasources
    • Extensions
      • Overview
      • Extension Points
      • Core Extensions
      • Extensions API Reference
  • Dashboards
    • Coming Soon
  • ChartSQL JS
    • Coming Soon
  • Reference
    • Auto Charts
    • Directives
      • @baselines
      • @baseline-types
      • @chart
      • @category
      • @formats
      • @series
      • @title
      • @subtitle
      • @groups
      • @series-types
      • @series-labels
      • @stacking-mode
      • //@directive: comments
      • @dash-id
      • @overlay-series
      • @tags
      • @select-list
    • Glossary
    • Shortcuts
    • Publishing API
  • Product & Community
    • About
    • Features
    • Use Cases
      • General Uses
      • For SQL Developers
      • For Application Developers
      • For Agencies
      • For Data Science Teams
    • Community & Support
    • Roadmap
    • Release Notes
    • In Development
      • Workspaces
      • Dashboards
        • Intro
        • Dashboards
        • Packages
        • Pages
        • Charts
        • Access Control
      • Sharing & Publishing
      • ChartSQL.js
        • Overview
      • @threshold
      • Thresholds
      • Sheets
Powered by GitBook

Support

  • Discord
  • X

ChartSQL

On this page
  • Basic Line Chart
  • Auto Line Chart
  • Line with Series Title Spacing
  • Manual @Category and @series Line

Was this helpful?

  1. CHARTS

Line

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

PreviousHeatmapNextPie

Last updated 1 year ago

Was this helpful?

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;
MONTH
SALES

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;
MONTH
SALES

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;
MONTH
TOTAL_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

An example date line chart
Example auto line chart
An example line chart with underscores converted to spaces in the series titles
An example chart with a manually specified @category and @series
Cover
Cover
Cover
Cover
Basic Line Chart
Auto Line Chart
Line with Series Title Spacing
Manual @Category and @series Line