AG Studio Launch Week šŸš€šŸš€šŸš€ 28 Sep - 2 Oct 2026 šŸš€šŸš€šŸš€ Join now

JavaScript ChartsHeatmap Series

Version 14.2.0
Enterprise

A Heatmap Series displays data in a matrix format, using colours to denote the magnitude of the values.

Simple Heatmap Copy Link

To create a Heatmap Series, use the heatmap series type.

{
    series: [
        {
            type: 'heatmap',
            xKey: 'month',
            yKey: 'year',
            colorKey: 'temperature',
        },
    ],
}

In this configuration:

  • xKey is set to 'month', which is the category for the x-axis.
  • yKey is set to 'year', which is the category for the y-axis.
  • colorKey is set to 'temperature', which supplies numerical values for the Colour Scale.

Colour Scale Copy Link

Use colorScale to control how numeric values map to colours. This includes custom colours, discrete bins, and a fixed domain.

{
    series: [
        {
            type: 'heatmap',
            xKey: 'month',
            yKey: 'year',
            colorKey: 'temperature',
            colorScale: {
                fills: [{ color: 'navy' }, { color: 'lightyellow', stop: 10 }, { color: 'darkred' }],
            },
        },
    ],
}

In this example:

  • fills specifies the colours and optional stop positions. Without stop values, colours are spaced equally across the data range.
  • mode switches between a 'continuous' gradient and 'discrete' bins.
  • domain overrides the auto-detected range to consistent colours regardless of the data extent.

For the full range of options including named stops, missing data handling, and more see the Colour Scale page.

Labels Copy Link

If label.enabled is set to true, the labels will show the numeric value from colorKey.

colorKey: 'temperature',
label: {
    enabled: true,
    formatter: ({ datum: { temperature } }) => `${temperature.toFixed(0)}°C`,
}

A label formatter can be used to customise the label text.

Gradient Legend Copy Link

The Gradient Legend is enabled by default for heatmap series using a colorKey. It displays a colour bar to help match cell colours to values.

{
    gradientLegend: {
        enabled: true,
    },
}

For position, size, and label customisation options, see the Colour Scale page.

Heatmap Chart Examples Copy Link

See more Heatmap Chart examples in the AG Charts Gallery.

API Reference Copy Link

Properties available on the AgHeatmapSeriesOptions interface.

type required 'heatmap'
Configuration for the Heatmap Series.
xKey required DatumKey
The key to use to retrieve x-values from the data.
yKey required DatumKey
The key to use to retrieve y-values from the data.
id string default: auto-generated value
Primary identifier for the series. This is provided as `seriesId` in user callbacks to differentiate multiple series. Auto-generated ids are subject to future change without warning, if your callbacks need to vary behaviour by series please supply your own unique `id` value.
context ContextDefault
Context object to use in callbacks.
data DatumDefault[]
The data to use when rendering the series. If this is not supplied, data must be set on the chart instead.
visible boolean
Whether to display the series.
cursor string
The cursor to use for hovered markers. This config is identical to the CSS `cursor` property.
highlight AgHighlightOptions
Configuration for highlighting when a series or legend item is hovered over.
selection AgSelectionOptions
Configuration for data selection.
nodeClickRange InteractionRange
Range from a node that a click triggers the listener.
listeners AgSeriesListeners
A map of event names to event listeners.
xKeyAxis string default: 'x'
The key of the x-axis to which this series is bound.
yKeyAxis string default: 'y'
The key of the y-axis to which this series is bound.
colorKey DatumKey
The name of the node key containing the colour value. This value (along with `colorScale` config) will be used to determine the cell colour.
xName string
A human-readable description of the x-values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
yName string
A human-readable description of the y-values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
colorName string
A human-readable description of the colour values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
label AgHeatmapSeriesLabelOptions
Options for the label in each cell.
itemPadding PixelSize
Minimum distance between the label text and the edges of the cell.
cornerRadius PixelSize default: 0
The corner radius applied to every cell. The chart background shows through the area cut away by the rounded corners.
title string
The title to use for the series. Defaults to `yName` if it exists, or `yKey` if not.
itemStyler Styler
Function used to return formatting for individual heatmap cells, based on the given parameters.
tooltip AgSeriesTooltip
Series-specific tooltip configuration.
colorScale AgColorScale
Configuration for colour scale with fills, domain, and mode.
stroke AgCssColorOrRef
The colour for the stroke.
strokeWidth PixelSize
The width of the stroke in pixels.
strokeOpacity Opacity
The opacity of the stroke colour.
showInMiniChart boolean
Whether to include the series in the Mini Chart.

Properties available on the AgGradientLegendOptions interface.

enabled boolean
Whether to show the gradient legend. By default, the chart displays a gradient legend for series using a `colorKey`.
position AgChartLegendPosition default: 'bottom'
Position of the gradient legend. A placement keyword, or an object for fine-grained positioning.
gradient AgGradientLegendBarOptions
Gradient bar configuration.
spacing PixelSize default: 20
The spacing in pixels to use outside the legend. __Note:__ This only applies when `floating: false`.
reverseOrder boolean
Reverse the display order of legend items if `true`.
scale AgGradientLegendScaleOptions
Options for the numbers that appear below or to the side of the gradient.
border BorderOptions
The border around the legend.
cornerRadius PixelSize
The corner radius of the legend.
padding Padding
The padding between the border and legend items. A number applies uniform padding; an object sets each side.
fill AgColorType
The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill.
fillOpacity Opacity
The opacity of the fill colour.