That depends on how your data source is set up.  If your data source 
accepts a time stamp like that and only sends back new data, then you can 
add the new data to your DataTable (or update the old data, depending on 
whether this is an addition or replacement of data).  How you go about that 
depends on the way the data is set back from the server.

Long story short, yes it could be as easy as calling the DataTable's 
#addRows method.  The DataTable and chart would not have to be in global 
scope (I generally recommend against having anything in global scope if you 
can avoid it), but they probably should be in scope for your data updating 
function, though you could code it such that they don't have to be.

On Wednesday, November 14, 2012 3:42:18 PM UTC-5, Justin Novack wrote:
>
> This REPLACES the current DataTable, is there a recommended way to UPDATE 
> or ADD to the existing DataTable?
>
> I believe the original poster wants to keep all the current data, but just 
> update from his last retrieval.  How does one keep track of the last data 
> sent and request data from last successful request?
>
> I assume having a global last_timestamp variable and sending that at the 
> end of 'path/to/data/source?last_timestamp=123456". But if the url passes 
> back the last minutes' worth of data, is it as simple as iterating through 
> the data and using chart.addRows()? Would you have to globalize chart?
>
> On Monday, November 12, 2012 4:04:13 PM UTC-5, asgallant wrote:
>>
>>             success: function (response) {
>>                 var data = new google.visualization.DataTable(response);
>>                 chart.draw(data, {
>>                     title: "Chart1",
>>                     hAxis: {
>>                         title: "Time Stamp"
>>                     }, 
>>                     vAxis: {
>>                         title: "Measured Value"
>>                     }
>>                 });
>>             }
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/ONxekJYDp1QJ.
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.

Reply via email to