$ wnd.google.visualization - undefined

I am currently creating a SmartGWT-based web application (using the portlet layout). Therefore, I have several "portlets" that basically expand the GWT window with various content. Now I want the portlet to display Dygraphs . So I created an implementation of the RPC service that returns a JSON string (based on a DataTable).

Since I cannot serialize the DataTable directly, I use

String json = JsonRenderer.renderDataTable(data, true, true).toString();

where "data" is of type DataTable.

Now this line is correctly passed to the client side, where I want to create a Dygraph. In this topic, someone suggested using

public static native DataTable toDataTable(String json) 
/-{ return new $wnd.google.visualization.DataTable(eval("(" + json + ")")); }-/;

If I use this in my GWT client code, I get an error

com.google.gwt.core.client.JavaScriptException: (TypeError): $wnd.google.visualization is undefined

"" API ? ?

JSON datastring Dygraph? ...

!

+3
1

, visualization.jar XML

<inherits name="com.google.gwt.visualization.Visualization"/>

. , , , .

javascript google (visualization.jar - ). :

1.) :

<script type="text/javascript">
        google.load("visualization", "1", {'packages' : ["corechart"] });
</script>

2.) , :

VisualizationUtils.loadVisualizationApi(onLoadCallback, MotionChart.PACKAGE);

. http://code.google.com/docreader/#p=gwt-google-apis&s=gwt-google-apis&t=VisualizationGettingStarted

Btw. Dygraphs GWT, . : https://github.com/timeu/dygraphs

: GWT dygraphs, JSInterop GWT 2.8: https://github.com/timeu/dygraphs-gwt

. - dygraphs , .

+6

All Articles