ThinkGeo.com    |     Documentation    |     Premium Support

ZedGraph issue

Hi,


It looks like that when using ZedGraphStyle the graphics generated  will go away.... when zooming in / out the map a random number of  time!!!!.  I have a meeting soon and I need to get this feature stable enough.


thanks a lot.


jm.



my code part1 
  
 
 ZedGraphStyle zedGraphStyle = new ZedGraphStyle();
                                    zedGraphStyle.ZedGraphDrawing += new EventHandler<ZedGraphDrawingEventArgs>(zedGraphStyle_ZedGraphDrawing);
                                    zedGraphStyle.RequiredColumnNames.Add("WPG");
                                    zedGraphStyle.RequiredColumnNames.Add("FLEXIBLE");
                                    zedGraphStyle.RequiredColumnNames.Add("BONDED");
                                    zedGraphStyle.Name = "ZGRAPH";

                                    TDGeospatialFeatureLayer ZGRAPH = new TDGeospatialFeatureLayer(
                                                            "SELECT {0} FROM DBIPAD02.GIS_TREX_PIE_STATES_LEVEL AS T0, DBIPAD02.TL_2010_US_STATE10 AS T1 WHERE T0.STUSPS10 = T1.STUSPS10",
                                                            "CAST(GEOM.ST_Centroid() AS ST_GEOMETRY) AS GEOM, WPG, BONDED, FLEXIBLE, T0.STUSPS10");

                                    ZGRAPH.Name = "ZGRAPH";
                                    ZGRAPH.IsVisible = true;
                                    ZGRAPH.Transparency = 95.00F;
                                    ZGRAPH.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
                                    ZGRAPH.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(zedGraphStyle);
                                    ZGRAPH.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.Capital1("STUSPS10"));
                                    ZGRAPH.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                                    layerOverlay_Data_Store.Layers.Add("ZGRAPH", ZGRAPH);
 
 
  
 part 2: 
 
 private void zedGraphStyle_ZedGraphDrawing(object sender, ZedGraphDrawingEventArgs e)
        {
            ZedGraphControl zedGraph = new ZedGraphControl();
            zedGraph.Size = new Size(150, 150);           

            zedGraph.GraphPane.Fill.Type = FillType.None;
            zedGraph.GraphPane.Chart.Fill.Type = FillType.None;

            zedGraph.GraphPane.Border.IsVisible = true;
            zedGraph.GraphPane.Chart.Border.IsVisible = true; ;
            zedGraph.GraphPane.XAxis.IsVisible = false;
            zedGraph.GraphPane.YAxis.IsVisible = false;
            zedGraph.GraphPane.Legend.IsVisible = true;
            zedGraph.GraphPane.Title.IsVisible = true;

            PieItem pieItem1 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["WPG"]), GetColorFromGeoColor(GeoColor.StandardColors.Green), 0, "WPG");
            pieItem1.LabelDetail.IsVisible = true;
            //pieItem1.Displacement = 0.1;

            PieItem pieItem2 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["FLEXIBLE"]), GetColorFromGeoColor(GeoColor.StandardColors.Pink), 0, "FLEXIBLE");
            pieItem2.LabelDetail.IsVisible = true;
            //pieItem2.Displacement = 0.1;

            PieItem pieItem3 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["BONDED"]), GetColorFromGeoColor(GeoColor.StandardColors.Blue), 0, "BONDED");
            pieItem3.LabelDetail.IsVisible = true;
            //pieItem3.Displacement = 0.1;

            zedGraph.AxisChange();

            e.Bitmap = zedGraph.GraphPane.GetImage();
        }
        private void ChangeLabelPosition(ShapeFileFeatureLayer shapeFileLayer, int graphHeight)
        {
            ((TextStyle)shapeFileLayer.ZoomLevelSet.ZoomLevel01.CustomStyles[1]).XOffsetInPixel = -20;
            ((TextStyle)shapeFileLayer.ZoomLevelSet.ZoomLevel01.CustomStyles[1]).YOffsetInPixel = Convert.ToSingle(graphHeight * 0.4);
        }
        private Color GetColorFromGeoColor(GeoColor geoColor)
        {
            return Color.FromArgb(geoColor.AlphaComponent, geoColor.RedComponent, geoColor.GreenComponent, geoColor.BlueComponent);
        }
 


Error creating window handle… again 
  
 please help!!!

Hi All, 
  
 Any news about this issue? 
  
 thanks in advance. 
  
 jm

Hi All, 
  
 Still no news??? 
  
 I need to know when this will be fixed. 
  
 thanks in advance. 
  
 jm.

Hello Jean-marie, 
  
 Sorry for waiting so long, I’m working on this now, I will try to reslove this asap. 
  
 Regards, 
  
 Gary

Hello we are also having the same problem, exception: "Error creating window handle". When we move map and change zoom the graphs dissapear.



We are using web map suite 5.5.



We have some urgency in solving this problem, is there any fix for this?

Hi Luis&JM, 
 JM, sorry for a long time delay. 
 It proved a bug from ZedGraph and the exception occurs when a large number of ZedGraph (more than 3313) features were drawn.  
 Now, Please try to add the below codes at the end of “zedGraphStyle_ZedGraphDrawing” method to solve the issue: 
              e.Bitmap = zedGraph.GraphPane.GetImage();
            zedGraph.Dispose();
 
 Hope it will work for you. 
 Best regards, 
 Johnny

thanks Johnny, problem solved :)





Regards

Luís Diogo

Hi Luis, 
  
 Good to hear it works. 
  
 if any other questions, please feel free to let us know. 
  
 Best regards. 
 Johnny