public void GenerateChart(string indicator, string shift, DateTime fromdate, DateTime todate, string unit, string mchn, Series series, int numOfPoints)
    {
        lock (thisLock)
        {
            try
            {
                Random rand;
                rand = new Random(20);
                DBServer db  = new DBServer();
                DataSet  dss = new DataSet();
                dss = db.TRG_chart(shift, unit, mchn, fromdate, todate);


                if (dss.Tables[0].Rows.Count > 0)
                {
                    Chart1.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"]);
                            //decimal trg_chart=0;
                            //trg_chart = Convert.ToDecimal(dss.Tables[0].Rows[i]["TRG"]);
                            //y[i] = trg_chart / 100;
                            //Chart1.Series[0].Points.AddY(y[i]);
                            //Chart1.Series["Default"].Points.DataBindXY(x, y);
                            x[i] = Convert.ToString(dss.Tables[0].Rows[i]["DowntimeType"]);

                            y[i] = Convert.ToString(dss.Tables[0].Rows[i]["TRG"]);
                            Chart1.Series[0].Points.AddY(Convert.ToString(dss.Tables[0].Rows[i]["TRG"]));
                        }
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('No Record found !');", true);
                }
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendExcepToDB(ex);
            }
        }
    }