Hello,
I'm trying to integrate Google Visualization API into my project which
uses GWT-Ext.
I've started with the Getting started sample and replaced the GWT
Panel by GWT-Ext Panel, and now the chart doesn't appear anymore! Is
there an incompatibility between both libraries?
Here is my code:
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.visualization.client.visualizations.PieChart;
import com.google.gwt.visualization.client.AjaxLoader;
import com.google.gwt.visualization.client.DataTable;
import com.google.gwt.visualization.client.AbstractDataTable;
import com.gwtext.client.widgets.*;
public class BackofficeTest implements EntryPoint {
public void onModuleLoad() {
final Panel chartPanel = new Panel("charts");
// expand panel to browser viewport
new Viewport(chartPanel);
// Create a callback to be called when the visualization API
// has been loaded.
Runnable onLoadCallback = new Runnable() {
public void run() {
// Create a pie chart visualization.
PieChart pie = new PieChart(createTable(), createOptions());
// main panel
chartPanel.add(pie);
MessageBox.alert("loaded");
}
};
// Load the visualization api, passing the onLoadCallback to be
called
// when loading is done.
AjaxLoader.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);
}
private PieChart.Options createOptions() {
PieChart.Options options = PieChart.Options.create();
options.setWidth(400);
options.setHeight(240);
options.set3D(true);
options.setTitle("My Daily Activities");
return options;
}
private AbstractDataTable createTable() {
DataTable data = DataTable.create();
data.addColumn(AbstractDataTable.ColumnType.STRING, "Task");
data.addColumn(AbstractDataTable.ColumnType.NUMBER, "Hours per
Day");
data.addRows(2);
data.setValue(0, 0, "Work");
data.setValue(0, 1, 14);
data.setValue(1, 0, "Sleep");
data.setValue(1, 1, 10);
return data;
}
}
thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---