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
  • Baseline Directives Overview
  • Examples
  • Default Behavior

Was this helpful?

  1. ChartSQL Studio
  2. Creating Charts

Baselines

Horizontal marks added to charts to mark major comparative values of a series like the average, median, min or max.

PreviousStackingNextSeries Titles

Last updated 1 year ago

Was this helpful?

ChartSQL introduces baseline marks/lines to add context and reference points to chart visualizations. These lines represent significant values such as the average, min, max, median of a series. Baselines provide visual cues for comparison against a common or target value.

See Baselines examples and the @baselines and @baseline-types directives.

-- @chart: column
-- @title: Baselines - Average Baseline
-- @subtitle: An example column chart showing sales by month
-- @formats: currency
-- @series: Sales
-- @baselines: Sales
SELECT 
	TRUNC(date_closed, 'MONTH') as Month,
	sum(amount) as Sales
FROM sales
GROUP BY TRUNC(date_closed, 'MONTH')
ORDER BY TRUNC(date_closed, 'MONTH') ASC

Baseline Directives Overview

  • @baselines: Specifies the series to which baselines are applied and indicates the presence of baseline lines in the chart.

  • @baseline-types (optional): Sets the type of baselines on the specified series. If omitted, the default type, 'average', is applied. Supported types include: 'average', 'min', 'max', or 'median'

Examples

A column chart showcasing average sales with a baseline for the average value:

-- @chart: column
-- @title: Baselines - Average Baseline
-- @subtitle: An example column chart showing sales by month
-- @formats: currency
-- @series: Sales
-- @baselines: Sales
SELECT 
	TRUNC(date_closed, 'MONTH') as Month,
	sum(amount) as Sales
FROM sales
GROUP BY TRUNC(date_closed, 'MONTH')
ORDER BY TRUNC(date_closed, 'MONTH') ASC

A chart with multiple baselines with specified types:

-- @chart: column
-- @title: Baselines - Multiple Baseline Types on one Series
-- @subtitle: An example column chart showing sales by month
-- @formats: currency
-- @series: Sales
-- @baselines: Sales, Sales, Sales
-- @baseline-types: average, min, max
SELECT 
	TRUNC(date_closed, 'MONTH') as Month,
	sum(amount) as Sales
FROM sales
GROUP BY TRUNC(date_closed, 'MONTH')
ORDER BY TRUNC(date_closed, 'MONTH') ASC

Default Behavior

Without specifying types or labels, baselines default to drawing an 'average' line across the specified series in the chart.

An example column chart with a baseline