public void GenerateChart3(string year, string indicator, string shift, string fromdate, string todate, string unit, string mchn, Series series, int numOfPoints) { Random rand; rand = new Random(20); DBServer db = new DBServer(); DataSet dss = new DataSet(); dss = db.labor_chart_year(year, shift, fromdate, todate, unit, mchn, db); lock (thisLock) { try { if (dss.Tables[0].Rows.Count > 0) { Chart4.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); y[i] = Convert.ToString(dss.Tables[0].Rows[i]["ttl"]); Chart4.Series[0].Points.AddY(Convert.ToString(dss.Tables[0].Rows[i]["ttl"])); // Chart4.Series["Default4"].Points.DataBindXY(x, y); } } } else { ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('No Record found !');", true); } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex); } } }