Ben, If you can keep the same page open, without redrawing the whole page, then you can fetch data via a sequence of AJAX requests to the server where the data is made available, and accumulate the data within the page in a JS object, and redraw each time there is new data. There is some documentation on how to do a single ajax request at:
https://developers.google.com/chart/interactive/docs/php_example You can also do the AJAX request (also called xhr) via a google.visualization.Query() call: https://developers.google.com/chart/interactive/docs/reference#queryobjects I don't have an example of how to accumulate the data in JS, but you'll want to update a DataTable by adding new rows to it: https://developers.google.com/chart/interactive/docs/reference#addrow On the other hand, if you need to refresh the page, then you'll have to do the accumulation of data on a server and send everything that is to be displayed to the browser for each refresh. It is also possible to store data persistently on the browser's machine, but that is probably more complex than you want to get into. On Wed, Feb 19, 2014 at 2:09 PM, Ben Andrews <[email protected]>wrote: > Hi Daniel, Thanks for the quick reply. > > I will try that and see how well it works. I am unsure what the best way > to grab the data and store it is though to display it on the graph. Would > you be able to give me any pointers on that? > > Thanks, Ben > > > On Tuesday, 18 February 2014 15:02:39 UTC, Daniel LaLiberte wrote: > >> Ben, >> >> Refreshing the graph by calling chart.draw(data, options) is not >> necessarily an expensive operation, depending on the amount of data you are >> drawing. An hour of 1-second data is probably not going to be too much of >> a burden. How about trying it to see how well it works. >> >> If you just want to show the last hour of data, then as each new value >> comes in (to the browser, I presume), drop the oldest if it is older than >> an hour. >> >> >> On Sun, Feb 16, 2014 at 11:13 AM, Ben Andrews >> <[email protected]>wrote: >> >>> Hi, >>> >>> I have data being fed from a temperature sensor into my code that >>> refreshes every second. What I would like to do is store the data every >>> time it refreshes and then plot this data on a line graph that updates >>> automatically. Ideally I would just like to plot an extra point every time >>> it comes along so I don't have to refresh the entire graph every second. >>> The data need only be stored for an hour or so. >>> >>> I have managed to get a Gauge to update in real time to show me the >>> temperature but am a bit stuck as to how to do the line graph. >>> >>> Any help would be much appreciated. >>> >>> Thanks, >>> Ben Andrews >>> >>> -- >>> 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/groups/opt_out. >>> >> >> >> >> -- >> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> >> - 978-394-1058 >> [email protected] 5CC, Cambridge MA >> [email protected] 9 Juniper Ridge Road, Acton MA >> > -- > 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/groups/opt_out. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> - 978-394-1058 [email protected] <[email protected]> 5CC, Cambridge MA [email protected] <[email protected]> 9 Juniper Ridge Road, Acton MA -- 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/groups/opt_out.
