//private void BindingDataChart() //{ // try // { // DataTable dt = SMT_EMD_BTS_MONTHLY_SELECT("C", "2019", "", ""); // ChartVSM.DataSource = dt; // ChartVSM.Series[0].ArgumentDataMember = "DD"; // ChartVSM.Series[0].ValueDataMembers.AddRange(new string[] { "VJ1" }); // ChartVSM.Series[1].ArgumentDataMember = "DD"; // ChartVSM.Series[1].ValueDataMembers.AddRange(new string[] { "VJ2" }); // chartUpper.DataSource = dt; // chartUpper.Series[0].ArgumentDataMember = "DD"; // chartUpper.Series[0].ValueDataMembers.AddRange(new string[] { "LA" }); // chartUpper.Series[1].ArgumentDataMember = "DD"; // chartUpper.Series[1].ValueDataMembers.AddRange(new string[] { "VJ3" }); // } // catch { } //} private void BindingDataChart() { try { DataTable dt = SMT_EMD_BTS_MONTHLY_SELECT("C", "2020", ComVar.Var._strValue1, ""); //ChartVSM.DataSource = dt; //ChartVSM.Series[0].ArgumentDataMember = "DD"; //ChartVSM.Series[0].ValueDataMembers.AddRange(new string[] { "VJ1" }); //ChartVSM.Series[1].ArgumentDataMember = "DD"; //ChartVSM.Series[1].ValueDataMembers.AddRange(new string[] { "VJ2" }); DevExpress.XtraCharts.ChartTitle chartTitle1 = new DevExpress.XtraCharts.ChartTitle(); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); ChartVSM.DataSource = dt; ChartVSM.SeriesDataMember = "DIV"; ChartVSM.SeriesTemplate.ArgumentDataMember = "YMD"; ChartVSM.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "BTS" }); ChartVSM.SeriesTemplate.View = lineSeriesView1; ChartVSM.SeriesTemplate.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ChartVSM.Titles.Clear(); chartTitle1.Font = new System.Drawing.Font("Tahoma", 14F); chartTitle1.Text = ComVar.Var._strValue2;// + " Support"; this.ChartVSM.Titles.AddRange(new DevExpress.XtraCharts.ChartTitle[] { chartTitle1 }); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; } catch { } }
public override void BeginInitialize( ) { seriesLabel = new DevExpress.XtraCharts.PointSeriesLabel(); seriesView = new DevExpress.XtraCharts.LineSeriesView(); pointOptions = new DevExpress.XtraCharts.PointOptions(); base.BeginInitialize(); }
//private void BindingDataChart() //{ // try // { // DataTable dt = SMT_EMD_BTS_MONTHLY_SELECT("C", uc_month.GetValue().ToString(), ComVar.Var._strValue1, ""); // ChartVSM.DataSource = dt; // ChartVSM.Series[0].ArgumentDataMember = "DD"; // ChartVSM.Series[0].ValueDataMembers.AddRange(new string[] { "VJ1" }); // ChartVSM.Series[1].ArgumentDataMember = "DD"; // ChartVSM.Series[1].ValueDataMembers.AddRange(new string[] { "VJ2" }); // } // catch { } //} private void BindingDataChart() { try { DataTable dt = SMT_EMD_BTS_MONTHLY_SELECT("C", uc_month.GetValue().ToString(), ComVar.Var._strValue1, ""); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); ChartVSM.DataSource = dt; ChartVSM.SeriesDataMember = "DIV"; ChartVSM.SeriesTemplate.ArgumentDataMember = "YMD"; ChartVSM.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "BTS" }); ChartVSM.SeriesTemplate.View = lineSeriesView1; ChartVSM.SeriesTemplate.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; } catch { } }
private void CreateChart(DataTable _dt, DevExpress.XtraCharts.ChartControl _chartControl) { try { _dt.Rows.RemoveAt(0); ((XYDiagram)_chartControl.Diagram).EnableAxisXZooming = true; //((XYDiagram)barChartControl.Diagram).AxisX.NumericScaleOptions.ScaleMode = DevExpress.XtraCharts.ScaleMode.Automatic; ((XYDiagram)_chartControl.Diagram).AxisX.VisualRange.Auto = false; ((XYDiagram)_chartControl.Diagram).AxisX.VisualRange.AutoSideMargins = false; ((XYDiagram)_chartControl.Diagram).AxisX.VisualRange.SideMarginsValue = 2; ((XYDiagram)_chartControl.Diagram).AxisX.Label.Angle = 0; ((XYDiagram)_chartControl.Diagram).AxisX.Label.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)_chartControl.Diagram).AxisX.Title.Text = "Model"; ((XYDiagram)_chartControl.Diagram).AxisX.Title.Font = new Font("Calibri", 14F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisY.Label.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)_chartControl.Diagram).AxisY.Title.Text = " Inventory (Prs)"; ((XYDiagram)_chartControl.Diagram).AxisY.Label.TextPattern = "{V:###,###}"; ((XYDiagram)_chartControl.Diagram).AxisY.Title.Font = new Font("Calibri", 14F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisY.Title.TextColor = Color.DarkOrange; ((XYDiagram)_chartControl.Diagram).AxisX.Title.TextColor = Color.DarkOrange; ((XYDiagram)_chartControl.Diagram).AxisX.Label.Angle = 50; DevExpress.XtraCharts.LineSeriesView splineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesSlideAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); _chartControl.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; _chartControl.Series.Clear(); _chartControl.Titles.Clear(); Series series1 = new Series("Inventory", ViewType.Bar); Series series2 = new Series("Leadtime", ViewType.Line); Legend lgBox = new Legend(); lgBox.Visibility = DevExpress.Utils.DefaultBoolean.True; lgBox.Font = new Font("Calibri", 16F, System.Drawing.FontStyle.Bold); if (_dt != null && _dt.Rows.Count > 0) { for (int iRow = 0; iRow < _dt.Rows.Count; iRow++) { if (_dt.Rows[iRow]["INV_QTY"].ToString() != "") { series1.Points.Add(new SeriesPoint(_dt.Rows[iRow]["MODEL_NAME"].ToString(), Convert.ToInt32(_dt.Rows[iRow]["INV_QTY"].ToString()))); } else { series1.Points.Add(new SeriesPoint(_dt.Rows[iRow]["MODEL_NAME"].ToString(), 0)); } if (_dt.Rows[iRow]["LEADTIME"].ToString() != "") { series2.Points.Add(new SeriesPoint(_dt.Rows[iRow]["MODEL_NAME"].ToString(), Convert.ToDouble(_dt.Rows[iRow]["LEADTIME"].ToString()))); } else { series2.Points.Add(new SeriesPoint(_dt.Rows[iRow]["MODEL_NAME"].ToString(), 0)); } } } sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Shadow.Visible = false; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series1.Label.TextPattern = "{V:###,###}"; series1.ArgumentScaleType = ScaleType.Qualitative; series1.View = sideBySideBarSeriesView1; splineSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); splineSeriesView1.LineStyle.Thickness = 2; splineSeriesView1.SeriesAnimation = xySeriesSlideAnimation1; splineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; splineSeriesView1.LineMarkerOptions.Size = 15; splineSeriesView1.LineMarkerOptions.Color = Color.DodgerBlue; series2.Label.BackColor = Color.White; series2.Label.Font = new System.Drawing.Font("Calibri", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.TextPattern = "{V:##0.#}"; series2.ArgumentScaleType = ScaleType.Qualitative; series2.View = splineSeriesView1; // Access the type-specific options of the diagram. _chartControl.Series.AddRange(new Series[] { series1, series2 }); SecondaryAxisY myAxisY = new SecondaryAxisY("my Y-Axis"); //myAxisY.VisualRange.SetMinMaxValues(0, 20); myAxisY.Title.Text = "Leadtime (Days)"; myAxisY.Tickmarks.MinorVisible = true; //((XYDiagram)barChartControl.Diagram).AxisY.WholeRange.SetMinMaxValues(90, 100); myAxisY.Label.Font = new System.Drawing.Font("Calibri", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); myAxisY.Title.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); myAxisY.Label.TextPattern = "{V:##0.##}"; myAxisY.Title.TextColor = Color.DarkOrange; myAxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; ((XYDiagram)_chartControl.Diagram).SecondaryAxesY.Clear(); ((XYDiagram)_chartControl.Diagram).SecondaryAxesY.Add(myAxisY); ((LineSeriesView)series2.View).AxisY = myAxisY; // _chartControl.Legends.Add(lgBox); // Add a title to the chart (if necessary). // _chartControl.Titles.Add(new ChartTitle()); //_chartControl.Titles[0].Text = "Production"; } catch (Exception EX) { } }
private void CreateChart(DataTable _dt, DevExpress.XtraCharts.ChartControl _chartControl) { try { ((XYDiagram)_chartControl.Diagram).EnableAxisXZooming = true; //((XYDiagram)barChartControl.Diagram).AxisX.NumericScaleOptions.ScaleMode = DevExpress.XtraCharts.ScaleMode.Automatic; ((XYDiagram)_chartControl.Diagram).AxisX.VisualRange.Auto = false; ((XYDiagram)_chartControl.Diagram).AxisX.VisualRange.AutoSideMargins = false; ((XYDiagram)_chartControl.Diagram).AxisX.VisualRange.SideMarginsValue = 2; ((XYDiagram)_chartControl.Diagram).AxisX.Label.Angle = 0; ((XYDiagram)_chartControl.Diagram).AxisX.Label.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)_chartControl.Diagram).AxisX.Title.Text = "Date"; ((XYDiagram)_chartControl.Diagram).AxisX.Title.Font = new Font("Calibri", 14F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisY.Label.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)_chartControl.Diagram).AxisY.Title.Text = " Qty (Prs)"; ((XYDiagram)_chartControl.Diagram).AxisY.Label.TextPattern = "{V:###,###}"; ((XYDiagram)_chartControl.Diagram).AxisY.Title.Font = new Font("Calibri", 14F, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisY.Title.TextColor = Color.DarkOrange; ((XYDiagram)_chartControl.Diagram).AxisX.Title.TextColor = Color.DarkOrange; DevExpress.XtraCharts.LineSeriesView splineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesSlideAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); _chartControl.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; _chartControl.Series.Clear(); _chartControl.Titles.Clear(); Series series1 = new Series("Production", ViewType.Bar); Series series2 = new Series("Plan", ViewType.Line); Legend lgBox = new Legend(); lgBox.Visibility = DevExpress.Utils.DefaultBoolean.True; lgBox.Font = new Font("Calibri", 16F, System.Drawing.FontStyle.Bold); if (_dt != null && _dt.Rows.Count > 0) { for (int iRow = 0; iRow < _dt.Rows.Count; iRow++) { if (_dt.Rows[iRow]["DIV"].ToString() == "1") { for (int iCol = 1; iCol < _dt.Columns.Count; iCol++) { if (_dt.Rows[iRow][iCol].ToString() != "") { series2.Points.Add(new SeriesPoint(_dt.Columns[iCol].Caption.ToString().Substring(7, 2), Convert.ToInt32(_dt.Rows[iRow][iCol].ToString()))); } else { series2.Points.Add(new SeriesPoint(_dt.Columns[iCol].Caption.ToString().Substring(7, 2), 0)); } } } if (_dt.Rows[iRow]["DIV"].ToString() == "2") { for (int iCol = 1; iCol < _dt.Columns.Count; iCol++) { if (_dt.Rows[iRow][iCol].ToString() != "") { series1.Points.Add(new SeriesPoint(_dt.Columns[iCol].Caption.ToString().Substring(7, 2), Convert.ToInt32(_dt.Rows[iRow][iCol].ToString()))); } else { series1.Points.Add(new SeriesPoint(_dt.Columns[iCol].Caption.ToString().Substring(7, 2), 0)); } } } } } sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Shadow.Visible = false; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series1.Label.TextPattern = "{V:###,###}"; series1.ArgumentScaleType = ScaleType.Qualitative; series1.View = sideBySideBarSeriesView1; splineSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); splineSeriesView1.LineStyle.Thickness = 2; splineSeriesView1.SeriesAnimation = xySeriesSlideAnimation1; splineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; splineSeriesView1.LineMarkerOptions.Size = 15; splineSeriesView1.LineMarkerOptions.Color = Color.DodgerBlue; series2.Label.BackColor = Color.White; series2.Label.Font = new System.Drawing.Font("Calibri", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.TextPattern = "{V:###,###}"; series2.ArgumentScaleType = ScaleType.Qualitative; series2.View = splineSeriesView1; // Access the type-specific options of the diagram. _chartControl.Series.AddRange(new Series[] { series1, series2 }); _chartControl.Legends.Add(lgBox); // Add a title to the chart (if necessary). // _chartControl.Titles.Add(new ChartTitle()); //_chartControl.Titles[0].Text = "Production"; } catch (Exception EX) { } }
private void CreateChart(DevExpress.XtraCharts.ChartControl Chart, DataTable dt, string col) { try { Chart.Series.Clear(); //Chart.Titles.Clear(); Chart.AppearanceNameSerializable = "Chameleon"; Chart.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView = new DevExpress.XtraCharts.SideBySideBarSeriesView(); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView1.Color = System.Drawing.Color.LimeGreen; lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); lineSeriesView1.LineStyle.Thickness = 3; sideBySideBarSeriesView.ColorEach = false; sideBySideBarSeriesView.FillStyle.FillMode = DevExpress.XtraCharts.FillMode.Solid; string[] value = null; Chart.Series.Add("Target", ViewType.Line); Chart.Series[0].View = lineSeriesView1; if (dt != null && dt.Rows.Count > 0) { for (int i_col = 3; i_col < dt.Columns.Count; i_col++) { Chart.Series.Add(line.Substring(0, 3) == "TOT" ? "Lean " + dt.Columns[i_col].ColumnName.Replace("'", "") : "Line " + dt.Columns[i_col].ColumnName.Replace("'", ""), ViewType.Bar); for (int i = 0; i < dt.Rows.Count; i++) { Chart.Series[i_col - 2].View.Color = System.Drawing.Color.ForestGreen; Chart.Series[i_col - 2].View = sideBySideBarSeriesView; if (dt.Rows[i][i_col].ToString() != "") { value = dt.Rows[i][i_col].ToString().Split('/'); //Chart.Series[i - 1].Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), value[0])); if (Convert.ToDouble(value[0]) > 0) { Chart.Series[i_col - 2].Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), Convert.ToDouble(value[0]))); Chart.Series[0].Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), Convert.ToDouble(value[1]))); } else { Chart.Series[i_col - 2].Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString())); Chart.Series[0].Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), Convert.ToDouble(value[1]))); } if (Convert.ToDouble(value[0]) < Convert.ToDouble(value[1])) { Chart.Series[i_col - 2].Points[i].Color = Color.Red; } else { Chart.Series[i_col - 2].Points[i].Color = System.Drawing.Color.ForestGreen; } } else { Chart.Series[i_col - 2].Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString())); Chart.Series[0].Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString())); } Chart.Series[i_col - 2].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; Chart.Series[i_col - 2].Label.TextPattern = "{S}"; ((SideBySideBarSeriesLabel)Chart.Series[i_col - 2].Label).Position = BarSeriesLabelPosition.Top; Chart.Series[i_col - 2].Label.TextOrientation = TextOrientation.BottomToTop; } } //Chart.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1 }; //Chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; //((XYDiagram)Chart.Diagram).AxisX.Label.Font = new System.Drawing.Font("Calibri", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //((XYDiagram)Chart.Diagram).AxisX.Title.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //((XYDiagram)Chart.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; //((XYDiagram)Chart.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 14F); //((XYDiagram)Chart.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //((XYDiagram)Chart.Diagram).AxisY.Title.Text = "Production (Prs)"; } } catch (Exception EX) { } }
private void BindingChartData() { try { this.Cursor = Cursors.WaitCursor; // chartControl1.Titles.Add(new ChartTitle { Text = "Real-Time Charting" }); dataPoints.Clear(); dt = SEL_SMT_INST_SET_CHART(ComVar.Var._strValue1, ComVar.Var._strValue2); BindingGridData(dt); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.LineSeriesView lineSeriesView2 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.LineSeriesView lineSeriesView3 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.LineSeriesView lineSeriesView4 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.PointSeriesLabel pointSeriesLabel4 = new DevExpress.XtraCharts.PointSeriesLabel(); Series series = new Series("Upper", ViewType.Line); series.ChangeView(ViewType.Line); series.DataSource = dataPoints; series.ArgumentDataMember = "sArgument"; series.ValueDataMembers.AddRange("UP_QTY"); series.CrosshairLabelPattern = "{V:#,#} Prs"; //format //lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView1.LineStyle.Thickness = 2; series.View = lineSeriesView1; Series series2 = new Series("Finish Sole", ViewType.Line); series2.ChangeView(ViewType.Line); series2.DataSource = dataPoints; series2.ArgumentDataMember = "sArgument"; series2.ValueDataMembers.AddRange("FS_QTY"); series2.CrosshairLabelPattern = "{V:#,#} Prs"; //format // lineSeriesView2.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView2.Color = Color.Gray; lineSeriesView2.LineStyle.Thickness = 2; series2.View = lineSeriesView2; Series series3 = new Series("Set Balance", ViewType.Line); series3.ChangeView(ViewType.Line); series3.DataSource = dataPoints; series3.ArgumentDataMember = "sArgument"; series3.ValueDataMembers.AddRange("SET_QTY"); series3.CrosshairLabelPattern = "{V:#,#} Prs"; //format // lineSeriesView3.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView3.LineStyle.Thickness = 2; series3.View = lineSeriesView3; Series series4 = new Series("Set Ratio", ViewType.Line); series4.ChangeView(ViewType.Line); series4.DataSource = dataPoints; series4.ArgumentDataMember = "sArgument"; series4.ValueDataMembers.AddRange("RATIO"); series4.CrosshairLabelPattern = "{V:#.0}%"; //pointSeriesLabel4.TextPattern = "{V:#.0}%"; series4.LabelsVisibility = DefaultBoolean.True; //format lineSeriesView4.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView4.LineStyle.Thickness = 4; lineSeriesView4.Color = Color.Orange; series4.View = lineSeriesView4; XYDiagram diagram = (XYDiagram)chartControl1.Diagram; diagram.AxisX.Label.ResolveOverlappingOptions.AllowRotate = false; diagram.AxisX.Label.ResolveOverlappingOptions.AllowStagger = false; diagram.AxisX.WholeRange.SideMarginsValue = 0; diagram.DependentAxesYRange = DefaultBoolean.True; diagram.AxisY.WholeRange.AlwaysShowZeroLevel = false; diagram.AxisY.Title.Text = "Qty (Prs)"; diagram.AxisY.Title.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); diagram.AxisY.Title.TextColor = Color.Blue; diagram.AxisY.Title.Visibility = DefaultBoolean.True; diagram.AxisY.Color = Color.DodgerBlue; diagram.AxisY.Label.TextPattern = "{V:#,#}"; diagram.AxisY.Label.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); diagram.AxisY.Interlaced = true; chartControl1.Series.Clear(); chartControl1.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series, series2, series3, series4 }; //ADD SECONDARY AXISY SecondaryAxisY myAxisY = new SecondaryAxisY("my X-Axis"); ((XYDiagram)chartControl1.Diagram).SecondaryAxesY.Clear(); ((XYDiagram)chartControl1.Diagram).SecondaryAxesY.Add(myAxisY); ((LineSeriesView)series4.View).AxisY = myAxisY; myAxisY.WholeRange.SideMarginsValue = 0; myAxisY.WholeRange.MinValue = 0; myAxisY.WholeRange.MaxValue = 100; myAxisY.Title.Text = "Set Ratio (%)"; myAxisY.Title.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); myAxisY.Title.TextColor = Color.Orange; myAxisY.Title.Visibility = DefaultBoolean.True; myAxisY.Label.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); myAxisY.Color = Color.Orange; //legend chartControl1.Legend.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.Center; chartControl1.Legend.AlignmentVertical = DevExpress.XtraCharts.LegendAlignmentVertical.TopOutside; chartControl1.Legend.Direction = DevExpress.XtraCharts.LegendDirection.LeftToRight; chartControl1.Legend.Name = "Default Legend"; chartControl1.Legend.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); chartControl1.Legend.Visibility = DefaultBoolean.True; if (dt != null && dt.Rows.Count <= ViewportPointCount) { for (int i = 0; i < dt.Rows.Count; i++) { string setTime1 = dt.Rows[i]["SET_TIME"].ToString(); int UP_QTY1 = Convert.ToInt32(dt.Rows[i]["UP_QTY"]); int FS_QTY1 = Convert.ToInt32(dt.Rows[i]["FS_QTY"]); int SET_QTY1 = Convert.ToInt32(dt.Rows[i]["SET_QTY"]); double RATIO1 = Convert.ToDouble(dt.Rows[i]["SET_RATIO"]); dataPoints.Add(new DataRealPoint(setTime1, UP_QTY1, FS_QTY1, SET_QTY1, RATIO1)); } isLoop = true; tmrDelay.Start(); } else { isLoop = false; timer1.Start(); } this.Cursor = Cursors.Default; } catch { this.Cursor = Cursors.Default; } }
private void CreateChart(DevExpress.XtraCharts.ChartControl Chart, DataTable dt, string col) { try { Chart.Series.Clear(); Chart.Titles.Clear(); string name = ""; switch (col) { case "UPC": name = "Cutting"; break; case "UPS1": name = "Stitching 1"; break; case "UPS2": name = "Stitching 2"; break; case "FSS": name = "Stockfit"; break; case "FGA": name = "Assembly"; break; } Chart.AppearanceNameSerializable = "Chameleon"; //chartBTS.AppearanceNameSerializable = "Chameleon"; Series series1 = new Series(name, ViewType.Bar); Chart.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.RectangleGradientFillOptions rectangleGradientFillOptions1 = new DevExpress.XtraCharts.RectangleGradientFillOptions(); Series series2 = new Series("Target", ViewType.Line); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; //sideBySideBarSeriesView1.ColorEach = true; sideBySideBarSeriesView1.FillStyle.FillMode = DevExpress.XtraCharts.FillMode.Solid; //switch (col) //{ //case "UPC": // sideBySideBarSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(112)))), ((int)(((byte)(192))))); // break; //case "UPS1": // sideBySideBarSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(49)))), ((int)(((byte)(133)))), ((int)(((byte)(155))))); // break; //case "UPS2": // sideBySideBarSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(240))))); // break; //case "FSS": // sideBySideBarSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(150)))), ((int)(((byte)(70))))); // break; //case "FGA": // sideBySideBarSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); // break; //} sideBySideBarSeriesView1.Color = System.Drawing.Color.ForestGreen; series1.View = sideBySideBarSeriesView1; series1.Label.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series1.Label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); series1.View = sideBySideBarSeriesView1; series1.Label.TextPattern = "{V:#,#}"; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; //series2.Label.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; //series2.Label.TextPattern = "{V:#,#}"; lineSeriesView1.Color = System.Drawing.Color.LimeGreen; lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); lineSeriesView1.LineStyle.Thickness = 3; series2.View = lineSeriesView1; string [] value = null; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { value = dt.Rows[i][col].ToString().Split('/'); series1.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), value[0])); if (Convert.ToDouble(value[1]) > 0) { series2.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), value[1])); } else { series2.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString())); } if (Convert.ToDouble(value[0]) < Convert.ToDouble(value[1])) { series1.Points[i].Color = Color.Red; } else { //switch (col) //{ // case "UPC": // series1.Points[i].Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(112)))), ((int)(((byte)(192))))); // break; // case "UPS1": // series1.Points[i].Color = System.Drawing.Color.FromArgb(((int)(((byte)(49)))), ((int)(((byte)(133)))), ((int)(((byte)(155))))); // break; // case "UPS2": // series1.Points[i].Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(240))))); // break; // case "FSS": // series1.Points[i].Color = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(150)))), ((int)(((byte)(70))))); // break; // case "FGA": // series1.Points[i].Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); // break; //} series1.Points[i].Color = System.Drawing.Color.ForestGreen; } } Chart.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2 }; Chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)Chart.Diagram).AxisX.Label.Font = new System.Drawing.Font("Calibri", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)Chart.Diagram).AxisX.Title.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)Chart.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; ((XYDiagram)Chart.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 14F); ((XYDiagram)Chart.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)Chart.Diagram).AxisY.Title.Text = "Production (Prs)"; } } catch (Exception EX) { } }
private void CreateModelChart() { //Reset Chart beforce biding Data Modelchart.Series.Clear(); Modelchart.Titles.Clear(); // Create an empty chart. (No need). Modelchart.AppearanceNameSerializable = "Slipstream"; //create New object DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesUnwindAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); DevExpress.XtraCharts.PowerEasingFunction powerEasingFunction1 = new DevExpress.XtraCharts.PowerEasingFunction(); DevExpress.XtraCharts.LineSeriesView lineSeriesView2 = new DevExpress.XtraCharts.LineSeriesView(); // Create the first side-by-side bar series and add points to it. Series series1 = new Series("Inv", ViewType.Bar); Series series2 = new Series("CTN", ViewType.Bar); // Create the second side-by-side bar series and add points to it. DataTable dt = SEL_FG_INV_DAILY_INCOM_CHART(Line, Mline); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["YMD"].ToString(), dt.Rows[i]["CTN"])); series2.Points.Add(new SeriesPoint(dt.Rows[i]["YMD"].ToString(), dt.Rows[i]["PRS"])); } } series1.ArgumentScaleType = ScaleType.Qualitative; series2.ArgumentScaleType = ScaleType.Qualitative; //for (int i = 0; i <= 30; i++) //{ // series1.Points.Add(new SeriesPoint(i.ToString(), GetRandomNumber(10, 1000))); //} DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView2 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); (series1.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; (series2.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView2.ColorEach = false; sideBySideBarSeriesView1.Color = Color.SeaGreen; sideBySideBarSeriesView2.Color = Color.HotPink; series1.View = sideBySideBarSeriesView1; series2.View = sideBySideBarSeriesView2; //marker lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.Gold; lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView2.LineMarkerOptions.Color = System.Drawing.Color.Gold; lineSeriesView2.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; // Add the series to the chart. Modelchart.SeriesSerializable = new Series[] { series1 }; //Dailychart.Series.Add(series1); //Dailychart.Series.Add(series2); ((XYDiagram)Modelchart.Diagram).AxisX.Title.Text = "Date"; ((XYDiagram)Modelchart.Diagram).AxisY.Title.Text = "Qty (Prs)"; // Rotate the diagram (if necessary). ((XYDiagram)Modelchart.Diagram).Rotated = false; //ScaleBreak NUmber ((XYDiagram)Modelchart.Diagram).AxisX.NumericScaleOptions.AutoGrid = false; //Title ((XYDiagram)Modelchart.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)Modelchart.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; //legend Modelchart.Legend.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.RightOutside; Modelchart.Legend.Direction = DevExpress.XtraCharts.LegendDirection.LeftToRight; Modelchart.Legend.MarkerMode = DevExpress.XtraCharts.LegendMarkerMode.CheckBoxAndMarker; Modelchart.Legend.Name = "Default Legend"; Modelchart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)Dailychart.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; //Label series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series1.Label.TextPattern = "{V:#,#}"; (series1.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.TextPattern = "{V:#,#}"; (series2.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; ((XYDiagram)Modelchart.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; // Add a title to the chart (if necessary). ChartTitle chartTitle1 = new ChartTitle(); chartTitle1.Text = "Daily Incoming Status"; Modelchart.Titles.Add(chartTitle1); // Add the chart to the form. Modelchart.Dock = DockStyle.Fill; splitChart_Detail.Panel1.Controls.Add(Modelchart); }
private void CreateDailyChart() { //Reset Chart beforce biding Data Dailychart.Series.Clear(); Dailychart.Titles.Clear(); // Create an empty chart. (No need). Dailychart.AppearanceNameSerializable = "Slipstream"; //create New object DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesUnwindAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); DevExpress.XtraCharts.PowerEasingFunction powerEasingFunction1 = new DevExpress.XtraCharts.PowerEasingFunction(); // Create the first side-by-side bar series and add points to it. Series series1 = new Series("Inv", ViewType.Bar); // Create the second side-by-side bar series and add points to it. Series series2 = new Series("Amount", ViewType.Line); DataTable dt = SEL_FG_INV_MONTHLY_CHART(Line, Mline); try { string YM = null; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { YM = dt.Rows[i]["YM"].ToString(); series1.Points.Add(new SeriesPoint(YM, dt.Rows[i]["INV"])); series2.Points.Add(new SeriesPoint(YM, dt.Rows[i]["AMT"])); } } series1.ArgumentScaleType = ScaleType.Qualitative; series2.ArgumentScaleType = ScaleType.Qualitative; //for (int i = 0; i <= 30; i++) //{ // series1.Points.Add(new SeriesPoint(i.ToString(), GetRandomNumber(10, 1000))); // series2.Points.Add(new SeriesPoint(i.ToString(), GetRandomNumber(1000, 10000))); //} //marker lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.Gold; lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; series2.View = lineSeriesView1; // Add the series to the chart. Dailychart.SeriesSerializable = new Series[] { series1, series2 }; //Dailychart.Series.Add(series1); //Dailychart.Series.Add(series2); // Create two secondary axes, and add them to the chart's Diagram. SecondaryAxisY myAxisY = new SecondaryAxisY("my Y-Axis"); ((XYDiagram)Dailychart.Diagram).SecondaryAxesY.Clear(); ((XYDiagram)Dailychart.Diagram).SecondaryAxesY.Add(myAxisY); myAxisY.Label.TextPattern = "{V:#,#}"; myAxisY.Title.TextColor = System.Drawing.Color.OrangeRed; myAxisY.Title.Font = new Font("Calibri", 16, FontStyle.Italic); myAxisY.Title.Text = "Money"; myAxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; // myAxisY.Label.Font = new System.Drawing.Font("Calibri", 12F); ((LineSeriesView)series2.View).AxisY = myAxisY; // Hide the legend (if necessary). Dailychart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; // Rotate the diagram (if necessary). ((XYDiagram)Dailychart.Diagram).Rotated = false; //ScaleBreak NUmber ((XYDiagram)Dailychart.Diagram).AxisX.NumericScaleOptions.AutoGrid = false; //Title ((XYDiagram)Dailychart.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)Dailychart.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)Dailychart.Diagram).AxisX.Title.Text = "Monthly"; ((XYDiagram)Dailychart.Diagram).AxisY.Title.Text = "Inventory (Prs)"; //Animation Series lineSeriesView1.Color = System.Drawing.Color.DeepPink; xySeriesUnwindAnimation1.EasingFunction = powerEasingFunction1; lineSeriesView1.SeriesAnimation = xySeriesUnwindAnimation1; ((XYDiagram)Dailychart.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; //Label series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series1.Label.TextPattern = "{V:#,#}"; (series1.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Center; series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.TextPattern = "{V:#,#}"; // Add a title to the chart (if necessary). Dailychart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; ChartTitle chartTitle1 = new ChartTitle(); chartTitle1.Text = "Inventory"; Dailychart.Titles.Add(chartTitle1); // Add the chart to the form. Dailychart.Dock = DockStyle.Fill; splMainV.Panel1.Controls.Add(Dailychart); } catch { } }
/// <summary> /// 设计器支持所需的方法 - 不要修改 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAuto)); DevExpress.XtraCharts.XYDiagram xyDiagram1 = new DevExpress.XtraCharts.XYDiagram(); DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series(); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); this.btn_Reset = new System.Windows.Forms.Button(); this.btn_Start = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); this.chartControl1 = new DevExpress.XtraCharts.ChartControl(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.chartControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(xyDiagram1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(series1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(lineSeriesView1)).BeginInit(); this.SuspendLayout(); // // tableLayoutPanel1 // this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Outset; this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 225F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0); this.tableLayoutPanel1.Controls.Add(this.chartControl1, 1, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1110, 640); this.tableLayoutPanel1.TabIndex = 8; // // tableLayoutPanel2 // this.tableLayoutPanel2.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; this.tableLayoutPanel2.ColumnCount = 1; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.Controls.Add(this.panel1, 0, 0); this.tableLayoutPanel2.Controls.Add(this.panel2, 0, 1); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel2.Location = new System.Drawing.Point(5, 5); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 2; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.Size = new System.Drawing.Size(219, 630); this.tableLayoutPanel2.TabIndex = 0; // // panel1 // this.panel1.Controls.Add(this.btn_Reset); this.panel1.Controls.Add(this.btn_Start); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(4, 4); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(211, 94); this.panel1.TabIndex = 0; // // btn_Reset // this.btn_Reset.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btn_Reset.BackgroundImage"))); this.btn_Reset.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btn_Reset.Location = new System.Drawing.Point(121, 18); this.btn_Reset.Name = "btn_Reset"; this.btn_Reset.Size = new System.Drawing.Size(58, 60); this.btn_Reset.TabIndex = 1; this.btn_Reset.Text = "复位"; this.btn_Reset.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.btn_Reset.UseVisualStyleBackColor = true; // // btn_Start // this.btn_Start.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btn_Start.BackgroundImage"))); this.btn_Start.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.btn_Start.Location = new System.Drawing.Point(28, 18); this.btn_Start.Name = "btn_Start"; this.btn_Start.Size = new System.Drawing.Size(58, 60); this.btn_Start.TabIndex = 0; this.btn_Start.Text = "开始"; this.btn_Start.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.btn_Start.UseVisualStyleBackColor = true; this.btn_Start.Click += new System.EventHandler(this.btn_Start_Click); // // panel2 // this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.Location = new System.Drawing.Point(4, 105); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(211, 521); this.panel2.TabIndex = 1; // // chartControl1 // xyDiagram1.AxisX.GridLines.MinorVisible = true; xyDiagram1.AxisX.GridLines.Visible = true; xyDiagram1.AxisX.Title.Text = "角度/度"; xyDiagram1.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; xyDiagram1.AxisX.VisibleInPanesSerializable = "-1"; xyDiagram1.AxisY.Title.Text = "阻值/KΩ"; xyDiagram1.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; xyDiagram1.AxisY.VisibleInPanesSerializable = "-1"; this.chartControl1.Diagram = xyDiagram1; this.chartControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.chartControl1.Legend.Name = "Default Legend"; this.chartControl1.Legend.TextVisible = false; this.chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; this.chartControl1.Location = new System.Drawing.Point(232, 5); this.chartControl1.Name = "chartControl1"; series1.Name = "Series 1"; series1.View = lineSeriesView1; this.chartControl1.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1 }; this.chartControl1.Size = new System.Drawing.Size(873, 630); this.chartControl1.TabIndex = 1; // // FormAuto // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.tableLayoutPanel1); this.Margin = new System.Windows.Forms.Padding(2); this.Name = "FormAuto"; this.Size = new System.Drawing.Size(1110, 640); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); this.panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(xyDiagram1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(lineSeriesView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(series1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.chartControl1)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// 添加曲线阈值线 /// </summary> public static List <Series> AddZSeries(DataTable data_line, List <float> Points, DevExpress.XtraCharts.XYDiagramPane tempxyDiagram, DevExpress.XtraCharts.SecondaryAxisY tempsecondaryAxisY) { List <Series> Rvalue = new List <Series>(); for (int i = 0; i < Points.Count; i++) { if (Points[i] > 0) { DevExpress.XtraCharts.LineSeriesView lineSeriesViewZ1 = new DevExpress.XtraCharts.LineSeriesView(); lineSeriesViewZ1.LineStyle.DashStyle = DashStyle.Dot; lineSeriesViewZ1.LineMarkerOptions.Size = 1; Series SeriesZ1 = new Series(); if (tempxyDiagram != null) { lineSeriesViewZ1.Pane = tempxyDiagram; } if (tempsecondaryAxisY != null) { lineSeriesViewZ1.AxisY = tempsecondaryAxisY; } SeriesZ1.View = lineSeriesViewZ1; switch (i) { case 0: SeriesZ1.Name = "预警阈值"; //lineSeriesViewZ1.Color = Color.DarkOrange; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_WarnColor"); //通过配置设置阈值 20171218 break; case 1: SeriesZ1.Name = "报警阈值"; //lineSeriesViewZ1.Color = Color.Red; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_AlarmColor"); //通过配置设置阈值 20171218 break; case 2: SeriesZ1.Name = "断电阈值"; //lineSeriesViewZ1.Color = Color.DarkRed; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_PowerOffColor"); //通过配置设置阈值 20171218 break; case 3: SeriesZ1.Name = "复电阈值"; //lineSeriesViewZ1.Color = Color.Green; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_PowerOnColor"); //通过配置设置阈值 20171218 break; case 4: SeriesZ1.Name = "下限预警阈值"; //lineSeriesViewZ1.Color = Color.DarkOrange; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_WarnColor"); //通过配置设置阈值 20171218 break; case 5: SeriesZ1.Name = "下限报警阈值"; //lineSeriesViewZ1.Color = Color.Red; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_AlarmColor"); //通过配置设置阈值 20171218 break; case 6: SeriesZ1.Name = "下限断电阈值"; //lineSeriesViewZ1.Color = Color.DarkRed; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_PowerOffColor"); //通过配置设置阈值 20171218 break; case 7: SeriesZ1.Name = "下限复电阈值"; //lineSeriesViewZ1.Color = Color.Green; InterfaceClass.QueryPubClass_.SetChartColor(SeriesZ1, "Chart_PowerOnColor"); //通过配置设置阈值 20171218 break; } if (SeriesZ1 != null) { SeriesZ1.Points.BeginUpdate(); SeriesZ1.Points.Clear(); for (int j = 0; j < data_line.Rows.Count; j++) { //重新定义数据 SeriesZ1.Points.Add(new SeriesPoint(DateTime.Parse(data_line.Rows[j]["Timer"].ToString()), (double)Points[i])); } SeriesZ1.Points.EndUpdate(); Rvalue.Add(SeriesZ1); } } } return(Rvalue); }
private void btOK_Click(object sender, EventArgs e) { DevExpress.XtraCharts.LineSeriesView lineSeriesView = new DevExpress.XtraCharts.LineSeriesView(); DateTime BeginDate = DtBegin.DateTime.Date + teBegin.Time.TimeOfDay; DateTime EndDate = deEnd.DateTime.Date + teEnd.Time.TimeOfDay; if (BeginDate > EndDate) { DevExpress.XtraEditors.XtraMessageBox.Show(Model_Data.Language.Desc.SelStartTime, Model_Data.Language.Desc.Warning_ChildUserTab);//modified by zq return; } DeviceModel dm = DeviceObj.GetDeviceModel(); if (dm == null) { return; } string Value = "sid" + (dm.Analog.Find(delegate(AnalogModel ab) { return(ab.SignalName == cbSignalName.Text); })).SignalId.ToString(); try { DataTable DT = ACCESSDBDAL.AccessServer.GetHistoricData(BeginDate, EndDate, dm.TableName); if (DT == null || DT.Rows.Count < 1) { //DevExpress.XtraEditors.XtraMessageBox.Show("该时间段内不存在数据记录!", "提示"); DevExpress.XtraEditors.XtraMessageBox.Show(Model_Data.Language.Desc.TimeNotData, Model_Data.Language.Desc.Prompting_ChildUserTab);//modified by zq return; } BeginDate = Convert.ToDateTime(DT.Rows[0]["dtime"].ToString()); EndDate = Convert.ToDateTime(DT.Rows[DT.Rows.Count - 1]["dtime"].ToString()); TimeSpan TimeSpan = EndDate - BeginDate; //开始调配 曲线资源 //清理以前的数据 hSeries.DataSource = null; //1.为 序列绑定信号值名称 hSeries.Name = cbSignalName.Text; //2.X轴的数据字段 hSeries.ArgumentDataMember = "dtime"; //3.Y轴的数据字段 hSeries.ValueDataMembers[0] = Value; //4.标签可视化设置 //hSeries.LabelsVisibility = DevExpress.Utils.DefaultBoolean.Default; //5.参数刻度类型 hSeries.ArgumentScaleType = ScaleType.DateTime; AxisBase axis = Diagram.AxisX; AxisBase ayis = Diagram.AxisY; axis.DateTimeOptions.Format = DateTimeFormat.Custom; //根据 实际数据的时间跨度 来设定 X轴的时间跨度 DateTimeAlignment(TimeSpan, axis); //X轴刻度 范围 axis.GridLines.Visible = true; axis.Range.SideMarginsEnabled = false;//设定X轴从0开始 axis.GridSpacingAuto = false; //Y轴的相关设定 ayis.Range.Auto = true; ayis.GridSpacingAuto = true; //ayis.Range.AlwaysShowZeroLevel = false; //绑定数据 try { hSeries.DataSource = DT; } catch (Exception) { MessageBox.Show("Faild to DataBinding!"); } //设置 Y轴 可自行收缩 Diagram.EnableAxisYScrolling = true; Diagram.EnableAxisYZooming = true; } catch (Exception str) { //DevExpress.XtraEditors.XtraMessageBox.Show("获取数据失败!原因如下:/r/n" + str, "错误"); DevExpress.XtraEditors.XtraMessageBox.Show(Model_Data.Language.Desc.ObtainFailure + "/r/n" + str, Model_Data.Language.Desc.Fault_ChildUserTab);//modified by zq } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); DevExpress.XtraCharts.XYDiagram xyDiagram1 = new DevExpress.XtraCharts.XYDiagram(); Series series1 = new DevExpress.XtraCharts.Series(); LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); Series series2 = new DevExpress.XtraCharts.Series(); DevExpress.XtraCharts.PointSeriesView pointSeriesView1 = new DevExpress.XtraCharts.PointSeriesView(); Series series3 = new DevExpress.XtraCharts.Series(); DevExpress.XtraCharts.PointSeriesView pointSeriesView2 = new DevExpress.XtraCharts.PointSeriesView(); this.lj_lab = new DevComponents.DotNetBar.LabelX(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.panel3d = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.txtkw = new System.Windows.Forms.TextBox(); this.textcl = new System.Windows.Forms.TextBox(); this.combjg = new System.Windows.Forms.ComboBox(); this.button1 = new System.Windows.Forms.Button(); this.labelX4 = new DevComponents.DotNetBar.LabelX(); this.labelX3 = new DevComponents.DotNetBar.LabelX(); this.labelX2 = new DevComponents.DotNetBar.LabelX(); this.labelX1 = new DevComponents.DotNetBar.LabelX(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.dgv1 = new System.Windows.Forms.DataGridView(); this.nearNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.LJH = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.xuhao = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.TestTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.step1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.step2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.step3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.step4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.step5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.OkOrNg = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.buttonX2 = new DevComponents.DotNetBar.ButtonX(); this.buttonX1 = new DevComponents.DotNetBar.ButtonX(); this.buttonX4 = new DevComponents.DotNetBar.ButtonX(); this.buttonX3 = new DevComponents.DotNetBar.ButtonX(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.toptime = new System.Windows.Forms.Timer(this.components); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); this.lab_step_data = new System.Windows.Forms.Label(); this.lab_st = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.lab_canselect = new System.Windows.Forms.Label(); this.cbb_canselect = new System.Windows.Forms.ComboBox(); this.lab_defportname = new System.Windows.Forms.Label(); this.lab_defport = new System.Windows.Forms.Label(); this.lble = new System.Windows.Forms.Label(); this.panel3 = new System.Windows.Forms.Panel(); this.txtbox_gcxia = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.txtgc = new System.Windows.Forms.TextBox(); this.txtll = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.panel4 = new System.Windows.Forms.Panel(); this.panel5 = new System.Windows.Forms.Panel(); this.label5 = new System.Windows.Forms.Label(); this.lab_cc = new System.Windows.Forms.Label(); this.chartControl1 = new DevExpress.XtraCharts.ChartControl(); this.timer_portst = new System.Windows.Forms.Timer(this.components); this.timer_tostep = new System.Windows.Forms.Timer(this.components); this.timer_shine = new System.Windows.Forms.Timer(this.components); this.timer_ref = new System.Windows.Forms.Timer(this.components); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgv1)).BeginInit(); this.groupBox1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); this.panel3.SuspendLayout(); this.panel4.SuspendLayout(); this.panel5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.chartControl1)).BeginInit(); this.SuspendLayout(); // // lj_lab // this.lj_lab.BackColor = System.Drawing.Color.Transparent; // // // this.lj_lab.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.lj_lab.ForeColor = System.Drawing.Color.Black; this.lj_lab.Location = new System.Drawing.Point(28, 86); this.lj_lab.Name = "lj_lab"; this.lj_lab.Size = new System.Drawing.Size(37, 23); this.lj_lab.TabIndex = 0; this.lj_lab.Text = "零件:"; // // comboBox1 // this.comboBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.ForeColor = System.Drawing.Color.Black; this.comboBox1.FormattingEnabled = true; this.comboBox1.Location = new System.Drawing.Point(28, 115); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(121, 21); this.comboBox1.TabIndex = 1; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // panel3d // this.panel3d.Dock = System.Windows.Forms.DockStyle.Fill; this.panel3d.ForeColor = System.Drawing.Color.Black; this.panel3d.Location = new System.Drawing.Point(340, 3); this.panel3d.Name = "panel3d"; this.panel3d.Size = new System.Drawing.Size(339, 221); this.panel3d.TabIndex = 2; this.panel3d.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3d_Paint); this.panel3d.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel3d_MouseDown); this.panel3d.MouseEnter += new System.EventHandler(this.panel3d_MouseEnter); this.panel3d.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel3d_MouseUp); // // panel2 // this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.Controls.Add(this.txtkw); this.panel2.Controls.Add(this.textcl); this.panel2.Controls.Add(this.combjg); this.panel2.Controls.Add(this.button1); this.panel2.Controls.Add(this.labelX4); this.panel2.Controls.Add(this.labelX3); this.panel2.Controls.Add(this.labelX2); this.panel2.Controls.Add(this.labelX1); this.panel2.Controls.Add(this.pictureBox1); this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.ForeColor = System.Drawing.Color.Black; this.panel2.Location = new System.Drawing.Point(685, 3); this.panel2.Name = "panel2"; this.tableLayoutPanel1.SetRowSpan(this.panel2, 2); this.panel2.Size = new System.Drawing.Size(438, 261); this.panel2.TabIndex = 3; this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); // // txtkw // this.txtkw.BackColor = System.Drawing.Color.White; this.txtkw.ForeColor = System.Drawing.Color.Black; this.txtkw.Location = new System.Drawing.Point(163, 223); this.txtkw.Name = "txtkw"; this.txtkw.Size = new System.Drawing.Size(58, 22); this.txtkw.TabIndex = 8; this.txtkw.TextChanged += new System.EventHandler(this.txtkw_TextChanged); // // textcl // this.textcl.BackColor = System.Drawing.Color.White; this.textcl.ForeColor = System.Drawing.Color.Black; this.textcl.Location = new System.Drawing.Point(302, 225); this.textcl.Name = "textcl"; this.textcl.Size = new System.Drawing.Size(100, 22); this.textcl.TabIndex = 7; this.textcl.TextChanged += new System.EventHandler(this.textcl_TextChanged); // // combjg // this.combjg.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.combjg.ForeColor = System.Drawing.Color.Black; this.combjg.FormattingEnabled = true; this.combjg.Location = new System.Drawing.Point(88, 192); this.combjg.Name = "combjg"; this.combjg.Size = new System.Drawing.Size(121, 21); this.combjg.TabIndex = 6; this.combjg.Visible = false; this.combjg.SelectedIndexChanged += new System.EventHandler(this.combjg_SelectedIndexChanged); // // button1 // this.button1.ForeColor = System.Drawing.Color.Black; this.button1.Location = new System.Drawing.Point(327, 190); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 5; this.button1.Text = "退出"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // labelX4 // // // // this.labelX4.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.labelX4.ForeColor = System.Drawing.Color.Black; this.labelX4.Location = new System.Drawing.Point(103, 200); this.labelX4.Name = "labelX4"; this.labelX4.Size = new System.Drawing.Size(70, 23); this.labelX4.TabIndex = 4; this.labelX4.Text = "结果:"; this.labelX4.Visible = false; // // labelX3 // // // // this.labelX3.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.labelX3.ForeColor = System.Drawing.Color.Black; this.labelX3.Location = new System.Drawing.Point(228, 191); this.labelX3.Name = "labelX3"; this.labelX3.Size = new System.Drawing.Size(103, 23); this.labelX3.TabIndex = 3; this.labelX3.Text = "工具: 卡尺"; // // labelX2 // // // // this.labelX2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.labelX2.ForeColor = System.Drawing.Color.Black; this.labelX2.Location = new System.Drawing.Point(237, 223); this.labelX2.Name = "labelX2"; this.labelX2.Size = new System.Drawing.Size(70, 23); this.labelX2.TabIndex = 2; this.labelX2.Text = "测量值为: "; // // labelX1 // // // // this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.labelX1.ForeColor = System.Drawing.Color.Black; this.labelX1.Location = new System.Drawing.Point(107, 223); this.labelX1.Name = "labelX1"; this.labelX1.Size = new System.Drawing.Size(60, 23); this.labelX1.TabIndex = 1; this.labelX1.Text = "所在工位: "; // // pictureBox1 // this.pictureBox1.ForeColor = System.Drawing.Color.Black; this.pictureBox1.Image = global::NepslidingTools.Properties.Resources._4318727ea8c1806a17c555929d2dea8e; this.pictureBox1.Location = new System.Drawing.Point(3, 0); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(435, 186); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // dgv1 // this.dgv1.AllowUserToAddRows = false; this.dgv1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgv1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.nearNo, this.LJH, this.xuhao, this.TestTime, this.step1, this.step2, this.step3, this.step4, this.step5, this.OkOrNg }); this.tableLayoutPanel1.SetColumnSpan(this.dgv1, 3); this.dgv1.Dock = System.Windows.Forms.DockStyle.Fill; this.dgv1.Location = new System.Drawing.Point(3, 419); this.dgv1.Name = "dgv1"; this.dgv1.ReadOnly = true; this.dgv1.RowTemplate.Height = 23; this.dgv1.Size = new System.Drawing.Size(1120, 320); this.dgv1.TabIndex = 4; this.dgv1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgv1_CellEndEdit); // // nearNo // this.nearNo.DataPropertyName = "measureb"; this.nearNo.HeaderText = "测量编号"; this.nearNo.Name = "nearNo"; this.nearNo.ReadOnly = true; this.nearNo.Visible = false; // // LJH // this.LJH.DataPropertyName = "PN"; this.LJH.HeaderText = "零件号"; this.LJH.Name = "LJH"; this.LJH.ReadOnly = true; this.LJH.Visible = false; // // xuhao // this.xuhao.DataPropertyName = "id"; this.xuhao.HeaderText = "序号"; this.xuhao.Name = "xuhao"; this.xuhao.ReadOnly = true; this.xuhao.Visible = false; // // TestTime // this.TestTime.DataPropertyName = "time"; this.TestTime.HeaderText = "测试时间"; this.TestTime.Name = "TestTime"; this.TestTime.ReadOnly = true; this.TestTime.Visible = false; // // step1 // this.step1.DataPropertyName = "step1"; this.step1.HeaderText = "步骤1"; this.step1.Name = "step1"; this.step1.ReadOnly = true; this.step1.Visible = false; // // step2 // this.step2.DataPropertyName = "step2"; this.step2.HeaderText = "步骤2"; this.step2.Name = "step2"; this.step2.ReadOnly = true; this.step2.Visible = false; // // step3 // this.step3.DataPropertyName = "step3"; this.step3.HeaderText = "步骤3"; this.step3.Name = "step3"; this.step3.ReadOnly = true; this.step3.Visible = false; // // step4 // this.step4.DataPropertyName = "step4"; this.step4.HeaderText = "步骤4"; this.step4.Name = "step4"; this.step4.ReadOnly = true; this.step4.Visible = false; // // step5 // this.step5.DataPropertyName = "step5"; this.step5.HeaderText = "步骤5"; this.step5.Name = "step5"; this.step5.ReadOnly = true; this.step5.Visible = false; // // OkOrNg // this.OkOrNg.DataPropertyName = "OKorNG"; this.OkOrNg.HeaderText = "OkOrNg"; this.OkOrNg.Name = "OkOrNg"; this.OkOrNg.ReadOnly = true; this.OkOrNg.Visible = false; // // groupBox1 // this.groupBox1.Controls.Add(this.buttonX2); this.groupBox1.Controls.Add(this.buttonX1); this.groupBox1.Controls.Add(this.buttonX4); this.groupBox1.Controls.Add(this.buttonX3); this.groupBox1.ForeColor = System.Drawing.Color.Black; this.groupBox1.Location = new System.Drawing.Point(28, 146); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(194, 122); this.groupBox1.TabIndex = 5; this.groupBox1.TabStop = false; this.groupBox1.Text = "操作"; this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter); // // buttonX2 // this.buttonX2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.buttonX2.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.buttonX2.Location = new System.Drawing.Point(102, 70); this.buttonX2.Name = "buttonX2"; this.buttonX2.Size = new System.Drawing.Size(75, 23); this.buttonX2.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.buttonX2.TabIndex = 5; this.buttonX2.Text = "取消"; this.buttonX2.Click += new System.EventHandler(this.buttonX2_Click); // // buttonX1 // this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.buttonX1.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.buttonX1.Location = new System.Drawing.Point(102, 33); this.buttonX1.Name = "buttonX1"; this.buttonX1.Size = new System.Drawing.Size(75, 23); this.buttonX1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.buttonX1.TabIndex = 4; this.buttonX1.Text = "完成"; this.buttonX1.Click += new System.EventHandler(this.buttonX1_Click); // // buttonX4 // this.buttonX4.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.buttonX4.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.buttonX4.Location = new System.Drawing.Point(10, 68); this.buttonX4.Name = "buttonX4"; this.buttonX4.Size = new System.Drawing.Size(75, 23); this.buttonX4.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.buttonX4.TabIndex = 3; this.buttonX4.Text = "重测"; this.buttonX4.Click += new System.EventHandler(this.buttonX4_Click); // // buttonX3 // this.buttonX3.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.buttonX3.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.buttonX3.Location = new System.Drawing.Point(10, 33); this.buttonX3.Name = "buttonX3"; this.buttonX3.Size = new System.Drawing.Size(75, 23); this.buttonX3.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.buttonX3.TabIndex = 2; this.buttonX3.Text = "跳过"; this.buttonX3.Click += new System.EventHandler(this.buttonX3_Click); // // timer1 // this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // toptime // this.toptime.Tick += new System.EventHandler(this.toptime_Tick); // // tableLayoutPanel1 // this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent; this.tableLayoutPanel1.ColumnCount = 3; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 29.9787F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30.70642F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 39.31488F)); this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.panel2, 2, 0); this.tableLayoutPanel1.Controls.Add(this.dgv1, 0, 3); this.tableLayoutPanel1.Controls.Add(this.panel3d, 1, 0); this.tableLayoutPanel1.Controls.Add(this.panel3, 1, 1); this.tableLayoutPanel1.Controls.Add(this.panel4, 0, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.ForeColor = System.Drawing.Color.Black; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(12); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 3; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 32.40405F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 21.2333F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 46.36264F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1126, 742); this.tableLayoutPanel1.TabIndex = 6; this.tableLayoutPanel1.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter); // // panel1 // this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.Controls.Add(this.lab_step_data); this.panel1.Controls.Add(this.lab_st); this.panel1.Controls.Add(this.label4); this.panel1.Controls.Add(this.lab_canselect); this.panel1.Controls.Add(this.cbb_canselect); this.panel1.Controls.Add(this.lab_defportname); this.panel1.Controls.Add(this.lab_defport); this.panel1.Controls.Add(this.lble); this.panel1.Controls.Add(this.lj_lab); this.panel1.Controls.Add(this.comboBox1); this.panel1.Controls.Add(this.groupBox1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.ForeColor = System.Drawing.Color.Black; this.panel1.Location = new System.Drawing.Point(3, 3); this.panel1.Name = "panel1"; this.tableLayoutPanel1.SetRowSpan(this.panel1, 2); this.panel1.Size = new System.Drawing.Size(331, 261); this.panel1.TabIndex = 7; // // lab_step_data // this.lab_step_data.AutoSize = true; this.lab_step_data.Location = new System.Drawing.Point(267, 13); this.lab_step_data.Name = "lab_step_data"; this.lab_step_data.Size = new System.Drawing.Size(38, 13); this.lab_step_data.TabIndex = 13; this.lab_step_data.Text = "label6"; // // lab_st // this.lab_st.AutoSize = true; this.lab_st.BackColor = System.Drawing.Color.DarkTurquoise; this.lab_st.ForeColor = System.Drawing.Color.OrangeRed; this.lab_st.Location = new System.Drawing.Point(122, 34); this.lab_st.Name = "lab_st"; this.lab_st.Size = new System.Drawing.Size(43, 13); this.lab_st.TabIndex = 12; this.lab_st.Text = "未连接"; // // label4 // this.label4.AutoSize = true; this.label4.ForeColor = System.Drawing.Color.ForestGreen; this.label4.Location = new System.Drawing.Point(27, 34); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(55, 13); this.label4.TabIndex = 11; this.label4.Text = "工具状态"; // // lab_canselect // this.lab_canselect.AutoSize = true; this.lab_canselect.ForeColor = System.Drawing.Color.ForestGreen; this.lab_canselect.Location = new System.Drawing.Point(27, 56); this.lab_canselect.Name = "lab_canselect"; this.lab_canselect.Size = new System.Drawing.Size(55, 13); this.lab_canselect.TabIndex = 10; this.lab_canselect.Text = "可选工具"; this.lab_canselect.Visible = false; // // cbb_canselect // this.cbb_canselect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbb_canselect.FormattingEnabled = true; this.cbb_canselect.Location = new System.Drawing.Point(120, 53); this.cbb_canselect.Name = "cbb_canselect"; this.cbb_canselect.Size = new System.Drawing.Size(121, 21); this.cbb_canselect.TabIndex = 9; this.cbb_canselect.Visible = false; this.cbb_canselect.SelectedIndexChanged += new System.EventHandler(this.cbb_canselect_SelectedIndexChanged); // // lab_defportname // this.lab_defportname.AutoSize = true; this.lab_defportname.BackColor = System.Drawing.Color.DarkTurquoise; this.lab_defportname.ForeColor = System.Drawing.Color.OrangeRed; this.lab_defportname.Location = new System.Drawing.Point(122, 13); this.lab_defportname.Name = "lab_defportname"; this.lab_defportname.Size = new System.Drawing.Size(57, 13); this.lab_defportname.TabIndex = 8; this.lab_defportname.Text = "portname"; // // lab_defport // this.lab_defport.AutoSize = true; this.lab_defport.ForeColor = System.Drawing.Color.ForestGreen; this.lab_defport.Location = new System.Drawing.Point(27, 13); this.lab_defport.Name = "lab_defport"; this.lab_defport.Size = new System.Drawing.Size(79, 13); this.lab_defport.TabIndex = 7; this.lab_defport.Text = "默认使用工具"; // // lble // this.lble.AutoSize = true; this.lble.Location = new System.Drawing.Point(65, 91); this.lble.Name = "lble"; this.lble.Size = new System.Drawing.Size(0, 13); this.lble.TabIndex = 6; // // panel3 // this.panel3.Controls.Add(this.txtbox_gcxia); this.panel3.Controls.Add(this.label3); this.panel3.Controls.Add(this.txtgc); this.panel3.Controls.Add(this.txtll); this.panel3.Controls.Add(this.label2); this.panel3.Controls.Add(this.label1); this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; this.panel3.ForeColor = System.Drawing.Color.Black; this.panel3.Location = new System.Drawing.Point(340, 230); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(339, 34); this.panel3.TabIndex = 9; // // txtbox_gcxia // this.txtbox_gcxia.BackColor = System.Drawing.Color.White; this.txtbox_gcxia.ForeColor = System.Drawing.Color.Black; this.txtbox_gcxia.Location = new System.Drawing.Point(263, 6); this.txtbox_gcxia.Name = "txtbox_gcxia"; this.txtbox_gcxia.Size = new System.Drawing.Size(45, 22); this.txtbox_gcxia.TabIndex = 12; this.txtbox_gcxia.Text = "0.15"; // // label3 // this.label3.AutoSize = true; this.label3.ForeColor = System.Drawing.Color.Black; this.label3.Location = new System.Drawing.Point(208, 11); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(58, 13); this.label3.TabIndex = 11; this.label3.Text = "下公差: "; // // txtgc // this.txtgc.BackColor = System.Drawing.Color.White; this.txtgc.ForeColor = System.Drawing.Color.Black; this.txtgc.Location = new System.Drawing.Point(157, 6); this.txtgc.Name = "txtgc"; this.txtgc.Size = new System.Drawing.Size(45, 22); this.txtgc.TabIndex = 10; this.txtgc.Text = "0.15"; // // txtll // this.txtll.BackColor = System.Drawing.Color.White; this.txtll.ForeColor = System.Drawing.Color.Black; this.txtll.Location = new System.Drawing.Point(57, 7); this.txtll.Name = "txtll"; this.txtll.Size = new System.Drawing.Size(39, 22); this.txtll.TabIndex = 9; this.txtll.Text = "13.15"; // // label2 // this.label2.AutoSize = true; this.label2.ForeColor = System.Drawing.Color.Black; this.label2.Location = new System.Drawing.Point(102, 11); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(58, 13); this.label2.TabIndex = 1; this.label2.Text = "上公差: "; // // label1 // this.label1.AutoSize = true; this.label1.ForeColor = System.Drawing.Color.Black; this.label1.Location = new System.Drawing.Point(3, 10); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(58, 13); this.label1.TabIndex = 0; this.label1.Text = "理论值: "; // // panel4 // this.tableLayoutPanel1.SetColumnSpan(this.panel4, 3); this.panel4.Controls.Add(this.panel5); this.panel4.Controls.Add(this.chartControl1); this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; this.panel4.Location = new System.Drawing.Point(3, 270); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(1120, 143); this.panel4.TabIndex = 10; // // panel5 // this.panel5.BackColor = System.Drawing.Color.White; this.panel5.Controls.Add(this.label5); this.panel5.Controls.Add(this.lab_cc); this.panel5.Location = new System.Drawing.Point(950, 0); this.panel5.Name = "panel5"; this.panel5.Size = new System.Drawing.Size(167, 143); this.panel5.TabIndex = 9; // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("微软雅黑", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label5.Location = new System.Drawing.Point(4, 5); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(170, 50); this.label5.TabIndex = 10; this.label5.Text = "结果判定"; // // lab_cc // this.lab_cc.AutoSize = true; this.lab_cc.Font = new System.Drawing.Font("微软雅黑", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lab_cc.Location = new System.Drawing.Point(0, 71); this.lab_cc.Name = "lab_cc"; this.lab_cc.Size = new System.Drawing.Size(0, 64); this.lab_cc.TabIndex = 0; // // chartControl1 // this.chartControl1.CrosshairEnabled = DevExpress.Utils.DefaultBoolean.False; xyDiagram1.AxisX.VisibleInPanesSerializable = "-1"; xyDiagram1.AxisY.VisibleInPanesSerializable = "-1"; this.chartControl1.Diagram = xyDiagram1; this.chartControl1.Dock = System.Windows.Forms.DockStyle.Left; this.chartControl1.Legend.TextVisible = false; this.chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; this.chartControl1.Location = new System.Drawing.Point(0, 0); this.chartControl1.Name = "chartControl1"; series1.Name = "测量结果波动"; lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; series1.View = lineSeriesView1; series2.Name = "超差"; series2.View = pointSeriesView1; series2.Visible = false; series3.Name = "负超差"; series3.View = pointSeriesView2; series3.Visible = false; this.chartControl1.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2, series3 }; this.chartControl1.Size = new System.Drawing.Size(950, 143); this.chartControl1.TabIndex = 8; // // timer_portst // this.timer_portst.Interval = 500; this.timer_portst.Tick += new System.EventHandler(this.timer_portst_Tick); // // timer_tostep // this.timer_tostep.Interval = 1000; this.timer_tostep.Tick += new System.EventHandler(this.timer_tostep_Tick); // // timer_shine // this.timer_shine.Tick += new System.EventHandler(this.timer_shine_Tick); // // timer_ref // this.timer_ref.Interval = 400; this.timer_ref.Tick += new System.EventHandler(this.timer_ref_Tick); // // StepTestFrom // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1126, 742); this.Controls.Add(this.tableLayoutPanel1); this.DoubleBuffered = true; this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "StepTestFrom"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "测量界面"; this.Deactivate += new System.EventHandler(this.StepTestFrom_Deactivate); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.StepTestFrom_FormClosed); this.Load += new System.EventHandler(this.StepTestFrom_Load); this.Scroll += new System.Windows.Forms.ScrollEventHandler(this.StepTestFrom_Scroll); this.MouseEnter += new System.EventHandler(this.StepTestFrom_MouseEnter); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgv1)).EndInit(); this.groupBox1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); this.panel4.ResumeLayout(false); this.panel5.ResumeLayout(false); this.panel5.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.chartControl1)).EndInit(); this.ResumeLayout(false); }
private void CreateChart() { try { //chartBTS.AppearanceNameSerializable = "Chameleon"; Series series1 = new Series("BTS", ViewType.Bar); chartBTS.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesLabel sideBySideBarSeriesLabel1 = new DevExpress.XtraCharts.SideBySideBarSeriesLabel(); Series series2 = new Series("Target", ViewType.Line); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Color = System.Drawing.Color.LimeGreen; sideBySideBarSeriesView1.FillStyle.FillMode = DevExpress.XtraCharts.FillMode.Solid; series1.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series1.Label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); series1.Label.TextPattern = "{V:#,#.0}" + "%"; series1.View = sideBySideBarSeriesView1; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series2.Label.TextPattern = "{V:#,#.0}" + "%"; lineSeriesView1.Color = System.Drawing.Color.LimeGreen; lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); lineSeriesView1.LineStyle.Thickness = 4; series2.View = lineSeriesView1; DataTable dt = SEL_SMT_BTS_YEAR("C", line, mline, opcd, UC_YEAR.GetValue().ToString()); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["BTS"])); series2.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["TARGET"])); if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) && Convert.ToDouble(dt.Rows[i]["BTS"]) >= Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Yellow; } else if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Red; } else { series1.Points[i].Color = System.Drawing.Color.LimeGreen; } } chartBTS.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2 }; ((XYDiagram)chartBTS.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisX.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); ((XYDiagram)chartBTS.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; ((XYDiagram)chartBTS.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 13F); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 22F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Text = "BTS (%)"; ((XYDiagram)chartBTS.Diagram).AxisY.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); } } catch (Exception EX) { } }
private void CreateByModelChart() { //Reset Chart beforce biding Data ChartByModel.Series.Clear(); ChartByModel.Titles.Clear(); // Create an empty chart. (No need). ChartByModel.AppearanceNameSerializable = "Slipstream"; //create New object DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesUnwindAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); DevExpress.XtraCharts.PowerEasingFunction powerEasingFunction1 = new DevExpress.XtraCharts.PowerEasingFunction(); DevExpress.XtraCharts.BarSlideAnimation barSlideAnimation1 = new DevExpress.XtraCharts.BarSlideAnimation(); DevExpress.XtraCharts.LineSeriesView lineSeriesView2 = new DevExpress.XtraCharts.LineSeriesView(); // Create the first side-by-side bar series and add points to it. Series series1 = new Series("Inv", ViewType.Bar); Series series2 = new Series("%", ViewType.Line); // Create the second side-by-side bar series and add points to it. DataTable dt = SEL_FG_BY_MODEL(Line, Mline); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["MODEL_NAME"].ToString(), dt.Rows[i]["INV"])); series2.Points.Add(new SeriesPoint(dt.Rows[i]["MODEL_NAME"].ToString(), dt.Rows[i]["PAR"])); } } series1.ArgumentScaleType = ScaleType.Qualitative; series2.ArgumentScaleType = ScaleType.Qualitative; DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); (series1.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Animation = barSlideAnimation1; sideBySideBarSeriesView1.Color = Color.DarkOrange; series1.View = sideBySideBarSeriesView1; //marker lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.Gold; lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; //fORMAT LINE lineSeriesView1.Color = Color.DeepPink; series2.View = lineSeriesView1; series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; lineSeriesView2.LineMarkerOptions.Color = System.Drawing.Color.Gold; lineSeriesView2.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; // Add the series to the chart. ChartByModel.SeriesSerializable = new Series[] { series1, series2 }; //Dailychart.Series.Add(series1); //Dailychart.Series.Add(series2); // Create two secondary axes, and add them to the chart's Diagram. SecondaryAxisY myAxisY = new SecondaryAxisY("my Y-Axis"); ((XYDiagram)ChartByModel.Diagram).SecondaryAxesY.Clear(); ((XYDiagram)ChartByModel.Diagram).SecondaryAxesY.Add(myAxisY); myAxisY.Label.TextPattern = "{V:#,#}"; myAxisY.Title.TextColor = System.Drawing.Color.OrangeRed; myAxisY.Title.Font = new Font("Calibri", 16, FontStyle.Regular); myAxisY.Title.Text = "%"; myAxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; // myAxisY.Label.Font = new System.Drawing.Font("Calibri", 12F); ((LineSeriesView)series2.View).AxisY = myAxisY; ((XYDiagram)ChartByModel.Diagram).AxisX.Title.Text = "Model"; ((XYDiagram)ChartByModel.Diagram).AxisY.Title.Text = "Inv (Prs)"; // Rotate the diagram (if necessary). ((XYDiagram)ChartByModel.Diagram).Rotated = false; //ScaleBreak NUmber ((XYDiagram)ChartByModel.Diagram).AxisX.NumericScaleOptions.AutoGrid = false; //Title ((XYDiagram)ChartByModel.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)ChartByModel.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; //legend ChartByModel.Legend.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.RightOutside; ChartByModel.Legend.Direction = DevExpress.XtraCharts.LegendDirection.TopToBottom; ChartByModel.Legend.MarkerMode = DevExpress.XtraCharts.LegendMarkerMode.CheckBoxAndMarker; ChartByModel.Legend.Name = "Default Legend"; ChartByModel.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)Dailychart.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; //Label series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series1.Label.TextPattern = "{V:#,#}"; series2.Label.TextPattern = "{V}" + "%"; (series1.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; ((XYDiagram)ChartByModel.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; // Add a title to the chart (if necessary). ChartTitle chartTitle1 = new ChartTitle(); chartTitle1.Text = "Inventory by Model"; ChartByModel.Titles.Add(chartTitle1); // Add the chart to the form. ChartByModel.Dock = DockStyle.Fill; splitChart_Detail.Panel1.Controls.Add(ChartByModel); }
private void CreateChart() { try { chartBTS.Legends.Clear(); //chartBTS.AppearanceNameSerializable = "Chameleon"; Series series1 = new Series("BTS", ViewType.Bar); chartBTS.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesLabel sideBySideBarSeriesLabel1 = new DevExpress.XtraCharts.SideBySideBarSeriesLabel(); Series series2 = new Series("Target", ViewType.Line); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Color = System.Drawing.Color.LimeGreen; sideBySideBarSeriesView1.FillStyle.FillMode = DevExpress.XtraCharts.FillMode.Solid; series1.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series1.Label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); series1.Label.TextPattern = "{V:#,#.0}" + "%"; series1.View = sideBySideBarSeriesView1; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series2.Label.TextPattern = "{V:#,#.0}" + "%"; lineSeriesView1.Color = System.Drawing.Color.LimeGreen; lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); lineSeriesView1.LineStyle.Thickness = 4; series2.View = lineSeriesView1; DataTable dt = SEL_SMT_BTS("C", line, mline, opcd, UC_MONTH.GetValue()); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["BTS"])); series2.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["TARGET"])); if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) && Convert.ToDouble(dt.Rows[i]["BTS"]) >= Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Yellow; } else if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Red; } else { series1.Points[i].Color = System.Drawing.Color.LimeGreen; } } chartBTS.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2 }; ((XYDiagram)chartBTS.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisX.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); ((XYDiagram)chartBTS.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; ((XYDiagram)chartBTS.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 13F); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 22F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Text = "BTS (%)"; ((XYDiagram)chartBTS.Diagram).AxisY.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); DevExpress.XtraCharts.Legend legend1 = new DevExpress.XtraCharts.Legend(); DevExpress.XtraCharts.CustomLegendItem customLegendItem1 = new DevExpress.XtraCharts.CustomLegendItem(); DevExpress.XtraCharts.CustomLegendItem customLegendItem2 = new DevExpress.XtraCharts.CustomLegendItem(); DevExpress.XtraCharts.CustomLegendItem customLegendItem3 = new DevExpress.XtraCharts.CustomLegendItem(); customLegendItem1.MarkerColor = System.Drawing.Color.LimeGreen; customLegendItem1.Name = "GREEN"; customLegendItem1.Text = ">=" + dt.Rows[0]["TARGET"].ToString() + "%"; customLegendItem2.MarkerColor = System.Drawing.Color.Yellow; customLegendItem2.Name = "YELLOW"; customLegendItem2.Text = ">=" + (Convert.ToDouble(dt.Rows[0]["TARGET"].ToString()) - 5).ToString() + "% and <" + dt.Rows[0]["TARGET"].ToString() + "%"; customLegendItem3.MarkerColor = System.Drawing.Color.Red; customLegendItem3.Name = "RED"; customLegendItem3.Text = "<" + (Convert.ToDouble(dt.Rows[0]["TARGET"].ToString()) - 5).ToString() + "%"; legend1.CustomItems.AddRange(new DevExpress.XtraCharts.CustomLegendItem[] { customLegendItem1, customLegendItem2, customLegendItem3 }); legend1.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.Right; legend1.AlignmentVertical = DevExpress.XtraCharts.LegendAlignmentVertical.TopOutside; legend1.Direction = DevExpress.XtraCharts.LegendDirection.LeftToRight; legend1.Font = new System.Drawing.Font("Tahoma", 12F); legend1.Name = "Legend1"; this.chartBTS.Legends.AddRange(new DevExpress.XtraCharts.Legend[] { legend1 }); } } catch (Exception EX) { } }
private void Create_chart(ChartControl arg_chart, DataTable arg_dt, string arg_name) { //Reset Chart beforce biding Data arg_chart.Series.Clear(); arg_chart.Titles.Clear(); // Create an empty chart. (No need). arg_chart.AppearanceNameSerializable = "Slipstream"; //create New object DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesUnwindAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); DevExpress.XtraCharts.PowerEasingFunction powerEasingFunction1 = new DevExpress.XtraCharts.PowerEasingFunction(); // Create the first side-by-side bar series and add points to it. Series series1 = new Series("Lead Time", ViewType.Bar); // Create the second side-by-side bar series and add points to it. Series series2 = new Series("Inventory", ViewType.Line); int iCount = 0, iShow = 0;; for (int i = 0; i < arg_dt.Rows.Count; i++) { if (arg_dt.Rows[i]["STYLE_CD"].ToString().ToUpper() != "TOTAL") { iShow++; if (iShow == 3) { series1.Points.Add(new SeriesPoint(arg_dt.Rows[i]["SUM_GRP_DETAIL"].ToString() + "\n" + arg_dt.Rows[i]["STYLE_CD"].ToString() , arg_dt.Rows[i]["LT"] == null || arg_dt.Rows[i]["LT"].ToString() == "" ? 0 : arg_dt.Rows[i]["LT"])); series2.Points.Add(new SeriesPoint(arg_dt.Rows[i]["SUM_GRP_DETAIL"].ToString() + "\n" + arg_dt.Rows[i]["STYLE_CD"].ToString() , arg_dt.Rows[i]["INV"] == null || arg_dt.Rows[i]["INV"].ToString() == "" ? 0 : arg_dt.Rows[i]["INV"])); } else { series1.Points.Add(new SeriesPoint(arg_dt.Rows[i]["SUM_GRP_DETAIL"].ToString() + "\n" + addBlank(iCount) , arg_dt.Rows[i]["LT"] == null || arg_dt.Rows[i]["LT"].ToString() == "" ? 0 : arg_dt.Rows[i]["LT"])); series2.Points.Add(new SeriesPoint(arg_dt.Rows[i]["SUM_GRP_DETAIL"].ToString() + "\n" + addBlank(iCount) , arg_dt.Rows[i]["INV"] == null || arg_dt.Rows[i]["INV"].ToString() == "" ? 0 : arg_dt.Rows[i]["INV"])); } if (i + 1 < arg_dt.Rows.Count && arg_dt.Rows[i + 1]["STYLE_CD"].ToString().ToUpper() != "TOTAL" && arg_dt.Rows[i]["STYLE_CD"].ToString() != arg_dt.Rows[i + 1]["STYLE_CD"].ToString()) { iCount++; iShow = 0; series1.Points.Add(new SeriesPoint(addBlank(iCount))); series2.Points.Add(new SeriesPoint(addBlank(iCount))); } } } //marker lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.Gold; lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; series2.View = lineSeriesView1; // Add the series to the chart. series1.ArgumentScaleType = ScaleType.Qualitative; series2.ArgumentScaleType = ScaleType.Qualitative; arg_chart.SeriesSerializable = new Series[] { series1, series2 }; //arg_chart.Series.Add(series1); //arg_chart.Series.Add(series2); // Create two secondary axes, and add them to the chart's Diagram. SecondaryAxisY axisYSecond = new SecondaryAxisY("my Y-Axis"); ((XYDiagram)arg_chart.Diagram).SecondaryAxesY.Clear(); ((XYDiagram)arg_chart.Diagram).SecondaryAxesY.Add(axisYSecond); axisYSecond.Label.TextPattern = "{V:#,#}"; axisYSecond.Title.TextColor = Color.Orange; axisYSecond.Title.Font = new Font("Tahoma", 16F, FontStyle.Bold); axisYSecond.Title.Text = "Inventory"; axisYSecond.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; axisYSecond.Label.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold); ((LineSeriesView)series2.View).AxisY = axisYSecond; // Hide the legend (if necessary). arg_chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; arg_chart.Legend.AlignmentVertical = LegendAlignmentVertical.TopOutside; arg_chart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; arg_chart.Legend.Direction = LegendDirection.LeftToRight; // Rotate the diagram (if necessary). ((XYDiagram)arg_chart.Diagram).Rotated = false; //ScaleBreak NUmber ((XYDiagram)arg_chart.Diagram).AxisX.NumericScaleOptions.AutoGrid = false; //Title ((XYDiagram)arg_chart.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)arg_chart.Diagram).AxisX.Title.Text = ""; if (iCount > 2) { ((XYDiagram)arg_chart.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold); } else { ((XYDiagram)arg_chart.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold); } ((XYDiagram)arg_chart.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; ((XYDiagram)arg_chart.Diagram).AxisY.Title.TextColor = Color.Orange; ((XYDiagram)arg_chart.Diagram).AxisY.Title.Text = "Lead Time"; ((XYDiagram)arg_chart.Diagram).AxisY.Title.Font = new System.Drawing.Font("Tahoma", 16F, System.Drawing.FontStyle.Bold); ((XYDiagram)arg_chart.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold); //((XYDiagram)arg_chart.Diagram).AxisY.WholeRange.Auto = true; // ((XYDiagram)arg_chart.Diagram).AxisY.WholeRange.SetMinMaxValues(0, 2); //Animation Series lineSeriesView1.Color = System.Drawing.Color.DarkOrange; xySeriesUnwindAnimation1.EasingFunction = powerEasingFunction1; lineSeriesView1.SeriesAnimation = xySeriesUnwindAnimation1; ((XYDiagram)arg_chart.Diagram).AxisY.Label.TextPattern = "{V:#,0.##}"; //Label series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series1.Label.TextPattern = "{V:#,#}"; (series1.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series2.Label.TextPattern = "{V:#,#}"; // Add a title to the chart (if necessary). ChartTitle chartTitle1 = new ChartTitle(); chartTitle1.Font = new System.Drawing.Font("Calibri", 20F, System.Drawing.FontStyle.Bold); chartTitle1.Text = arg_dt.Rows[0]["CHART_TITLE"].ToString(); arg_chart.Titles.Add(chartTitle1); // Add the chart to the form. pnMain.Controls.Add(arg_chart); }