private void FillData() { BLL.Cls_PublicOperations.Dt = Bll_Station.GetClientData(this.Tag.ToString()); Pnl_Main.Controls.Clear(); if (ISAccumulative) { for (int i = 0; i < BLL.Cls_PublicOperations.Dt.Rows.Count; i++) { Panel Pnl_State = new Panel(); Boolean IsNewItem = true; Pnl_State.Name = "Pnl_State"; Pnl_State.RightToLeft = System.Windows.Forms.RightToLeft.Yes; Pnl_State.Size = new System.Drawing.Size(348, 27); Pnl_State.TabIndex = 5; Pnl_State.Tag = ""; Label Lbl_ParameterCaption = new Label(); Label Lbl_ParameterDesc = new Label(); Lbl_ParameterCaption.ForeColor = System.Drawing.Color.White; Lbl_ParameterCaption.Location = new System.Drawing.Point(97, 7); Lbl_ParameterCaption.Name = "Lbl_ParameterCaption"; Lbl_ParameterCaption.Size = new System.Drawing.Size(240, 26); Lbl_ParameterCaption.TabIndex = 9; Lbl_ParameterCaption.Tag = ""; Lbl_ParameterCaption.Text = BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParameterName"].ToString(); Lbl_ParameterCaption.TextAlign = System.Drawing.ContentAlignment.MiddleRight; Lbl_ParameterCaption.RightToLeft = System.Windows.Forms.RightToLeft.No; System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); string TSql = BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParamaterTSQL"].ToString(); TSql = TSql.Replace("01/01/2015 00:00:00", StartDate.ToString("MM/dd/yyyy")); TSql = TSql.Replace("01/01/2016 00:00:00", EndDate.ToString("MM/dd/yyyy")); if (IsSHift3) { TSql = TSql.Replace("'12/12/2005'", "'" + Shift3beginDate.ToString("MM/dd/yyyy") + "'"); TSql = TSql.Replace("'12/13/2005'", "'" + Shift3Enddate.ToString("MM/dd/yyyy") + "'"); TSql = TSql.Replace("01:00:00", Shift3beginTime); TSql = TSql.Replace("06:00:00", Shift3EndTime); if (IsSHift3 && Times.Length < 5) { TSql = TSql.Replace("strtime", "AND (CAST(dbo.Tb_Client.StartTime AS time) BETWEEN '00:00:00' AND '00:00:00' "); } } TSql = TSql.Replace(" 60 ", " 1 "); TSql = TSql.Replace(" 3600 ", " 1 "); TSql = TSql.Replace("strtime", Times); Dt = Bll_Public.GetDataTableFromTSQL(TSql); Lbl_ParameterDesc.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); Lbl_ParameterDesc.Location = new System.Drawing.Point(8, 7); Lbl_ParameterDesc.Name = "Lbl_ParameterDesc"; Lbl_ParameterDesc.Size = new System.Drawing.Size(91, 26); Lbl_ParameterDesc.TabIndex = 6; Lbl_ParameterDesc.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; Lbl_ParameterDesc.Tag = BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParameterName"].ToString(); decimal Data = 0; if (Dt.Rows.Count > 0) { // Lbl_ParameterDesc.Text = Decimal.Round(Data, 2).ToString(); // Lbl_ParameterDesc.Text = Data.ToString() ; Data = Decimal.Parse(Utility.NZ(Dt.DefaultView[0][0].ToString(), 0).ToString()); if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParameterName"].ToString().ToString().Trim().Contains("(%)")) { Lbl_ParameterDesc.Text = Decimal.Round(Data, 2).ToString(); } else { TimeSpan span = TimeSpan.FromSeconds(Convert.ToDouble(Data)); string label = span.ToString(@"hh\:mm\:ss"); Lbl_ParameterDesc.Text = label; } } else { Lbl_ParameterDesc.Text = "عدم خروجی دستور ایجاد شده"; } Lbl_ParameterDesc.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; foreach (Control x in Pnl_Main.Controls) { if (x.Tag.ToString().Trim().Contains(Lbl_ParameterCaption.Text.Trim())) { if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParameterName"].ToString().Trim().Contains("(%)")) { x.Text = (decimal.Parse(x.Text) + decimal.Parse(Lbl_ParameterDesc.Text)).ToString(); } else { TimeSpan t1 = TimeSpan.Parse(x.Text); TimeSpan t2 = TimeSpan.Parse(Lbl_ParameterDesc.Text); TimeSpan t3 = t1.Add(t2); // TimeSpan span = TimeSpan.FromSeconds(Convert.ToDouble(Data)); x.Text = t3.ToString(); } // x.Text = x.Text + Lbl_ParameterDesc.Text; IsNewItem = false; } } ////foreach (Control x in ((Panel)Pnl_Main.Controls["Pnl_State"]).Controls) ////{ //// if (x.Tag.ToString().Trim().Contains(Lbl_ParameterCaption.Text.Trim())) //// { //// x.Text = (decimal.Parse(x.Text) + decimal.Parse(Lbl_ParameterDesc.Text)).ToString(); //// x.Text = x.Text + Lbl_ParameterDesc.Text; //// IsNewItem = false; //// } ////} //foreach (Control x in ((Panel)Pnl_Main.Controls["Pnl_State"]).Controls) //{ // if (x.Name == "Lbl_ParameterDesc") // { // if (x.Tag.ToString() == Lbl_ParameterCaption.Text) // { // x.Text = x.Text + Lbl_ParameterDesc.Text; // IsNewItem = false; // } // } //} if (IsNewItem) { // Pnl_State.Controls.Add(Lbl_ParameterCaption); // Pnl_State.Controls.Add(Lbl_ParameterDesc); Pnl_Main.Controls.Add(Lbl_ParameterCaption); Pnl_Main.Controls.Add(Lbl_ParameterDesc); Pnl_Main.Controls.Add(Pnl_State); //Pnl_Main.Controls.Add(Pnl_State); } } foreach (Control x in Pnl_Main.Controls) { if (x.Tag.ToString().Trim().Contains("%") || x.Text.ToString().Trim().Contains("%")) { x.Visible = false; } } } else { for (int i = 0; i < BLL.Cls_PublicOperations.Dt.Rows.Count; i++) { Panel Pnl_State = new Panel(); Pnl_State.Name = "Pnl_State"; Pnl_State.RightToLeft = System.Windows.Forms.RightToLeft.Yes; Pnl_State.Size = new System.Drawing.Size(348, 42); Pnl_State.TabIndex = 5; Label Lbl_ParameterCaption = new Label(); Label Lbl_ParameterDesc = new Label(); Lbl_ParameterCaption.ForeColor = System.Drawing.Color.White; Lbl_ParameterCaption.Location = new System.Drawing.Point(97, 7); Lbl_ParameterCaption.Name = "Lbl_ParameterCaption"; Lbl_ParameterCaption.Size = new System.Drawing.Size(240, 26); Lbl_ParameterCaption.TabIndex = 9; Lbl_ParameterCaption.Text = BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParameterName"].ToString(); Lbl_ParameterCaption.TextAlign = System.Drawing.ContentAlignment.MiddleRight; Lbl_ParameterCaption.RightToLeft = System.Windows.Forms.RightToLeft.No; System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); string TSql = BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParamaterTSQL"].ToString(); TSql = TSql.Replace("01/01/2015 00:00:00", StartDate.ToString("MM/dd/yyyy")); TSql = TSql.Replace("01/01/2016 00:00:00", EndDate.ToString("MM/dd/yyyy")); if (IsSHift3) { TSql = TSql.Replace("'12/12/2005'", "'" + Shift3beginDate.ToString("MM/dd/yyyy") + "'"); TSql = TSql.Replace("'12/13/2005'", "'" + Shift3Enddate.ToString("MM/dd/yyyy") + "'"); TSql = TSql.Replace("01:00:00", Shift3beginTime); TSql = TSql.Replace("06:00:00", Shift3EndTime); if (IsSHift3 && Times.Length < 5) { TSql = TSql.Replace("strtime", "AND (CAST(dbo.Tb_Client.StartTime AS time) BETWEEN '00:00:00' AND '00:00:00' "); } } TSql = TSql.Replace(" 60 ", " 1 "); TSql = TSql.Replace(" 3600 ", " 1 "); TSql = TSql.Replace("strtime", Times); Dt = Bll_Public.GetDataTableFromTSQL(TSql); Lbl_ParameterDesc.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); Lbl_ParameterDesc.Location = new System.Drawing.Point(8, 7); Lbl_ParameterDesc.Name = "Lbl_ParameterDesc"; Lbl_ParameterDesc.Size = new System.Drawing.Size(91, 26); Lbl_ParameterDesc.TabIndex = 6; Lbl_ParameterDesc.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; if (Dt.Rows.Count > 0) { decimal Data = Decimal.Parse(Utility.NZ(Dt.DefaultView[0][0].ToString(), 0).ToString()); // Lbl_ParameterDesc.Text = Decimal.Round(Data, 2).ToString(); if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParameterName"].ToString().Trim().Contains("(%)")) { Lbl_ParameterDesc.Text = Decimal.Round(Data, 1).ToString(); } else { TimeSpan span = TimeSpan.FromSeconds(Convert.ToDouble(Data)); string label = String.Format("{0:D2}:{1:D2}:{2:D2}:{3}", span.Days, span.Hours, span.Minutes, span.Seconds);// span.ToString(@"hh\:mm\:ss"); Lbl_ParameterDesc.Text = label; } } else { Lbl_ParameterDesc.Text = "عدم خروجی دستور ایجاد شده"; } Lbl_ParameterDesc.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; Pnl_State.Controls.Add(Lbl_ParameterCaption); Pnl_State.Controls.Add(Lbl_ParameterDesc); Pnl_Main.Controls.Add(Pnl_State); } } }
private void FillData() { BLL.Cls_PublicOperations.Dt = Bll_Chart.GetSpecialChartParameterData(this.Tag.ToString()); MainChart.Series.Clear(); MainChart.ChartAreas.Clear(); MainChart.Legends.Clear(); MainChart.Titles.Clear(); DataTable DtTrend = new DataTable(); System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); string TSql = BLL.Cls_PublicOperations.Dt.DefaultView[0]["TSQL"].ToString(); TSql = TSql.Replace("01/01/2015 00:00:00", StartDate.ToString("MM/dd/yyyy")); TSql = TSql.Replace("01/01/2016 00:00:00", EndDate.ToString("MM/dd/yyyy")); if (IsSHift3) { TSql = TSql.Replace("'12/12/2005'", "'" + Shift3beginDate.ToString("MM/dd/yyyy") + "'"); TSql = TSql.Replace("'12/13/2005'", "'" + Shift3Enddate.ToString("MM/dd/yyyy") + "'"); TSql = TSql.Replace("01:00:00", Shift3beginTime); TSql = TSql.Replace("06:00:00", Shift3EndTime); if (IsSHift3 && Times.Length < 5) { TSql = TSql.Replace("strtime", "AND (CAST(dbo.Tb_Client.StartTime AS time) BETWEEN '00:00:00' AND '00:00:00' "); } } TSql = TSql.Replace(" 60 ", " 1 "); TSql = TSql.Replace(" 3600 ", " 1 "); TSql = TSql.Replace("strtime", Times); if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["chartAxisXType"].ToString() == "1") { if (Mnu_FullDate.Checked) { TSql = TSql.Replace("strcolumns", ",StartDate "); } if (Mnu_Month.Checked) { TSql = TSql.Replace("strcolumns", ",CalIraniMonthID "); } if (Mnu_Week.Checked) { TSql = TSql.Replace("strcolumns", ",CalIraniWeekNum "); } if (Mnu_Year.Checked) { TSql = TSql.Replace("strcolumns", ",CalIraniYearID "); } if (Mnu_FullDate.Checked) { TSql = TSql + " order by startdate"; } if (Mnu_Month.Checked) { TSql = TSql + " order by CalIraniMonthID"; } if (Mnu_Week.Checked) { TSql = TSql + " order by CalIraniWeekNum"; } if (Mnu_Year.Checked) { TSql = TSql + " order by CalIraniYearID"; } } TSql = TSql.Replace("strcolumns", ""); DataTable TempTable = new DataTable(); TempTable = Bll_Public.GetDataTableFromTSQL(TSql); // TempTable.DefaultView.RowFilter = "Fullname <> '0'"; if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ShowChartPurpose"].ToString() == "True") { Dt = TempTable.DefaultView.Table.Select("Fullname <> '0'").CopyToDataTable(); DtTrend = TempTable.DefaultView.Table.Select("Fullname ='0'").CopyToDataTable(); } else { Dt = TempTable.DefaultView.Table.Select("Fullname <> '0'").CopyToDataTable(); } // Dt = Bll_Public.GetDataTableFromTSQL(TSql); MainChart.DataSource = Dt; MainChart.DataBind(); MainChart.Legends.Add("Default"); Boolean IsRandomColor = false; if (Dt.Rows.Count > 1) { if (Dt.DefaultView[0]["StateColor"].ToString() == Dt.DefaultView[1]["StateColor"].ToString() && Dt.DefaultView[0]["ProductLineDesc"].ToString() != Dt.DefaultView[1]["ProductLineDesc"].ToString()) { IsRandomColor = true; } } ColourGenerator generator = new ColourGenerator(); string LegendField, Xfield, YField, LabelType; YField = "Duration"; Xfield = ""; LegendField = ""; LabelType = ""; try { if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["chartAxisXType"].ToString() == "1") { if (Mnu_FullDate.Checked) { // MainChart.DataBindCrossTab(myReader, "Name", "Year", "Sales", "Label=Commissions"); /// MainChart.Series[Dt.DefaultView[i]["Fullname"].ToString()].Points.DataBindXY( Dt.DefaultView[i]["StartDate"].ToString(), ""); Xfield = "StartDate"; } if (Mnu_Month.Checked) { Xfield = "CalIraniMonthID"; } if (Mnu_Week.Checked) { Xfield = "CalIraniWeekNum"; } if (Mnu_Year.Checked) { Xfield = "CalIraniYearID"; } } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["chartAxisXType"].ToString() == "2") { Xfield = "StateCaption"; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["chartAxisXType"].ToString() == "3") { Xfield = "Fullname"; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["chartAxisXType"].ToString() == "7") { Xfield = "ProductLineDesc"; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartLegentType"].ToString() == "1") { LegendField = "StateCaption"; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartLegentType"].ToString() == "2") { LegendField = "Fullname"; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartLegentType"].ToString() == "3") { LegendField = "ProductLineDesc"; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartLegentType"].ToString() == "4") { LegendField = ""; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartTypeDataShow"].ToString() == "1") { LabelType = "Label=#VAL"; } else { LabelType = "Label=#PERCENT"; } if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["IsChartBar"].ToString() == "True") { MainChart.DataBindCrossTable(Dt.AsEnumerable(), LegendField, Xfield, YField, "Label=Duration"); foreach (Series N in MainChart.Series) { N.AxisLabel = "ProductLineDesc"; N.BorderWidth = 2; } } else { MainChart.Series.Add("Default"); for (int i = 0; i < Dt.Rows.Count; i++) { MainChart.Series["Default"].Points.AddXY(Dt.DefaultView[i][Xfield].ToString(), Convert.ToInt32(Dt.DefaultView[i][YField])); } MainChart.Series[0].Legend = "Default"; MainChart.Series[0].IsVisibleInLegend = true; MainChart.Series[0].LegendText = "#VALX"; } try { if (IsRandomColor && BLL.Cls_PublicOperations.Dt.DefaultView[0]["IsChartBar"].ToString() == "True") { foreach (Series N in MainChart.Series) { // N.Color = System.Drawing.ColorTranslator.FromHtml("#" + generator.NextColour()); N.Color = System.Drawing.ColorTranslator.FromHtml("#" + generator.NextColour()); } } if (IsRandomColor && BLL.Cls_PublicOperations.Dt.DefaultView[0]["IsChartBar"].ToString() == "False") { for (int x = 0; x < MainChart.Series.Count; x++) { for (int i = 0; i < MainChart.Series[x].Points.Count; i++) { foreach (Series N in MainChart.Series) { // N.Color = System.Drawing.ColorTranslator.FromHtml("#" + generator.NextColour()); // N.Color = Random(); MainChart.Series[x].Points[i].Color = System.Drawing.ColorTranslator.FromHtml("#" + generator.NextColour()); } } } } else { for (int x = 0; x < MainChart.Series.Count; x++) { for (int i = 0; i < MainChart.Series[x].Points.Count; i++) { for (int j = 0; j < Dt.Rows.Count; j++) { if (Dt.DefaultView[j][LegendField].ToString() == MainChart.Series[x].Points[i].AxisLabel) { MainChart.Series[x].Points[i].Color = Color.FromArgb(Convert.ToInt32(Dt.DefaultView[j]["StateColor"].ToString())); // MainChart.Series[x].Color = Color.Red;// Color.FromArgb(Convert.ToInt32(Dt.DefaultView[j]["StateColor"].ToString())); } } } } } } catch { } try { foreach (Series N in MainChart.Series) { N.AxisLabel = "ProductLineDesc"; N.ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartType"].ToString());// Enum.GetValues (typeof(SeriesChartType), "RangeBar");// System.Windows.Forms.DataVisualization.Charting.SeriesChartType( "System.Windows.Forms.DataVisualization.Charting.SeriesChartType.RangeBar") ; } } catch { } // MainChart.Series [Dt.DefaultView[i]["Fullname"].ToString()].Legend = "Default"; // MainChart.Series [Dt.DefaultView[i]["Fullname"].ToString()].LegendText = "#VALX"; } catch { } try { if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartLegentType"].ToString() == "4") { foreach (Series N in MainChart.Series) { N.IsVisibleInLegend = false; } } } catch { } // MainChart.Series[0].LegendText = "StartDate";// "#VALX"; //if ( BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartLegentType"].ToString() == "1") //{ // MainChart.Series[0].Legend = "Default"; // MainChart.Series[0].LegendText = "#VALX"; //} // MainChart.Series[0].YValueMembers = "Duration";// نمایش مقدار در قسمت Y // MainChart.Series[0].Points.DataBindXY(, ); // MainChart.Series[0].LabelToolTip = "!StartDate"; MainChart.ChartAreas.Add("Main Area"); MainChart.ChartAreas[0].BackColor = Color.Transparent; MainChart.Legends[0].BackColor = Color.Transparent; MainChart.Legends[0].Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Bottom; if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ShowChartCaption"].ToString() == "True") { MainChart.Titles.Add("Default"); MainChart.Titles[0].Text = BLL.Cls_PublicOperations.Dt.DefaultView[0]["Caption"].ToString(); MainChart.Titles[0].Visible = true; } try { if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartTypeDataShow"].ToString() == "1") { for (int x = 0; x < MainChart.Series.Count; x++) { for (int i = 0; i < MainChart.Series[x].Points.Count; i++) { MainChart.Series[x].Points[i].Label = "#VAL"; } } } } catch { } try { if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartTypeDataShow"].ToString() == "2") { for (int x = 0; x < MainChart.Series.Count; x++) { for (int i = 0; i < MainChart.Series[x].Points.Count; i++) { MainChart.Series[x].Points[i].Label = "#PERCENT"; } } } } catch { } try { if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartTypeDataShow"].ToString() == "3") { for (int x = 0; x < MainChart.Series.Count; x++) { for (int i = 0; i < MainChart.Series[x].Points.Count; i++) { MainChart.Series[x].Points[i].Label = ""; } } } } catch { } //if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ChartLegentType"].ToString() == "1") //{ // MainChart.Series[0].LegendText = "StartDate";// "#VALX"; //} //else //{ // MainChart.Series[0].LegendText = "StartDate";// "#VALX"; //} if (BLL.Cls_PublicOperations.Dt.DefaultView[0]["ShowChart3D"].ToString() == "True") { MainChart.ChartAreas[0].Area3DStyle.Enable3D = true; } // Set drawing style // MainChart.Series["Default"]["PieDrawingStyle"] = "SoftEdge"; // MainChart.Series["Default"].IsVisibleInLegend = true; //Lbl_ParameterDesc.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); //Lbl_ParameterDesc.Location = new System.Drawing.Point(8, 7); //Lbl_ParameterDesc.Name = "Lbl_ParameterDesc"; //Lbl_ParameterDesc.Size = new System.Drawing.Size(91, 26); //Lbl_ParameterDesc.TabIndex = 6; //Lbl_ParameterDesc.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; //if (Dt.Rows.Count > 0) //{ // decimal Data = Decimal.Parse(Utility.NZ(Dt.DefaultView[0][0].ToString(), 0).ToString()); // // Lbl_ParameterDesc.Text = Decimal.Round(Data, 2).ToString(); // if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["ParameterName"].ToString().Trim().Contains("(%)")) // { // Lbl_ParameterDesc.Text = Decimal.Round(Data, 1).ToString(); // } // else // { // TimeSpan span = TimeSpan.FromSeconds(Convert.ToDouble(Data)); // string label = String.Format("{0:D2}:{1:D2}:{2:D2}:{3}", span.Days, span.Hours, span.Minutes, span.Seconds);// span.ToString(@"hh\:mm\:ss"); // Lbl_ParameterDesc.Text = label; // } //} //else //{ // Lbl_ParameterDesc.Text = "عدم خروجی دستور ایجاد شده"; //} //Lbl_ParameterDesc.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; //Pnl_State.Controls.Add(Lbl_ParameterCaption); //Pnl_State.Controls.Add(Lbl_ParameterDesc); // Pnl_Main.Controls.Add(Pnl_State); if (DtTrend.Rows.Count > 0) { int x = MainChart.Series.Count; for (int i = 0; i <= x - 1; i++) { DtTrend = TempTable.DefaultView.Table.Select(LegendField + "='" + MainChart.Series[i].Name + "' ").CopyToDataTable(); DtTrend = DtTrend.DefaultView.Table.Select("Fullname = '0' ").CopyToDataTable(); MainChart.Series.Add("زمان در دسترس " + MainChart.Series[i].Name); for (int j = 0; j < DtTrend.DefaultView.Table.Rows.Count; j++) { MainChart.Series["زمان در دسترس " + MainChart.Series[i].Name].Points.AddXY(DtTrend.DefaultView.Table.Rows[j][Xfield].ToString(), Convert.ToInt32(DtTrend.DefaultView.Table.Rows[j][YField])); MainChart.Series["زمان در دسترس " + MainChart.Series[i].Name].ChartType = SeriesChartType.Line; MainChart.Series["زمان در دسترس " + MainChart.Series[i].Name].Color = System.Drawing.ColorTranslator.FromHtml("#" + generator.NextColour()); } } } }