private void CreateChartBar(ChartControl arg_chart, DataTable arg_dt, string arg_name) { // Create a new chart. arg_chart.Series.Clear(); arg_chart.Titles.Clear(); // ((XYDiagram)arg_chart.Diagram).AxisX.CustomLabels.Clear(); //DataSource string Now = DateTime.Now.ToString("yyyyMMdd"); // Create two series. //Series series1 = new Series("Production Qty", ViewType.Bar); Series series2 = new Series("POD", ViewType.Bar); // DevExpress.XtraCharts.SplineSeriesView splineSeriesView1 = new DevExpress.XtraCharts.SplineSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.PointSeriesLabel pointSeriesLabel1 = new DevExpress.XtraCharts.PointSeriesLabel(); //DevExpress.XtraCharts.BarWidenAnimation barWidenAnimation1 = new DevExpress.XtraCharts.BarWidenAnimation(); //DevExpress.XtraCharts.ElasticEasingFunction elasticEasingFunction1 = new DevExpress.XtraCharts.ElasticEasingFunction(); // DevExpress.XtraCharts.XYSeriesBlowUpAnimation xySeriesBlowUpAnimation1 = new DevExpress.XtraCharts.XYSeriesBlowUpAnimation(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesUnwindAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); // DevExpress.XtraCharts.XYSeriesUnwrapAnimation xySeriesUnwrapAnimation1 = new DevExpress.XtraCharts.XYSeriesUnwrapAnimation(); DevExpress.XtraCharts.PowerEasingFunction powerEasingFunction1 = new DevExpress.XtraCharts.PowerEasingFunction(); DevExpress.XtraCharts.SineEasingFunction sineEasingFunction1 = new DevExpress.XtraCharts.SineEasingFunction(); DevExpress.XtraCharts.ConstantLine constantLine1 = new DevExpress.XtraCharts.ConstantLine(); // Add points to them, with their arguments different. for (int i = 0; i < arg_dt.Rows.Count; i++) { //series1.Points.Add(new SeriesPoint(dt.Rows[i]["HMS"].ToString(), dt.Rows[i]["QTY"])); //GetRandomNumber(10, 50) series2.Points.Add(new SeriesPoint(arg_dt.Rows[i]["LB"].ToString().Replace("_", "\n"), arg_dt.Rows[i]["POD"] == null || arg_dt.Rows[i]["POD"].ToString() == "" ? 0 : arg_dt.Rows[i]["POD"])); if ((arg_dt.Rows[i]["POD"] == null || arg_dt.Rows[i]["POD"].ToString() == "" ? 0 : Convert.ToDouble(arg_dt.Rows[i]["POD"])) > Convert.ToDouble(arg_dt.Rows[0]["TARGET"])) { series2.Points[i].Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(240))))); } else { series2.Points[i].Color = Color.Red; } } (series2.Label as SideBySideBarSeriesLabel).Position = DevExpress.XtraCharts.BarSeriesLabelPosition.Top; // series2 = splineSeriesView1; // Add both series to the chart. //chartControl1.Series.AddRange(new Series[] { series1, series2 }); arg_chart.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series2 }; ((XYDiagram)arg_chart.Diagram).AxisY.Title.Text = "POD"; ((XYDiagram)arg_chart.Diagram).AxisY.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(240))))); ((XYDiagram)arg_chart.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; ((XYDiagram)arg_chart.Diagram).AxisX.Title.Text = "Date"; ((XYDiagram)arg_chart.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; ((XYDiagram)arg_chart.Diagram).AxisX.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(240))))); ((XYDiagram)arg_chart.Diagram).AxisX.Tickmarks.MinorVisible = true; sideBySideBarSeriesView1.ColorEach = false; series2.View = sideBySideBarSeriesView1; //title DevExpress.XtraCharts.ChartTitle chartTitle2 = new DevExpress.XtraCharts.ChartTitle(); chartTitle2.Alignment = System.Drawing.StringAlignment.Near; chartTitle2.Font = new System.Drawing.Font("Tahoma", 24F, System.Drawing.FontStyle.Bold); chartTitle2.Text = arg_name; chartTitle2.TextColor = System.Drawing.Color.Blue; arg_chart.Titles.AddRange(new DevExpress.XtraCharts.ChartTitle[] { chartTitle2 }); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; xySeriesUnwindAnimation1.EasingFunction = sineEasingFunction1; //powerEasingFunction1; //splineSeriesView1.SeriesAnimation = xySeriesUnwindAnimation1;//xySeriesBlowUpAnimation1;//xySeriesUnwindAnimation1; // xySeriesUnwrapAnimation1; arg_chart.Legend.Direction = LegendDirection.LeftToRight; //Constant line //constantLine1.ShowInLegend = false; constantLine1.AxisValueSerializable = arg_dt.Rows[0]["TARGET"].ToString(); constantLine1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(80))))); constantLine1.Name = "Target"; constantLine1.ShowBehind = false; constantLine1.Title.Visible = false; //constantLine1.Title.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //constantLine1.Title.Text = "Target"; constantLine1.LineStyle.Thickness = 2; constantLine1.Title.Alignment = DevExpress.XtraCharts.ConstantLineTitleAlignment.Far; ((XYDiagram)arg_chart.Diagram).AxisY.ConstantLines.Clear(); ((XYDiagram)arg_chart.Diagram).AxisY.ConstantLines.AddRange(new DevExpress.XtraCharts.ConstantLine[] { constantLine1 }); //((XYDiagram)arg_chart.Diagram).AxisX.NumericScaleOptions.AutoGrid = false; //((XYDiagram)arg_chart.Diagram).AxisX.VisualRange.Auto = false; //((XYDiagram)arg_chart.Diagram).AxisX.VisualRange.AutoSideMargins = false; //((XYDiagram)arg_chart.Diagram).AxisX.Label.Angle = 90; //((XYDiagram)arg_chart.Diagram).AxisX.Label.ResolveOverlappingOptions.AllowHide = false; //((XYDiagram)arg_chart.Diagram).AxisX.Label.ResolveOverlappingOptions.AllowStagger = true; ((XYDiagram)arg_chart.Diagram).AxisX.Tickmarks.MinorVisible = false; ((XYDiagram)arg_chart.Diagram).AxisX.GridLines.Visible = false; ((XYDiagram)arg_chart.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 10, System.Drawing.FontStyle.Bold); //((XYDiagram)arg_chart.Diagram).AxisY.NumericScaleOptions.ScaleMode = DevExpress.XtraCharts.ScaleMode.Continuous; //((XYDiagram)_chartControl1.Diagram).AxisY.NumericScaleOptions.ScaleMode = DevExpress.XtraCharts.ScaleMode.Automatic; //((XYDiagram)arg_chart.Diagram).AxisX. ((XYDiagram)arg_chart.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 10, System.Drawing.FontStyle.Bold); ((XYDiagram)arg_chart.Diagram).AxisX.Title.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)arg_chart.Diagram).AxisY.Title.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); pn_body.Controls.Add(arg_chart); }
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 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 { } }
private void CreateChart(string line_cd, string mline_cd, string op_cd, DevExpress.XtraCharts.ChartControl _chartControl, string _title) { // Create a new chart. _chartControl.Series.Clear(); //DataSource DataTable dt = SP_MGL_PRODUCTION_DATA_SELECT("Q2", line_cd, mline_cd); string Now = DateTime.Now.ToString("yyyyMMdd"); // Create two series. Series series1 = new Series("Target Qty", ViewType.Line); Series series2 = new Series("Prod. Qty", ViewType.Spline); DevExpress.XtraCharts.SplineSeriesView splineSeriesView1 = new DevExpress.XtraCharts.SplineSeriesView(); DevExpress.XtraCharts.SplineSeriesView splineSeriesView2 = new DevExpress.XtraCharts.SplineSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.PointSeriesLabel pointSeriesLabel1 = new DevExpress.XtraCharts.PointSeriesLabel(); DevExpress.XtraCharts.BarWidenAnimation barWidenAnimation1 = new DevExpress.XtraCharts.BarWidenAnimation(); DevExpress.XtraCharts.ElasticEasingFunction elasticEasingFunction1 = new DevExpress.XtraCharts.ElasticEasingFunction(); DevExpress.XtraCharts.XYSeriesBlowUpAnimation xySeriesBlowUpAnimation2 = new DevExpress.XtraCharts.XYSeriesBlowUpAnimation(); DevExpress.XtraCharts.XYSeriesUnwindAnimation xySeriesUnwindAnimation2 = new DevExpress.XtraCharts.XYSeriesUnwindAnimation(); DevExpress.XtraCharts.XYSeriesUnwrapAnimation xySeriesUnwrapAnimation2 = new DevExpress.XtraCharts.XYSeriesUnwrapAnimation(); DevExpress.XtraCharts.PowerEasingFunction powerEasingFunction2 = new DevExpress.XtraCharts.PowerEasingFunction(); DevExpress.XtraCharts.SineEasingFunction sineEasingFunction2 = new DevExpress.XtraCharts.SineEasingFunction(); // Add points to them, with their arguments different. if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["HMS"].ToString(), dt.Rows[i]["TARGET"])); //GetRandomNumber(10, 50) series2.Points.Add(new SeriesPoint(dt.Rows[i]["HMS"].ToString(), dt.Rows[i]["QTY"])); //dt.Rows[i]["HMS"] } //_chartControl1.Series[0].ArgumentScaleType = ScaleType.Qualitative; } else { for (int i = 1; i < 9; i++) { //series1.Points.Add(new SeriesPoint(dt.Rows[i]["HMS"].ToString(), dt.Rows[i]["QTY"])); //GetRandomNumber(10, 50) series1.Points.Add(new SeriesPoint(i + "H", 0)); series2.Points.Add(new SeriesPoint(i + "H", 0)); //dt.Rows[i]["HMS"] } } _chartControl.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2 }; ((XYDiagram)_chartControl.Diagram).AxisY.Title.Text = "Product Qty (Prs)"; ((XYDiagram)_chartControl.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; ((XYDiagram)_chartControl.Diagram).AxisY.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(240))))); ((XYDiagram)_chartControl.Diagram).AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; ((XYDiagram)_chartControl.Diagram).AxisX.Title.Text = "Hour"; ((XYDiagram)_chartControl.Diagram).AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; ((XYDiagram)_chartControl.Diagram).AxisX.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(176)))), ((int)(((byte)(240))))); _chartControl.Titles[0].Text = _title; splineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; splineSeriesView1.Shadow.Visible = false; splineSeriesView1.Color = System.Drawing.Color.Green; splineSeriesView1.LineMarkerOptions.BorderColor = System.Drawing.Color.DodgerBlue; splineSeriesView1.LineMarkerOptions.BorderVisible = false; splineSeriesView2.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; splineSeriesView2.Shadow.Visible = false; splineSeriesView2.Color = System.Drawing.Color.DodgerBlue; splineSeriesView2.LineMarkerOptions.BorderColor = System.Drawing.Color.DodgerBlue; splineSeriesView2.LineMarkerOptions.BorderVisible = false; //splineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.Red; splineSeriesView2.LineMarkerOptions.Kind = DevExpress.XtraCharts.MarkerKind.Circle; splineSeriesView2.LineMarkerOptions.Color = System.Drawing.Color.DodgerBlue; splineSeriesView2.LineMarkerOptions.Size = 15; splineSeriesView2.LineStyle.Thickness = 3; series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; //pointSeriesLabel1.TextPattern = "{V:#,#}"; series1.View = splineSeriesView1; series2.Label.TextPattern = "{V:#,#}"; series2.View = splineSeriesView2; xySeriesUnwindAnimation2.EasingFunction = sineEasingFunction2; //powerEasingFunction1; splineSeriesView2.SeriesAnimation = xySeriesUnwindAnimation2; //xySeriesBlowUpAnimation1;//xySeriesUnwindAnimation1; // xySeriesUnwrapAnimation1; ((XYDiagram)_chartControl.Diagram).AxisX.VisualRange.Auto = true; ((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", 12, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisX.NumericScaleOptions.ScaleMode = DevExpress.XtraCharts.ScaleMode.Automatic; ((XYDiagram)_chartControl.Diagram).AxisY.Label.Font = new System.Drawing.Font("Calibri", 12, System.Drawing.FontStyle.Bold); ((XYDiagram)_chartControl.Diagram).AxisX.Title.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)_chartControl.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)_chartControl.Diagram).AxisY.Title.TextColor = Color.DarkOrange; ((XYDiagram)_chartControl.Diagram).AxisX.Title.TextColor = Color.DarkOrange; }
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); }