Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello everyone,
I getting Above error when i try to bind data with chart in my application.Here is code
C#
for (int i = 0; i < dss.Tables[0].Rows.Count; i++)
              {
                  xval1[i] = dss.Tables[0].Rows[i]["SampleID"].ToString();
                  yval1[i] =Convert.ToDouble(dss.Tables[0].Rows[i]["Fe2o3"].ToString());
              }
              chart1.Series["SalesByMonth"].Points.DataBindXY(xval1, yval1);
              chart1.AlignDataPointsByAxisLabel();
          }

          chart1.ChartAreas["MainChartArea"].AxisX.Title = "Samples";
          chart1.ChartAreas["MainChartArea"].AxisY.Title = "Fe_%";
          chart1.Series["SalesByMonth"].XValueMember = "SampleID";
          chart1.Series["SalesByMonth"].YValueMembers = "Fe2O3";
          chart1.Series["SalesByMonth"].MarkerStyle = System.Web.UI.DataVisualization.Charting.MarkerStyle.Circle;
          chart1.Series["SalesByMonth"].MarkerColor = System.Drawing.Color.Black;
          chart1.Series["SalesByMonth"].YValueType = ChartValueType.Double;

          if (cnt <= 50)
          {
              chart1.ChartAreas["MainChartArea"].AxisX.Interval = 1;
          }
          else if (cnt <= 100)
          {
              chart1.ChartAreas["MainChartArea"].AxisX.Interval = 2;
          }
         chart1.ChartAreas["MainChartArea"].AxisX.LabelStyle.Angle = -90;
          chart1.ChartAreas["MainChartArea"].AxisY.Minimum = 56.86;
          chart1.ChartAreas["MainChartArea"].AxisY.Maximum = 59.78;
          chart1.ChartAreas["MainChartArea"].AxisY.Interval = 0.292;
          chart1.ChartAreas["MainChartArea"].AxisY.LabelStyle.Format = "{#0.##}";


          chart1.DataBind();
          chart1.ChartAreas["MainChartArea"].AxisX.MajorGrid.Enabled = false;
          chart1.ChartAreas["MainChartArea"].AxisY.MajorGrid.Enabled = false;
Posted
Comments
Naz_Firdouse 18-Apr-14 4:55am    
at which line you are getting exception?
ErBhati 18-Apr-14 6:58am    
I am not catching this
Sunasara Imdadhusen 8-May-14 6:18am    
Not clear at all

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900