jQuery BarGauge: Negative Values

This demo displays jqxBarGauge with negative values.

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

jqxBarGauge 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 $.

The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxdraw.js, jqxbargauge.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 () {
    $('#barGauge').jqxBarGauge({
        width: getWidth('barGauge'),
        height: getHeight('barGauge'),
        values: [12, -35, -14.78, 29.5, 23.124, 41],
        relativeInnerRadius: 0.2,
        min: -45,
        baseValue: 0,
        max: 45,
        startAngle: 270,
        endAngle: 90,
        colorScheme: 'scheme02',
        labels: {
            formatFunction: function (value) {
                return value + ' m';
            }, precision: 1, indent: 15
        },
        animationDuration: 0
    });
});

body.html

<div id="barGauge"></div>

Learn more

More jQuery BarGauge demos