Google Gauge chart creation - Javascript Google Chart

Javascript examples for Google Chart:Gauge Chart

Description

Google Gauge chart creation

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Gauge Chart Example</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.3.js"></script> 
   </head> 
   <body> 
      <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> 
      <div style="width:400px;text-align:center"> 
         <div id="chart_div" style="width: 400px; height: 400px;"> 
         </div> 
         <h1>MemoryAfter</h1> 
      </div> 
      <script type="text/javascript">
      google.charts.load('current', {
        'packages': ['gauge']
      });/*from w  w  w . j ava  2 s. c o  m*/
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Label', 'Value'],
          ['MemoryBefore', 95]
        ]);
        var options = {
          width: 400,
          height: 600,
          redFrom: 90,
          redTo: 100,
          yellowFrom: 75,
          yellowTo: 90,
          minorTicks: 5
        };
        var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
        chart.draw(data, options);
        $("svg > g > text:first").attr("y", 400);
      }

      </script>  
   </body>
</html>

Related Tutorials