public void GenerateChart1(string indicator, string shift, string unit, string mchn, DateTime fromdate, DateTime todate, Series series, int numOfPoints) { Random rand; rand = new Random(20); DBServer db = new DBServer(); DataSet dss = new DataSet(); dss = db.TRs_chart(shift, unit, mchn, fromdate, todate); lock (thisLock) { try { if (dss.Tables[0].Rows.Count > 0) { //Chart2.DataSource = dss.Tables[0]; Chart2.DataSource = dss.Tables[0]; int row = 0; if (dss.Tables[0].Rows.Count > 0) { string[] x = new string[dss.Tables[0].Rows.Count]; string[] y = new string[dss.Tables[0].Rows.Count]; for (int i = 0; i < dss.Tables[0].Rows.Count; i++) { //row += 1; //x[i] = Convert.ToString(row); x[i] = Convert.ToString(dss.Tables[0].Rows[i]["DowntimeType"]); y[i] = Convert.ToString(dss.Tables[0].Rows[i]["TRS"]); Chart2.Series[0].Points.AddY(Convert.ToString(dss.Tables[0].Rows[i]["TRS"])); //Chart1.Series["Default"].Points.DataBindXY(x, y); } } } else { ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('No Record found !');", true); } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex); } finally { } } }