Hello, I am using GWT and its visualization API wrapper. I am using GWT 2.1.0.M2 and gwt-visualization-1.1.0. Things work perfectly when I load my application for the first time, in the browser and click a button to load the visualization API and display it in the GUI. However it only works from the initial page load. If I navigate a bit and click the button again to re-load the data, I get a timeout error.
If I use a google datasource like : http://spreadsheets.google.com/tq?key=pWiorx-0l9mwIuwX5CbEALA&range=A1:B12&gid=0&headers=-1 My app can reload the content and never times out. Has anyone ever seen this before? I have a servlet which returns a string: Here is the servlet code : protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json"); response.getWriter().write("google.visualization.Query.setResponse({version:'0.6',reqId:'0',status:'ok',sig:'106459472',table: {cols:[{id:'A',label:'Source',type:'string',pattern:''}, {id:'B',label:'Percent',type:'number',pattern:'#0.01%'}],rows:[{c: [{v:'This'},{v:0.37,f:'37.00%'}]},{c:[{v:'That'},{v:0.25,f:'25.00%'}]}, {c:[{v:'The Other'},{v:0.23,f:'23.00%'}]},{c:[{v:'Thing'},{v: 0.06,f:'6.00%'}]},{c:[{v:'Biomass'},{v:0.04,f:'4.00%'}]},{c: [{v:'Hydro'},{v:0.03,f:'3.00%'}]},{c:[{v:'Solar Heat'},{v: 0.005,f:'0.50%'}]},{c:[{v:'Wind'},{v:0.003,f:'0.30%'}]},{c: [{v:'Geothermal'},{v:0.002,f:'0.20%'}]},{c:[{v:'Biofuels'},{v: 0.002,f:'0.20%'}]},{c:[{v:'Solar photovoltaic'},{v: 4.0E-4,f:'0.04%'}]}]}});"); } I have another project: An eclipse GWT project which uses the visualization API wrapper to fetch this data source. The VerticalPanel's constructor looks like this : public AlertsListPanel() { initWidget(uiBinder.createAndBindUi(this)); String dataUrl = "http://localhost:8080/TestServlet/Test"; OnLoadAPIForTable onLoadCallback = new OnLoadAPIForTable(dataUrl); VisualizationUtils.loadVisualizationApi(onLoadCallback, Table.PACKAGE); } The callback class looks like this : private class OnLoadAPIForTable implements Runnable{ private StatusPopUp popUp; private String url; public OnLoadAPIForTable (String url){ this.popUp = new StatusPopUp("Loading"); this.url = url; } @Override public void run(){ Query query = Query.create(url); // Send the query. query.send(new Callback() { public void onResponse(QueryResponse response) { if (response.isError()) { Window.alert(response.getMessage()); popUp.clean(); } else { // Get the data from the QueryResponse. DataTable data = response.getDataTable(); // Create the Options object. Options options = createTableOptions(); // Create a PieChart and add it to a panel. Table tbl = new Table(data, options); tbl.addSelectHandler(createSelectHandler(tbl)); dataVisualization.add(tbl); popUp.clean(); } } }); } private Table.Options createTableOptions() { Table.Options options = Table.Options.create(); options.setAlternatingRowStyle(true); options.setHeight("400px"); options.setWidth("800"); options.setPage(Table.Options.Policy.ENABLE); options.setPageSize(10); return options; } private SelectHandler createSelectHandler(final Table chart) { return new SelectHandler() { @Override public void onSelect(SelectEvent event) { String message = ""; // May be multiple selections. JsArray<Selection> selections = chart.getSelections(); for (int i = 0; i < selections.length(); i++) { // add a new line for each selection message += i == 0 ? "" : "\n"; Selection selection = selections.get(i); if (selection.isCell()) { // isCell() returns true if a cell has been selected. // getRow() returns the row number of the selected cell. int row = selection.getRow(); // getColumn() returns the column number of the selected cell. int column = selection.getColumn(); message += "cell " + row + ":" + column + " selected"; } else if (selection.isRow()) { // isRow() returns true if an entire row has been selected. // getRow() returns the row number of the selected row. int row = selection.getRow(); message += "row " + row + " selected"; } else { // unreachable message += "Pie chart selections should be either row selections or cell selections."; message += " Other visualizations support column selections as well."; } } Window.alert(message); } }; } } Thanks in advance for any suggestions on helping me understand this timeout issue. R. -- 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.
