Skip to content

Heatmaps API

Heatmaps visualize 3D data (X, Y, and Z intensity) as a 2D colored grid. They are extremely efficient for large matrices.

Adding a Heatmap

Use the addHeatmap method to add a heatmap series.

typescript
chart.addHeatmap({
  id: 'surface-data',
  data: {
    xValues: [0, 1, 2],
    yValues: [0, 1, 2],
    zValues: [
      10, 20, 30, // Y=0 (X=0, 1, 2)
      15, 25, 35, // Y=1 (X=0, 1, 2)
      20, 30, 40  // Y=2 (X=0, 1, 2)
    ]
  },
  style: {
    colorScale: {
      name: 'viridis',
      min: 0,
      max: 50
    },
    interpolation: 'bilinear'
  }
});

HeatmapOptions

PropertyTypeDescription
idstringUnique identifier.
type'heatmap'Must be 'heatmap'.
dataHeatmapDataGrid coordinates and Z values.
styleHeatmapStyleColormap and interpolation settings.

HeatmapData

PropertyTypeDescription
xValuesnumber[] | TypedArrayX coordinates for each column (Length: W).
yValuesnumber[] | TypedArrayY coordinates for each row (Length: H).
zValuesnumber[] | TypedArrayFlattened 1D matrix in row-major order (Length: W * H).

HeatmapStyle

PropertyTypeDescription
colorScaleColorScaleMapping of Z values to colors.
interpolation'nearest' | 'bilinear'Rendering mode (default: 'bilinear').
opacitynumberOverall layer transparency.
showColorbarbooleanWhether to display a color legend.

ColorScale

PropertyTypeDescription
nameColorScaleNamePredefined colormap (e.g., 'viridis', 'plasma', 'jet').
minnumberValue mapped to the lowest color.
maxnumberValue mapped to the highest color.
logScalebooleanUse logarithmic color mapping (Coming soon).

Released under the MIT License.