Skip to main content
Basic Usage
{% calendar_heatmap
    data="demo_daily_orders"
    date="date"
    value="sum(total_sales)"
/%}

Examples

Basic Usage

Basic Usage
{% calendar_heatmap
    data="demo_daily_orders"
    date="date"
    value="sum(total_sales)"
/%}

Calendar Heatmap with Custom Colors

Calendar Heatmap with Custom Colors
{% calendar_heatmap
    data="demo_daily_orders"
    date="date"
    value="sum(total_sales)"
    title="Daily Sales Heatmap"
    chart_options={
        color_palette = ["#0d0887", "#6300a7", "#a62098", "#d5546e", "#f68d45", "#fcd225", "#f0f921"]
    }
/%}

Calendar Heatmap with Conditional Colors

{% calendar_heatmap
    data="demo_daily_orders"
    date="date"
    value="sum(total_sales)"
    title="Sales Performance Heatmap"
    chart_options={
        conditional_colors = "case when sum(total_sales) > 1000 then '#22c55e' when sum(total_sales) > 500 then '#f59e0b' else '#ef4444' end"
    }
/%}

Calendar Heatmap with Conditional Colors and Legend

{% calendar_heatmap
    data="demo_daily_orders"
    date="date"
    value="sum(total_sales)"
    title="Sales Performance Heatmap"
    chart_options={
        conditional_colors="case when sum(total_sales) > 1000 then '#22c55e' when sum(total_sales) > 500 then '#f59e0b' else '#ef4444' end"
        color_map={
            "#22c55e"="High Sales"
            "#f59e0b"="Medium Sales"
            "#ef4444"="Low Sales"
        }
    }
/%}

Attributes

data
string
required
Name of the table to query
filters
array
IDs of filters to apply to the query
date_range
options group
Use date_range to filter data for specific time periods. Accepts predefined ranges (e.g., “last 12 months”), dynamic ranges (e.g., “Last 90 days”), custom date ranges (e.g., “2020-01-01 to 2023-03-01”), or partial ranges (e.g., “from 2020-01-01”, “until 2023-03-01”)Example:
date_range={
  range = "last 7 days"
  date = "string"
}
Attributes:
  • range: string - Time period to filter. Use presets like ‘last 7 days’, dynamic patterns like ‘Last 90 days’, custom ranges like ‘2020-01-01 to 2023-03-01’, or partial ranges like ‘from 2020-01-01’.
    • Allowed values:
      • last 7 days
      • last 30 days
      • last 3 months
      • last 6 months
      • last 12 months
      • week to date
      • month to date
      • quarter to date
      • year to date
      • previous week
      • previous month
      • previous quarter
      • previous year
      • all time
  • date: string - Date column to filter on. Required when the data has multiple date columns.
date
string
required
Column name for dates
value
string
required
Column name for cell values
title
string
Title to display above the chart
subtitle
string
Subtitle to display below the title
info
string
Information tooltip text (can only be used with title)
URL to link the info text to (can only be used with info)
Create a custom link title for the info link, placed after the info text (can only be used with info_link)
value_fmt
string
default:"num"
Format for values. See Value Formatting for available formats.
legend
boolean
default:"true"
Show color scale legend
borders
boolean
default:"true"
Show borders between calendar cells
chart_options
options group
Color and styling options for the heatmapAttributes:
  • color_palette: array - Array of hex colors for the heatmap gradient
  • conditional_colors: string - SQL CASE expression returning hex colors based on value
  • color_map: map - Maps hex colors to legend labels when using conditional_colors
where
string
Custom SQL WHERE condition to apply to the query. For date filters, use date_range instead.
having
string
Custom SQL HAVING condition to apply to the query after GROUP BY
limit
number
Maximum number of rows to return from the query. Note: When used with tables, limit will disable subtotals to prevent incomplete subtotal rows.
order
string
Column name(s) with optional direction (e.g. “column_name”, “column_name desc”)
qualify
string
Custom SQL QUALIFY condition to filter windowed results
width
number
Set the width of this component (in percent) relative to the page width