Ok I have removed the MVP part and with this code you can reproduce
the problem in GWT.


private FlowPanel container;
private PieChart piechart;

public void onModuleLoad() {
   // display initial Piechart with Testdata
   container = new FlowPanel();
   piechart = new PieChart();
   container.add(piechart);
   RootPanel.get().add(container);
   piechart.draw(createTable(),createOptions());

   // add Button which clears the container Panel and redraws the
piechart
   Button button = new Button("reload");
   container.add(button);
   button.addClickHandler(new ClickHandler() {

       @Override
       public void onClick(ClickEvent event) {
         container.clear();
         container.add(piechart1);
         piechart.draw(createTable(),createOptions());
       }
   });
}


createTable and creatOptions are just functions which create some
sample DataTable and Visualization Options (taken from another sample)

Apparantly when I clear the container FlowPanel and then re-add
(reattach) the piechart some reference is lost because as soon as I
call draw on the reattached piechart I get following exception:


Caused by: com.google.gwt.core.client.JavaScriptException:
(TypeError): a is null
 fileName: 
http://www.google.com/uds/api/visualization/1.0/defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js
 lineNumber: 504
 stack: ()@http://www.google.com/uds/api/visualization/1.0/
defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js:
504
([object Object],[object Object])@http://www.google.com/uds/api/
visualization/1.0/defe3df15750b02ac04b4018cb88c896/
default,browserchart,piechart.I.js:528
()@http://www.google.com/uds/api/visualization/1.0/
defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js:
590
([object Object])@http://www.google.com/uds/api/visualization/1.0/
defe3df15750b02ac04b4018cb88c896/default,browserchart,piechart.I.js:
590
([object Object],[object Object])@http://www.google.com/uds/api/
visualization/1.0/defe3df15750b02ac04b4018cb88c896/
default,browserchart,piechart.I.js:600
([object Object],[object Object])@http://127.0.0.1:8888:8


I have uploaded a test sample application which allows you to
reproduce the problem (uses two piechart -> one works the other
doesn't). It's actually pure GWT and Google Visualization (no MVP or
other library used).

http://rapidshare.com/files/425754405/gwtvisualizationsample.zip


On Oct 17, 10:21 am, ChartMan <[email protected]> wrote:
> can you please send a code snippet example.
>
>
>
>
>
>
>
> On Thu, Oct 14, 2010 at 2:29 PM, Ümit <[email protected]> wrote:
> > I have a weird problem with the Google Visualization API and GWT.
> > I am using a MVP Package (gwtp) to create an application. Basically I
> > have two presenters and views respectively.
>
> > One view/presenter displays as static text and the other one displays
> > as PieChart (google-vis-api).
> > As soon as the presenter with the Piechart is revealed a DataTable
> > with some test data is created and passed to the draw method of the
> > Piechart.
> > This works without any problems. The piechart is displayed just fine.
> > However as soon as I navigate away from the pie chart presenter to the
> > static text presenter and then back to the Piechart presenter
> > (thus creating again a DataTable and calling the draw method) I get an
> > visualization error ("a is null").
>
> > if I do a hard refresh (F5) the Piechart works again.
> > The same applies if I recreate the Piechart instance as soon as I
> > display the Piechart page.
>
> > I suspect that there is a problem when detaching and re-attaching  the
> > DOM-container of the visualization widget so that calling draw on the
> > datatable I somewhere get the error "a is null".
>
> > I have attached a sample GWT application (which should contain all
> > necessary libs) which let's you reproduce the problem.
>
> > I have tried to debug it but because the visualization code is
> > obfuscated i didn't get far. As far as I could there seems to be a
> > problem somewhere in the setSelection function.
>
> > Maybe someone has an idea what might be the problem
>
> > Cheers
>
> > Thanks in advance
>
> > Uemit
>
> > P.S.:http://rapidshare.com/files/423663096/gwtpvisualizationsample.zip
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Visualization API" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-visualization- 
> > api%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-visualization-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to