Hi
There seems to be ton of issues below and I am not sure if they are all
relevant.
1) setRefreshable(true) is not necessary as the default is 'true'
2) setRefreshInterval accepts a 'number' parameter which is the number of
seconds to wait between repeating queries.
3) The refresh mechanism is independent from how you use to communicate with
your server. There are 2 main methods:
script injection - requests to any gviz data source
XHR - requests to data source that have the same domain as the current
page
4) The default gviz data source implementation for the server supports only
requests that are sent using XHR.
If you want your data source to support script injection you should add
the following code (copied from below):
@Override
protected boolean isRestrictedAccessMode() {
return false;
}
5) The type of response which is used depends on how the query is sent
script injection - JSONP
XHR - JSON
Both are transparent to the client code that uses the query.
Last and most important, when the query is refreshed the client code uses a
signature scheme to identify if the current query returns any new data. The
signature scheme is implemented on the client as well as on the server. When
a query is identified as a repeating query and when there was no data
change, a special error response is used: 'not_modified'. The client code
will get this response and drop it before it ever reaches the handler code
set for the query. In particular you can safely set your handler to redraw
the chart when it is called and expect it to be called only when data
changes.
HTH
ChartMan
On Sun, Aug 15, 2010 at 12:42 PM, trisk3ll <[email protected]> wrote:
> Hi there,
>
> This issue took me all day to sort out so am posting the fix here to
> help others out.
>
> I was trying to get setRefreshInterval working.
>
> this.query.setRefreshable(true);
> this.query.setRefreshInterval(10);
> this.query.send(function(response) {
> self.handleResponse(response)
> });
>
> Lots of problems with this though.. See here for example.
>
> http://groups.google.com/group/google-visualization-api/browse_thread/thread/2e7b35f01cd44e85/c033e54d1a3d8147
>
> http://code.google.com/p/google-visualization-api-issues/issues/detail?id=106
>
> What I was seeing was the Google spreadsheet datasources were working
> fine but my own custom datasource was ignoring the refresh interval.
>
> Solution.
>
> Turns out that google.visualization.Query supports two modes JSON and
> JSONP. I found I had to change to using JSONP with this call.
> query = new google.visualization.Query(dataSourceUrl,
> {sendMethod:'scriptInjection'});
>
> Then I was getting cross-site script errors. I had to dump restricted
> mode on my custom servlet.
>
> public class RegisterDataSourceServlet extends DataSourceServlet {
>
> @Override
> protected boolean isRestrictedAccessMode() {
> return false;
> }
> }
>
>
> Hope that helps others.
>
> Damon.
>
> --
> 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.