I've achieved the integration of a very simple piechart powered by
Google Visualization API into a simple GWT application.
Nevertheless, it seems that I can only create and manipulate the chart
programatically properly when the code generating the graph is placed
under onModuleLoad method, inside click event handlers, or any other
methods that are not asynchronous. Example:
/* Code Begin */
PieChart pie = null;
public void onModuleLoad() {
// Draw your GWT controls and other stuff
Runnable onLoadCallback = new Runnable() {
public void run() {
Panel panel = RootPanel.get();
// Create a pie chart visualization.
PieChart pie = new PieChart(createTable(), createOptions
());
pie.setVisible(true);
//pie.addSelectHandler(createSelectHandler(pie));
panel.add(pie);
}
};
// Load the visualization api, passing the onLoadCallback to be
called
// when loading is done.
AjaxLoader.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);
}
/* Code End */
This code works, but if I place it inside a callback method, when
servlet returns data from a database...., chart is not drawn, and no
errors are thrown.
In other words, I'm trying to load an initial simple GWT application,
without any chart, that after some seconds, queries a database, and
shows retrieved results in a chart from Google Visualization API.
Has somebody successfully achieved this? I'm sure I'm missing some
very basic stuff.
Thanks very much in advance.
--
Miguel
Blog: http://lonifasiko.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" 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-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---