Hi,
I'm not being very clear, sorry. Basically, all I want is to have my
charts update automatically. As you know, there's 2 methods talking to
each other here:
Client: Query.send(callback)
Servlet: generateTable(query, request)
The generateTable sends a DataTable back to the callback correctly the
first time. But nothing happens after this. Regardless of whether or
not the DataTable produced by generateTable has changed, I would still
expect the generateTable method to be called at the
query.setRefreshInterval (5 seconds).
I must be doing something wrong, because I can't see how the
query.send can poll if the DataTable has changed, since generateTable
is just a stupid method that returns a DataTable object whenever it is
called.
I don't even mind if the full dataTable is sent back to the callback
every 5 seconds, I just want to see that it updates in realtime.
Here are the important parts of my code:
Servlet:
public class FetchDataTable extends DataSourceServlet{
@Override
public DataTable generateDataTable(Query query, HttpServletRequest
request) throws DataSourceException {
System.out.println("DataTableGenerator: [" + new Date() + "] -
" + request.getRequestURL() + " - " + request.getQueryString());
DataTable dataTable = generator.buildDataTableFromDB();
return dataTable;
}
...
}
Client:
final Runnable onLoadCallback = new Runnable() {
public void run() {
final Visualization chart = ChartManager.buildChart
(chartType, width, height, title);
wrapper.addChild(chart);
FetchDataTable?tqx=reqId:" + (Math.random() * 1000000)));
query.setRefreshInterval(5);
query.send(new Callback(){
public void onResponse(QueryResponse response) {
if (response.isError())
SC.say("An error occured: " +
response.getDetailedMessage());
else
{
chart.draw(response.getDataTable
(),ChartOptions.create(chartType, width, height, title));
wrapper.unmask();
}
}
});
}
};
// Load the visualization api, passing the onLoadCallback to
be called when loading is done.
ChartOnlineAPI.loadAPI(chartType, onLoadCallback);
On Aug 13, 10:17 am, VizWiz <
viz...@google.com> wrote:
> Hi,
>
> I am not sure why you would like to change this behavior, however, there is
> currently no api for changing it.
>
> The code that handles this is in JsonRenderer.renderJsonResponse (lines
> 120-128). It is open source, so you can change it as you like for your own
> use and as long as it is in the confines of the code license.
>
> Cheers,
> VizWiz.
>