Actualiza los indicadores de Google con nuevos valores

The below script shows a Google gauge.

I have a jQuery get statement that occurs on a 15 second basis.

setInterval( updateGui, 1000);
$.get("update.php",function (data){updateGages()},"json");

I would like to replace the updateGages() with some script to update the gauges.

¿Alguna idea?

<html>
  <head>
    <script type='text/javascript' src='https://www.google.com/jsapi'></script>
    <script type='text/javascript'>
      google.load('visualization', '1', {packages:['gauge']});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Label', 'Value'],
          ['Memory', 80],
          ['CPU', 55],
          ['Network', 68]
        ]);

        var options = {
          width: 400, height: 120,
          redFrom: 90, redTo: 100,
          yellowFrom:75, yellowTo: 90,
          minorTicks: 5
        };

        var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id='chart_div'></div>
  </body>
</html>

preguntado el 30 de agosto de 12 a las 17:08

Posible duplicado de esta publicación -

Re-drawing the chart as done on this post causes it to flicker. -

1 Respuestas

Update the data table, redraw by calling chart.draw(). I'm not seeing any flicker as mentioned in your comment.

http://jsfiddle.net/7fmKx/

Respondido 30 ago 12, 19:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.