It's because you create a new instance of google.visualization.Gauge every time. You need to create it just once, and call its draw() method for updates.
On Thu, Sep 2, 2010 at 10:06 PM, slothface <[email protected]>wrote: > i was looking at this example > > http://code.google.com/apis/visualization/documentation/gallery/gauge.html#Configuration_Options > > it shows a smooth animation going from one reading to the next... > how can i get a smooth animation in my code. the following code works > but the needle just jumps to the next value rather than a smooth > movement as in the example above...Thanks > > var query = new google.visualization.Query('http://somesite/ > temps_data.cfm'); > var first=1; > > function drawChart(response) { > var data = response.getDataTable(); > var chart = new > google.visualization.Gauge(document.getElementById('chart_div')); > > var options = {width: 400, height: 200, redFrom: 275, redTo: > 300, > yellowFrom:250, yellowTo: 274, greenFrom: 225, greenTo: > 249, majorTicks: > ["0","50","100","150","200","250","300","350","400"],max: > 400,minorTicks:5}; > chart.draw(data, options); > } > > > function init(){ > if(first=1){ > query.send(drawChart); > first=0; > } > setInterval(function(){ > query.send(drawChart); > },5000); > } > google.setOnLoadCallback(init); > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-visualization-api%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
