0

I want to draw graph in zed graph , which required double[] x, double[] y. I want to take value from data column nd put in double[]x and double[]y. dtarow[0] value put in double[] x , and datarow[1] value put in double[]y. I get row[0] and row[1] from store procedure in dataset.

This Is code to get value

        DataSet dsGZData = cls.GetDataSP("spReport_GZData_Current");
        DataTable dtGZData = new DataTable();


        dtGZData = dsGZData.Tables[0];
        dgv_GZData.DataSource = dtGZData;

        foreach (DataRow dtrow in dtGZData.Rows)
        {
            foreach (Data Column dc in dtGZData.Columns)
            {
                list1.Add(dtrow[dc]);
                for (int i = 0; i < list1.Count; i++)
                {
                    lbl_point.Text = list1[i].ToString();

               }

            }          

        }

I want this for loop value in double[] x and double [] y

Axel Kemper
  • 10,544
  • 2
  • 31
  • 54
Dipika
  • 399
  • 1
  • 5
  • 16

1 Answers1

0

Try this:

int i = 0;

foreach (DataRow dtrow in dtGZData.Rows)
    {
        double.TryParse(dtrow[0].ToString(), out x[i]);
        double.TryParse(dtrow[1].ToString(), out y[i]);
        i++;
    }
shree.pat18
  • 21,449
  • 3
  • 43
  • 63