Val,
Thank you for your response, I am currently using Windows 7 (32 bit). I’ve got Visual Studio 2010 installed on my system and I’m using .NET Framework 3.5 to build this application.
I have copied the code for the aspx and aspx.cs files below.
Please also not that the system is not recognizing ZedGraphControl.Size, it says that size is not a member of ZedGraphControl. But I have successfully used Size in a WindowsForm application.
I hope to hear form you soon.
Regards,
Asim.
-------------------------------------------------------- Default.aspx --------------------------------------------------------
<%@ Page Language=“C#” AutoEventWireup=“true” CodeBehind=“Default.aspx.cs” Inherits=“Oasis._Default” %>
<%@ Register assembly=“WebEdition” namespace=“ThinkGeo.MapSuite.WebEdition” tagprefix=“cc1” %>
<form> id=“form1” runat=“server”>
<asp:ScriptManager ID=“ScriptManager1” runat=“server”>
</asp:ScriptManager>
<cc1:Map ID=“Map1” runat=“server” height=“480px” width=“640px”>
</cc1:Map>
</form>
------------------------------------------------ Default.aspx.cs -----------------------------------------------------
using System;
using System.Drawing;
using System.Web.UI;
using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.WebEdition;
using ZedGraph;
namespace Oasis
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
Map1.CurrentExtent = new RectangleShape(-123.41875, 41.96396484375, -107.158984375, 30.36240234375);
Map1.MapUnit = GeographyUnit.DecimalDegree;
WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay();
Map1.CustomOverlays.Add(worldMapKitOverlay);
//Create our Zedgraph Sytle and wire up the event.
ZedGraphStyle zedGraphStyle = new ZedGraphStyle();
zedGraphStyle.ZedGraphDrawing += new EventHandler<ZedGraphDrawingEventArgs>(zedGraphStyle_ZedGraphDrawing);
zedGraphStyle.RequiredColumnNames.Add(“WHITE”);
zedGraphStyle.RequiredColumnNames.Add(“ASIAN”);
zedGraphStyle.RequiredColumnNames.Add(“AREANAME”);
ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(MapPath("~/SampleData/USA/cities_a.shp"));
citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(zedGraphStyle);
citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.City3(“AREANAME”));
citiesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
citiesLayer.DrawingMarginPercentage = 100;
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add(“Cities”, citiesLayer);
staticOverlay.IsBaseOverlay = false;
Map1.CustomOverlays.Add(staticOverlay);
}
}
private void zedGraphStyle_ZedGraphDrawing(object sender, ZedGraphDrawingEventArgs e)
{
ChangeLabelPosition(((ShapeFileFeatureLayer)((LayerOverlay)Map1.CustomOverlays[1]).Layers[“Cities”]), 100);
ZedGraphControl zedGraph = new ZedGraphControl();
zedGraph.Size = new Size(100, 100);
zedGraph.GraphPane.Fill.Type = FillType.None;
zedGraph.GraphPane.Chart.Fill.Type = FillType.None;
zedGraph.GraphPane.Border.IsVisible = false;
zedGraph.GraphPane.Chart.Border.IsVisible = false;
zedGraph.GraphPane.XAxis.IsVisible = false;
zedGraph.GraphPane.YAxis.IsVisible = false;
zedGraph.GraphPane.Legend.IsVisible = false;
zedGraph.GraphPane.Title.IsVisible = false;
PieItem pieItem1 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues[“WHITE”]), GetColorFromGeoColor(GeoColor.StandardColors.LightBlue), 0, “White”);
pieItem1.LabelDetail.IsVisible = false;
PieItem pieItem2 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues[“ASIAN”]), GetColorFromGeoColor(GeoColor.StandardColors.LightGreen), 0, “Asian”);
pieItem2.LabelDetail.IsVisible = false;
pieItem2.Displacement = 0.2;
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);
}
}
}