Angular Gauge

Angular Gauge, or Speedometer chart is mostly used to show data which is shown using similar gauges in real life, like speed, volume equalizer, clock, etc. Our Angular Gauge chart can display multiple axes, multiple arrows, also show color bands on the axis.

by vitormosousa

HTML

<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Gauge Test</title>
    <style>body {
        padding: 0;
        margin: 0;
        background: #fff
    }</style>
</head>
<body>

<button onclick="animateGauges()">Animate</button>

<hr>

<canvas data-type="radial-gauge"
        data-major-ticks="0, 30, 60, 90, 120, 150, 180, 150, 120, 90, 60, 30 ,0"
        data-start-angle= "180"
        data-minor-ticks= "5"
        data-ticks-angle="360"
        
        data-stroke-ticks= "true"
 data-highlights='[
 {"from": 0, "to": 180, "color": "rgba(255, 0, 0, .8)"},
    {"from": 180, "to": 0, "color": "rgba(0, 255, 0, .8)"}
 
 ]'
        data-type="radial-gauge"
        data-title="Barometer"
        data-units="mBar"
        data-width="200"
        data-height="200"
        data-value-int="0"
        data-value-dec="0"
        data-width="200"
        data-height="200"
        data-min-value="0"
        data-max-value="360"
        data-highlights="false"
        
        
></canvas>

<script async src="../gauge.min.js"></script>
<script>
    var timers = [];

    function animateGauges() {
        document.gauges.forEach(function(gauge) {
            timers.push(setInterval(function() {
                gauge.value = Math.random() *
                    (gauge.options.maxValue - gauge.options.minValue) +
                    gauge.options.minValue;
            }, gauge.animation.duration + 50));
        });
    }
</script>
</body>
</html>

CSS

#chartdiv {
	width	: 100%;
	height	: 200px;
}

JavaScript

/*!
 * The MIT License (MIT)
 * 
 * Copyright (c) 2016 Mykhailo Stadnyk <[email protected]>
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 * @version 2.1.5
 */
!function(e){"use strict";function t(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(t||(t="undefined"==typeof window?global:window),void...