[GWT][1.0.2] $wnd.google.visualization.DataTable is not a constructor

1,670 views
Skip to first unread message

googelybear

unread,
May 15, 2009, 8:32:02 AM5/15/09
to Google Visualization API
Hi,

When I call DataTable.create(); in my app I get the following
exception:

com.google.gwt.core.client.JavaScriptException: (TypeError):
$wnd.google.visualization.DataTable is not a constructor
fileName: jar:file:/home/myapp/lib/gwt-visualization.jar!/com/google/
gwt/visualization/client/DataTable.java
lineNumber: 33
stack: ()@jar:file:/home/myapp/lib/gwt-visualization.jar!/com/google/
gwt/visualization/client/DataTable.java:33
private void com.google.gwt.http.client.Request.fireOnResponseReceived
(com.google.gwt.http.client.RequestCallback)([object
gwt_nativewrapper_class])@:0
()@jar:file:/opt/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/http/
client/XMLHTTPRequest.java:253
@:0

This only happens in the embedded browser. When I compile it and open
it in forefox the bar chart is displayed. Any ideas what I'm doing
wrong?

Eric Z. Ayers

unread,
May 18, 2009, 1:09:12 PM5/18/09
to Google Visualization API
Hmm... My offhand guess is that you are making calls into the API
before the AjaxLoader or VisualizationUtils.loadAPI() method Runnable
returns.

googelybear

unread,
May 18, 2009, 6:01:33 PM5/18/09
to Google Visualization API
I don't see how that's possible because the packages for the required
charts are loaded in the host page:
<script type="text/javascript" src="http://www.google.com/jsapi"></
script>
<!-- Load packages for visualization API. -->
<script type="text/javascript">
google.load("visualization", "1", {'packages' :
["annotatedtimeline", "barchart"] });
</script>

and for the first charts to get displayed (in my case the barcharts)
you need to log in first. But even if I wait some time and then login
the problem occurrs...

Eric Z. Ayers

unread,
May 19, 2009, 9:52:54 AM5/19/09
to Google Visualization API
On May 18, 6:01 pm, googelybear <googelyb...@gmail.com> wrote:
> I don't see how that's possible because the packages for the required
> charts are loaded in the host page:
> <script type="text/javascript" src="http://www.google.com/jsapi"></
> script>
>         <!-- Load packages for visualization API. -->
> <script type="text/javascript">
>     google.load("visualization", "1", {'packages' :
> ["annotatedtimeline", "barchart"] });
> </script>

This could be part of the problem. The google.load() call is
asynchronous and returns immediately. Since you didn't set a callback,
your code has no idea when the API is ready for use. This is where
using the Java version of ajax loader support might have made things
easier.

> and for the first charts to get displayed (in my case the barcharts)
> you need to log in first. But even if I wait some time and then login
> the problem occurrs...
>

I don't recall which platform you are using. Some of the
visualizations do not show up in Linux hosted mode.

googelybear

unread,
May 19, 2009, 4:26:21 PM5/19/09
to Google Visualization API
oh darn, I changed it for the worse! When migrating to the latest gwt-
visualizations version I had a look at one of the built-in examples
and there the api was loaded via the hostpage so I thought that's the
preferable way to do it and adapted my code accordingly. So what you
would suggest is going back to the Ajaxloader.loadApis - is that
correct?

I'm using a 32bit linux machine and in a previous version the bar
graphs were showing up in hosted mode (even if that's not the case
anymore it should not throw such an exception, which indicates that
I'm doing something wrong).

googelybear

unread,
May 20, 2009, 5:09:49 AM5/20/09
to Google Visualization API
I tried to switch back using the following code:
VisualizationUtils.loadVisualizationApi(new Runnable() {
public void run() {
Dispatcher.dispatch(AppEvents.NavLogin);
}
}, BarChart.PACKAGE, AnnotatedTimeLine.PACKAGE);

but I only get the following error message:
[FATAL] Uncaught JavaScript exception [invalid quantifier {] in
http://www.google.com/uds/api/visualization/1.0/357a57f610020b26f132bc277458c86c/default,annotatedtimeline+en,barchart.I.js,
line 261

when I load the api via the host page it works again..looks like a
regression bug to me....

VizBoy

unread,
May 23, 2009, 9:03:38 AM5/23/09
to google-visua...@googlegroups.com
I got lost in this thread.
Is there currently a bug? Is there something that should work now and doesn't?

- VizBoy.

googelybear

unread,
May 23, 2009, 11:05:11 AM5/23/09
to Google Visualization API
yes there is a bug (at least for me). The above code, using
VisualizationUtils.loadVisualizationApi, does not work in the embedded
browser and results in the above stated exception. I tried it in
Firefox right now and there it seems to work. Maybe another hosted
mode incompatibility?

When I load the visapi via the host page I get the error stated in the
title of the thread: .DataTable is not a constructor (again, only in
the embedded browser). I'm using a Linux/ubuntu 32bit machine.

On 23 Mai, 15:03, VizBoy <viz...@google.com> wrote:
> I got lost in this thread.
> Is there currently a bug? Is there something that should work now and
> doesn't?
>
> - VizBoy.
>
> On Wed, May 20, 2009 at 12:09 PM, googelybear <googelyb...@gmail.com> wrote:
>
> > I tried to switch back using the following code:
> > VisualizationUtils.loadVisualizationApi(new Runnable() {
> >        public void run() {
> >                Dispatcher.dispatch(AppEvents.NavLogin);
> >                        }
> > }, BarChart.PACKAGE, AnnotatedTimeLine.PACKAGE);
>
> > but I only get the following error message:
> > [FATAL] Uncaught JavaScript exception [invalid quantifier {] in
>
> >http://www.google.com/uds/api/visualization/1.0/357a57f610020b26f132b...
> > ,

Eric Z. Ayers

unread,
May 26, 2009, 11:05:54 AM5/26/09
to Google Visualization API, mccom...@gmail.com
I've entered a bug for this in the issue tracker. This seems to be an
incompatibility introduced recently that affects the old version of
Mozilla used by hosted mode.

http://code.google.com/p/gwt-google-apis/issues/detail?id=271
Reply all
Reply to author
Forward
0 new messages