I inspected the DOM for the page to review the elements before and
after the chart was not rendered.

It gwt-viz-container DIV tag is correct, but in the after section it
looks like the HTML, SVG elements are not getting created.

It is almost like the parent panel has lost its PieChart child
association, and is not part of the DOM.

I am using PieChart for corecharts in my application.

Note that I am alson IntensityMaps from the GWT Visualization API
which are rendering fine.

MVP uses a class that implements the  AcceptsOneWidget interface to
manage top-level views. When a call is made to the setOneWidget member
it will call on a remove(widget). I am wondering that maybe during
this call the PieChart may become disconnected from its parent. But,
Intensity maps still keep their relationship.

I am using RootLayoutPanel inside my OnModuleLoad member in my
EntryPoint class. Note I did derive a class (SimpleWidgetPanel) from
LayoutPanel which implements AcceptsOneWidget. (pasted at the end of
this post).

----------------
DOM Before....

<div style="position: relative;" class="gwt-viz-container">
        <iframe name="Drawing_Frame_94943" id="Drawing_Frame_94943"
width="400"
                height="240" frameborder="0" scrolling="no" marginheight="0"
                marginwidth="0">


                <html xmlns="http://www.w3.org/1999/xhtml";
                        xmlns:svg="http://www.w3.org/2000/svg";
                        xmlns:xlink="http://www.w3.org/1999/xlink";>
<head>
<script type="text/javascript">
        var _loaded = false;
        function CHART_loaded() {
                _loaded = true;
        }
</script>
</head>
<body marginwidth="0" marginheight="0" onload="CHART_loaded()">
        <div id="chartArea">
                <svg id="chart" width="400" height="240">

Lots of chart data.... for a pie graph...

                <g></g></svg>
        </div>

        <div
                style="position: absolute; top: 10px; left: 10px; white-space:
nowrap; font-family: Arial; font-size: 11px; font-weight: bold;
display: none;">4
                (16.7%)</div>
</body>
                </html>


        </iframe>
</div>
-----------------------

DOM After...

<div style="position: relative;" class="gwt-viz-container">
        <iframe name="Drawing_Frame_94943" id="Drawing_Frame_94943"
width="400"
                height="240" frameborder="0" scrolling="no" marginheight="0"
                marginwidth="0">
                <html>
                       <head></head>
                       <body marginwidth="0" marginheight="0"></body>
                </html>
        </iframe>
</div>

--------------------------SimpleWidgetPanel



package org.platoscave.gj.client;

import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.Widget;

public class SimpleWidgetPanel extends LayoutPanel implements
AcceptsOneWidget {
        private Widget widget;

        public void setWidget(IsWidget w) {
                System.out.println("SimpleWidgetPanel::setWidget");
                setOneWidget(asWidgetOrNull(w));
        }

        private void setOneWidget(Widget w) {
                // validate
                if (w == widget) {
                System.out.println("SimpleWidgetPanel::setOneWidget w ==
widget");
                        return;
                }

                // remove the old widget
                if (widget != null) {
                        super.remove(widget);
                System.out.println("SimpleWidgetPanel::setOneWidget
super.remove(widget);" );
                }

                // logical attach
                widget = w;
                System.out.println("SimpleWidgetPanel::setOneWidget widget = 
w;");

                if (w != null) {
                        super.add(w);
                        System.out.println("SimpleWidgetPanel::setOneWidget 
super.add(w);"
+ widget.toString());
                }
        }
}



On Nov 29, 9:51 am, McCGJ <[email protected]> wrote:
> -----------------------------------------------------------------------
> Background.........................................................
>
> I created a MyPieChart class that wraps the PieChart.
> import
> com.google.gwt.visualization.client.visualizations.corechart.PieChart;
> import
> com.google.gwt.visualization.client.visualizations.corechart.PieChart.PieOp 
> tions;
>
> GWT 2.4.0
> Visualization 1.1.2
>
> I am loading the the CoreCharts packages
>                 VisualizationUtils.loadVisualizationApi ("1", onLoadCallback,
>                                 CoreChart.PACKAGE, AnnotatedTimeLine.PACKAGE,
> IntensityMap.PACKAGE, MapVisualization.PACKAGE);
>
> I also loaded the RC version from zip file dated gwt-
> visualization-1.1.2-rc2.
>
> I pass the instance of piechart to a VerticalPanel which is contained
> in a view.
> myPanel.add(pieChart).
>
> public class HomeViewImpl extends MainViewBase implements HomeView {
>
> where
>
> In my EntryPoint class OnModule load I am using RootLayoutPanel
> RootLayoutPanel.get().add(appWidget);
>
> The appWidget is a custom class
> public class SimpleWidgetPanel extends LayoutPanel implements
> AcceptsOneWidget {...
>
> This allows me to use the latest LayoutPanels.
>
> I am using browsers: Chrome and OmniWeb
>
> -----------------------------------------------------------------------
> Runtime........................................................
> At runtime the PieChart comes up and is rendered properly and I can
> interact with it.
>
> When I switch to another view using MVP via places, and then go back
> again the piechart is NOT there. When I review the elements in the DOM
> the DIV tag is present by no body, like there was before. It almost
> looks like it is getting cleaned up, or garbage collected.
>
> Note that I have other charts in the GUI that are present when I move
> between views: IntensityMap. These work fine, also, I am using some
> GChart based bar charts that work also.
>
> Best,
> Owen

-- 
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