GWT可视化API VisualizationUtils.LoadVisualizationApi [英] GWT Visualization API VisualizationUtils.LoadVisualizationApi
问题描述
我的问题是,是否需要加载可视化API每次我创建一个新图形时,都会按照此示例中的 http://代码.google.com / p / gwt-google-apis / wiki / VisualizationGettingStarted ,或者如果我一次加载可视化文件,是否不再需要创建Runnable以便在加载可视化文件时等待,可以显示?
是的,我们无法使用Google Charts Offline。
b $ b由于我们无法将Google Visualization API下载到我们的本地我们必须动态加载它们。
可运行的方式
Runnable onLoadCallback = new Runnable(){$ b $ public void run()
{
PieChart pie = new PieChart(createTable(result ),createOptions());
pie.addSelectHandler(createSelectHandler(pie));
dataCHTabel.clear();
dataCHTabel.add(pie);
}
};
VisualizationUtils.loadVisualizationApi(onLoadCallback,PieChart.PACKAGE);
可视化API加载的新方法: 上面的行不推荐使用,并且加载所有图表的新方法是 通过在应用程序加载时加载所有程序包 通过在我的主页上添加下面的代码( corechart软件包包含新版本的区域,栏,列,行,饼图,并分散可视化,这些以前由单独的包加载。 然后 geochart不包含在核心内所以,如果你想加载地理图表,你必须添加 Assume an application exists where you have multiple different views, each containing multiple graphs of the same type. My question is, do I need to load the visualization API each time I create a new graph as shown in this example http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted, or if I load the visualization once, do I no longer have to create a Runnable in order to wait when the visualization is loaded so the data can be displayed? Yes,We cannot use Google Charts Offline. As we cannot download the Google Visualization api to our local machine,We have to load them dynamically. The runnable way New way of Visualization API loading: The above line is deprecated and the new way of loading all charts is By Loading all packages while app loading By adding the below code on my host page( The corechart package includes the code for the new versions of the area, bar, column, line, pie, and scatter visualizations, which were previously loaded by separate packages. and then geochart not included in core So ,And if you want to load geo chart ,you have to add
这篇关于GWT可视化API VisualizationUtils.LoadVisualizationApi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
VisualizationUtils.loadVisualizationApi onLoadCallback,CoreChart.PACKAGE);
appname.html
)
< script type =text / javascriptsrc =http://www.google.com/jsapi>< / script>
< script type =text / javascript>
google.load(visualization,1,{'packages':[corechart]});
< / script>
PieChart pie =新的PieChart(createTable(result),createOptions());
pie.addSelectHandler(createSelectHandler(pie));
dataCHTabel.clear();
dataCHTabel.add(pie);
google.load('visualization','1',{'packages':['geochart']});
Runnable onLoadCallback = new Runnable() {
public void run()
{
PieChart pie = new PieChart(createTable(result), createOptions());
pie.addSelectHandler(createSelectHandler(pie));
dataCHTabel.clear();
dataCHTabel.add(pie);
}
};
VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);
VisualizationUtils.loadVisualizationApi(onLoadCallback, CoreChart.PACKAGE);
appname.html
)<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {'packages' : ["corechart"] });
</script>
PieChart pie = new PieChart(createTable(result), createOptions());
pie.addSelectHandler(createSelectHandler(pie));
dataCHTabel.clear();
dataCHTabel.add(pie);
google.load('visualization', '1', {'packages': ['geochart']});