问题
I have downloaded http://code.google.com/p/gwt-google-apis/downloads/detail?name=gwt-visualization-1.1.0.zip&can=2&q= archive that comes with jar that is needed in order to use charts in GWT. In the archive is also example application (http://gwt.google.com/samples/hellovisualization-1.1.0/HelloVisualization.html). But this example is not working for me. It has an runtime error at this line: DataTable data = DataTable.create();
Eclipse reports this: com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'DataTable' of undefined.
What is wrong here?
回答1:
You should call VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE) to load the api and write onLoadCallBack function to do sth. when the API is loaded.
来源:https://stackoverflow.com/questions/3652640/gwt-with-charts-api-example-from-google-not-working