Highcharts Demo

author(s): Torstein Hønsi

by pawan1_saket

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/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>

<div id="container" style="min-width: 310px; max-width: 400px; height: 300px; margin: 0 auto"></div>

JavaScript

Highcharts.chart('container', {

    chart: {
    		marginTop: 0,
        marginBottom: 0,
    		height: 280,
        width: 280,
        type: 'gauge',
        plotBackgroundColor: null,
        plotBackgroundImage: null,
        plotBorderWidth: 0,
        plotShadow: false
    },

    title: {
        text: null
    },

    pane: {
        startAngle: -120,
        endAngle: 120
    },

    // the value axis
    yAxis: {
        min: 0,
        max: 7,

        minorTickInterval: 'auto',
        minorTickWidth: 0,
        minorTickLength: 10,
        minorTickPosition: 'inside',
        minorTickColor: '#666',

        tickPixelInterval: 30,
        tickWidth: 1,
        tickPosition: 'inside',
        tickLength: 0,
        tickColor: '#666',
        
        labels: {
            enabled: false
        },
        plotBands: [{
            from: 0,
            to: 2,
            color: {
              linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
              stops: [
                [0, '#ffff00'],
                [1, '#ff0000']
              ]
            }, // red
            thickness:'30%'
        }, {
            from: 2,
            to: 5,
            color: {
              linearGradient: { x1: 1, x2: 0, y1: 1, y2: 0 },
              stops: [
                [0, '#ccff66'],
                [1, '#ffff00']
              ]
            }, // yellow
            thickness:'30%'
        }, {
            from: 5,
            to: 7,
            color: {
              linearGradient: { x1: 0, x2: 0, y1: 1, y2: 0 },
              stops: [
                [0, '#009900'],
                [1, '#ccff66']
              ]
            }, // green
            thickness:'30%'
        }]
    },
    plotOptions: {
        gauge: {
            dial: {
                radius: '80%',
                backgroundColor: 'silver',
                borderColor: 'black',
                borderWidth: 1,
                baseWidth: 2,
                topWidth: 1,
               ...