JavaScript Heatmap Grid Chart - Editor

This example showcases simple usage of HeatmapGridSeries, a simple, yet incredibly series type.

HeatmapGridSeries visualizes three dimensional data (X, Y, color) of large quantities.
It can easily handle data sets in million data points range even on low-end devices.
With large amounts of RAM even billions of data points can be visualized!

Heatmaps can be created in XY Charts:

// Add heatmap Grid Series to a XY Chart
chartXY.addHeatmapGridSeries({
    columns: horizontalResolution,
    rows: verticalResolution,
})

The data used for the heatmap is created using the WaterdropGenerator function in the example code.

Heatmap Grid Series options

When HeatmapGridSeries is created, there are minimum of two properties that have to be specified:

columns: amount of data values along X dimension.

rows: amount of data values along Y dimension.

Configuration of these two properties is enough for a fully functioning heatmap grid series.

The following optional properties can be used for tweaking heatmap behavior for exact application purposes:

start: Axis coordinate where heatmap grid begins.

end: Axis coordinate where heatmap grid ends.

step: Alternate syntax, supplying a step value will result in automatic calculation of end based on columns / rows amount.

dataOrder: By default incoming intensity data is treated as list of columns. This can be flipped by selecting dataOrder: 'rows'.

Heatmap Grid Series data input

The data set of HeatmapGridSeries is defined as a number matrix, for example:

// Example syntax of 3x5 number matrix.
;[
    [0, 1, 0, 1, 0],
    [1, 0, 1, 0, 0],
    [0, 0, 0, 0, 0],
]

The data set is specified with invalidateIntensityValues method. There are two overrides for this method.

// Example syntax, invalidate intensity values override #1, specify data from beginning of heatmap.
heatmap.invalidateIntensityValues([
    // dataOrder: 'columns', columns: 3, rows: 5
    [0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0],
])
// Example syntax, invalidate intensity values override #2, specify data from arbitrary offset.
heatmap.invalidateIntensityValues({
    iColumn: 10,
    iRow: 0,
    values: [
        [0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0],
    ],
})