Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET4.0
Dear Friends,
Here ianm Binding my dataset values to Aspx Chart i have written a code for that But the Legend Text is Coming but the x value and Y values are Not Displaying.
This is My code:
 private void BindChartData()
        DataSet ds = new DataSet(); //Getting the dataSet 
        ds = rpt.GetComputersDetailsByDistrictRespdent();
        //Get the no of series first.. this will be a distinct series list.. 
        List<string> seriesList = new List<string>();
        foreach (DataRow row in ds.Tables[0].Rows)
            string seriesName = row["Computers Per Category"].ToString();
            if (!seriesList.Contains(seriesName))
        //Now bind the xValues and yVlaues for each series 
        foreach (string seriesName in seriesList)
            List<string> xValues = new List<string>();
            List<int> yValues = new List<int>();
            foreach (DataRow row in ds.Tables[0].Rows)
                string xValue = row["District Names"].ToString();
                int yValue = Convert.ToInt32(row["No of Computers"]);
                string sName = row["Respondent"].ToString();
                if (sName == seriesName)
            Chart1.Series[seriesName].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Bar;
            Chart1.Series[seriesName].ChartArea = "ChartArea1";
            Chart1.Series[seriesName].Legend = "Legend1";
            Chart1.Series[seriesName].LegendText = seriesName;
            Chart1.Series[seriesName].Points.DataBindXY(xValues, yValues);
Please Check where i have done Mistake.
Posted 16-Jul-12 22:03pm
Edited 16-Jul-12 22:08pm
(no name)19.1K

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 320
1 OriginalGriff 275
2 Sergey Alexandrovich Kryukov 187
3 Afzaal Ahmad Zeeshan 154
4 Peter Leow 115
0 OriginalGriff 7,510
1 DamithSL 5,494
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514

Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 17 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100