Reverse X-Axis Origin
Reverse Y-Axis Origin

jQuery HeatMap: Inversed Axis

Inversed axis position.

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, jqxcheckbox.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'],
        isInversed: true
    };
    var yAxis = {
        labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
        isInversed: true
    };

    var data = [
        [89, 39, 94, 55, 3],
        [53, 38, 26, 68, 33],
        [22, 0, 66, 90, 78],
        [97, 68, 68, 3, 99],
        [47, 47, 88, 6, 1],
        [73, 23, 3, 79, 100],
        [21, 86, 13, 33, 0],
        [53, 81, 95, 79, 66],
        [74, 68, 88, 51, 43],
        [10, 12, 78, 14, 21],
        [55, 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 €)',
    });

    $(".jqxcheckbox").jqxCheckBox({
        width: 170,
        height: 25,
        checked: true
    });

    $("#xAxis").on("change", function () {
        var isChecked = $('#xAxis').jqxCheckBox('checked');

        $("#heatmap").jqxHeatMap('reverseXAxisPosition', isChecked);
    });

    $("#yAxis").on("change", function () {
        var isChecked = $('#yAxis').jqxCheckBox('checked');

        $("#heatmap").jqxHeatMap('reverseYAxisPosition', isChecked);
    });
});

body.html

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

<div id="options">
    <div id="xAxis" class="jqxcheckbox">Reverse X-Axis Origin</div>
    <div id="yAxis" class="jqxcheckbox">Reverse Y-Axis Origin</div>
</div>

Learn more

More jQuery HeatMap demos