Wednesday, September 4, 2013

Re: GeoChart not working in GWT application

I don't know how to fix the problem you're facing, but if I understand correctly, you're wrapping the JS API. Have you considered using any of the two already available wrappers for GWT?:

https://code.google.com/p/gwt-charts/ ("unofficial" but apparently more up-to-date with the JS API)

I use the first one successfully with only a few JSNI snippets of code. I've never used the GeoChart, but both wrappers above claim to support it.



On Friday, August 30, 2013 10:07:49 AM UTC-4, Marian M. wrote:
Hi all,

I'm working at an application made with gwt.. and I just integrated some charts with GWT Visualization api from google.
Most of the charts have wrappers to implement those available in JS also in GWT.
So, I made a wrapper for GeoChart chart.. and I got an error every time I try to instantiate this chart. Rest of the charts work perfectly.

This is the error:

16:51:10.322 [ERROR] [reporting] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError) @com.qfp.reporting.charts.wrappers.GeoChart::createJso(Lcom/google/gwt/dom/client/Element;)([JavaScript object(3951)]): undefined is not a function
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.qfp.reporting.charts.wrappers.GeoChart.createJso(GeoChart.java)
    at com.google.gwt.visualization.client.visualizations.Visualization.<init>(Visualization.java:65)
    at com.google.gwt.visualization.client.visualizations.Visualization.<init>(Visualization.java:71)
    at com.google.gwt.visualization.client.visualizations.corechart.CoreChart.<init>(CoreChart.java:69)
    at com.qfp.reporting.charts.wrappers.GeoChart.<init>(GeoChart.java:74)
    at com.qfp.reporting.client.WidgetEditor$28.run(WidgetEditor.java:711)
    at com.google.gwt.ajaxloader.client.ExceptionHelper.runProtected(ExceptionHelper.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:662)


I've debugged the application line by line and still can't figure what's the problem. In my chart wrapper I have the method createJso() implemented as a native method. In the superclasses of my class respectively, CoreChart and Visualization, I also have the method, only difference is that in Visualization superclass the createJso method is declarated as abstract.

I really can't seem to find what's the problem. For the other charts everything works well.

This is the part of the code that generates the error. 

  public Visualization() {
    Element div = DOM.createDiv();
    -->>>    jso = createJso(div);   <<<--
    setElement(div);
    setStyleName("gwt-viz-container");
  }

  public Visualization(AbstractDataTable data, OptionsType options) {
    this();
    this.options = options;
    this.dataTable = data;
  }


Thank you,
Marian

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment