GetChartingStyle error when used List <SharpMap.Styles.VectorStyle>

Topics: Algorithms, CompactFramework, Data Access, Español, General Topics, Italiano, SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0, Web Controls, WinForms Controls
Feb 24, 2012 at 7:32 AM

This is code:

private SharpMap.Map myMap;

    protected void Page_Load(object sender, EventArgs e)
        myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value, (int)imgMap.Height.Value));

        SharpMap.Rendering.Thematics.CustomTheme iTheme = new SharpMap.Rendering.Thematics.CustomTheme(GetChartingStyle); =>Error
        SharpMap.Styles.VectorStyle defaultstyle = new SharpMap.Styles.VectorStyle();
        defaultstyle.Fill = Brushes.Gray;
        iTheme.DefaultStyle = defaultstyle;

        (myMap.GetLayerByName("Cities") as SharpMap.Layers.VectorLayer).Theme = iTheme;

        if (Page.IsPostBack)
            myMap.Center = (SharpMap.Geometries.Point)ViewState["mapCenter"];
            myMap.Zoom = (double)ViewState["mapZoom"];
            ViewState.Add("mapCenter", myMap.Center);
            ViewState.Add("mapZoom", myMap.Zoom);

 public List <SharpMap.Styles.VectorStyle> GetChartingStyle(SharpMap.Data.FeatureDataRow row)
        List<SharpMap.Styles.VectorStyle> lstStyle = new List<SharpMap.Styles.VectorStyle>();

        SharpMap.Styles.VectorStyle style = new SharpMap.Styles.VectorStyle();
        SqlConnection con = new SqlConnection("Server=MANH-PC;uid=sa;pwd=123456;Database=Demomapchart");
        string select = "select top 5 * from tbl_Mapchart";
        SqlDataAdapter adapter = new SqlDataAdapter(select, con);
        DataSet dts = new DataSet();
        DataTable dt = new DataTable();
        foreach (DataRow drow in dt.Rows)
            int numMale = int.Parse(drow["male"].ToString());
            int numFemale = int.Parse(drow["female"].ToString());
            style.Symbol = this.GetChart(numMale, numFemale);

        return lstStyle;

This is error following

Error    1    'System.Collections.Generic.List<SharpMap.Styles.VectorStyle> SimpleChart.GetChartingStyle(SharpMap.Data.FeatureDataRow)' has the wrong return type    C:\Users\Manh\Downloads\New folder (2)\SimpleChart\SimpleChart\SimpleChart.aspx.cs    24    104    C:\...\SimpleChart\


Who can guide me?

Thankyou everyone!!!

Feb 24, 2012 at 8:51 AM
Edited Feb 24, 2012 at 9:15 AM

You must return a single instance of VectorStyle.

Is this some sample code, or is it yours? I assume you want to generate a chart. In this case you could use some chart library (ZedGraph, OxyGraph, ...) and let that draw the chart and you assign it to the symbol.

Hth FObermaier