Skip to main content
Basic Usage
{% heatmap
    data="demo_daily_orders"
    x="date"
    x_date_grain="year"
    y="category"
    value="sum(total_sales)"
/%}

Examples

Basic Usage

Basic Usage
{% heatmap
    data="demo_daily_orders"
    x="date"
    x_date_grain="year"
    y="category"
    value="sum(total_sales)"
/%}

With Custom Colors

With Custom Colors
{% heatmap
    data="demo_daily_orders"
    x="date"
    x_date_grain="year"
    y="category"
    value="sum(total_sales)"
    title="Sales Intensity by Year and Category"
    chart_options={
        color_palette = ["#f7fafc", "#e2e8f0", "#cbd5e0", "#a0aec0", "#718096", "#4a5568", "#2d3748"]
    }
/%}

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.
x_date_grain
string
Time grain for date truncation (default: day for date columns)Allowed values:
  • day
  • week
  • month
  • quarter
  • year
  • hour
  • day of week
  • day of month
  • day of year
  • week of year
  • month of year
  • quarter of year
y_date_grain
string
Time grain for date truncation (default: day for date columns)Allowed values:
  • day
  • week
  • month
  • quarter
  • year
  • hour
  • day of week
  • day of month
  • day of year
  • week of year
  • month of year
  • quarter of year
x
string
required
Column name for x-axis categories
y
string
required
Column name for y-axis categories
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
Info text to display in a tooltip next to the title. Can only be used with the title prop.
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.
x_fmt
string
Format for x axis labels. See Value Formatting for available formats.
y_fmt
string
Format for y axis labels. See Value Formatting for available formats.
x_sort
string
Sort order for x axis categories (asc or desc)Allowed values:
  • asc
  • desc
y_sort
string
Sort order for y axis categories (asc or desc)Allowed values:
  • asc
  • desc
value_sort
string
Sort categories by total value (asc or desc). Applies to the first axis without explicit sort.Allowed values:
  • asc
  • desc
legend
boolean
default:"true"
Show color scale legend
borders
boolean
default:"true"
Show borders around heatmap cells
chart_options
options group
Chart configuration optionsAttributes:
  • color_palette: array
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
height
number
Set a fixed height for the chart in pixels