Nunwood VOC Metric Gauge

by Danielle Parkinson

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>

<div id="container" style="width: 400px; height: 400px; margin: 0 auto">
</div>

JavaScript

if (!Highcharts.theme) {
    Highcharts.setOptions({
        chart: {
            backgroundColor: '#fff',
            style: {
                fontFamily: 'Chivo',
                color: '#e6e6e6'
            },
        },
        colors: ['#5773ac', '#597dda', '#adb5c3'],
        title: {
            style: {
                color: '#e6e6e6'
            }
        },
        tooltip: {
            style: {
                color: '#e6e6e6'
            }
        }
    });
}

Highcharts.chart('container', {

    chart: {
        type: 'solidgauge',
        width: 220,
        height: 220
    },
    
    credits: {
    	enabled: false
    },

    title: {
        text: ' ',
        style: {
            fontSize: '24px'
        }
    },

    tooltip: {
        borderWidth: 0,
        backgroundColor: 'none',
        shadow: false,
        style: {
            fontSize: '20px',
        },
        pointFormat: '{series.name}<br><span style="font-size:2em; color: {point.color}; font-weight: bold">{point.y}%</span>',
        positioner: function (labelWidth) {
            return {
                x: 200 - labelWidth / 2,
                y: 180
            };
        }
    },

    pane: {
        startAngle: 0,
        endAngle: 360,
        background: [{ // Track for Move
            outerRadius: '100%',
            innerRadius: '91%',
            backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[0])
                .setOpacity(0.3)
                .get(),
            borderWidth: 0
        }, 
        { // Track for Move
            outerRadius: '90%',
            innerRadius: '81%',
            backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[1])
                .setOpacity(0.3)
                .get(),
            borderWidth: 0
        },
        { // Track for Exercise
            outerRadius: '80%',
            innerRadius: '71%',
            backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[2])
               ...