setInterval should work for you. Additionally, you want to change the data values to add your new value. Check out the following fiddle:
http://jsfiddle.net/VEgxC/ On Monday, July 7, 2014 10:25:20 AM UTC-4, thecatz wrote: > > Hello, > > I'm trying google chart and i want to refresh my char every x seconds, > for that i use setInterval. I don't want to use ajax but juste refresh the > entire chart. is it possible ? > > this is my code : > > <html> > <head> > <script type="text/javascript" src="https://www.google.com/jsapi > "></script> > <script type="text/javascript"> > google.load("visualization", "1", {packages:["corechart"]}); > google.setOnLoadCallback(drawChart); > function drawChart() { > var data = google.visualization.arrayToDataTable([ > [' ', 'Aujourd\'hui','Hier'], > [ ,400,100], > [ ,460,200], > [ ,1120,300], > [ ,540,400] > ]); > > var options = { > vAxis: {minValue: 0} > }; > > var chart = new > google.visualization.AreaChart(document.getElementById('chart_div')); > chart.draw(data, options); > > }; > drawChart(); > setInterval(drawChart, 10000); > > > </script> > </head> > <body> > <div id="chart_div" style="width: 900px; height: 500px;"></div> > </body> > </html> > > > Thx > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
