Show more data on Gauge chart - Javascript highcharts

Javascript examples for highcharts:Gauge Chart

Description

Show more data on Gauge chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
      <script type="text/javascript">
$(function () {/*from  w  w  w .  j a  va 2  s  . c o m*/
    $('#container').highcharts({
        chart: {
            plotBackgroundColor: null,
            plotBackgroundImage: null,
            plotBorderWidth: 0,
            plotShadow: false
        },
        title: {
            text: null
        },
        tooltip: {
            enabled: false
        },
        pane: {
            startAngle: -90,
            endAngle: 90,
            background: {
                backgroundColor: '#ccc',
                borderWidth: 0,
                shape: 'arc',
                innerRadius: '60%',
                outerRadius: '95%'
            }
        },
        yAxis: {
            stops: [
                [1, '#f00'] // red
                ],
            min: 0,
            max: 95,
            minorTickLength: 0,
            lineWidth: 0,
            tickPixelInterval: 30,
            tickWidth: 2,
            tickPosition: 'inside',
            tickLength: 5,
            tickColor: '#666',
            tickPositions: [0, 72, 82.68, 95],
            labels: {
                distance: 10
            }
        },
        series: [{
            type: 'gauge',
            data: [14],
            pivot: {
                radius: 0
            },
            dataLabels: {
                y: -5,
                borderWidth: 0,
                style: {
                    fontSize: '20px'
                }
            },
            dial: {
                radius: '85%',
                backgroundColor: 'red',
                borderWidth: 0,
                baseWidth: 3,
                topWidth: 3,
                baseLength: '100%', // of radius
                rearLength: '0%'
            }
        }, {
            type: 'solidgauge',
            fillColor: 'red',
            data: [14.5],
            radius: '95%'
        }]
    },
    // Add some life
    function (chart) {
        if (!chart.renderer.forExport) {
            setInterval(function () {
                var point = chart.series[0].points[0],
                    point2 = chart.series[1].points[0],
                    newVal,
                    inc = Math.round((Math.random() - 0.5) * 20);
                newVal = point.y + inc;
                if (newVal < 0 || newVal > 95) {
                    newVal = point.y - inc;
                }
                point.update(newVal, false);
                point2.update(newVal + 0.5);
            }, 3000);
        }
    });
});

      </script> 
   </head> 
   <body> 
      <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> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; max-width: 400px; height: 300px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials