jQuery HeatMap: Empty Points

That some data points are not marked with any values.

A live JavaScript/jQuery example of jqxHeatMap, the jQWidgets HeatMap component, with its complete source code below. It is one of 8 jqxHeatMap demos for jQuery.

jqxHeatMap API used in this demo

Source code

To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxHeatMap shows the setup step by step.

The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxheatmap.js.

It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).

script.js

$(document).ready(function () {
    var xAxis = {
        labels: ['John', 'Marry', 'Alba', 'Steven', 'Josh', 'Alica', 'Robert', 'Kim', 'Ann', 'Paul', 'Regina', 'Dorothy']
    };
    var yAxis = {
        labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
    };

    var data = [
        [89, 39, 94, 55, 0],
        [null, 38, 26, 68, 33],
        [22, null, 66, 90, 78],
        [97, 68, 68, 3, 99],
        [47, 47, 88, 6, 1],
        [73, 23, 3, 79, 100],
        [21, 86, 13, 33, null],
        [53, 81, 95, 79, 66],
        [74, 68, 88, null, 43],
        [10, 12, 78, 14, 21],
        [null, 58, 12, 82, 99],
        [88, 23, 86, 59, 53],
    ];

    $("#heatmap").jqxHeatMap({
        xAxis: xAxis,
        yAxis: yAxis,
        source: data,
        title: 'Car sales revenue per employee(in 1000 €)',
        paletteSettings: {
            palette: [
                { value: 0, color: '#5dc3f0', label: '0€' },
                { value: 50, color: '#4bb1de', label: '50€' },
                { value: 100, color: '#3885a6', label: '100€' }
            ],
            emptyPointColor: '#aaa'
        }
    });
});

body.html

<div id="heatmap"></div>

Learn more

More jQuery HeatMap demos