Пример #1
0
        public override void BeginInitialize( )
        {
            seriesLabel  = new DevExpress.XtraCharts.PointSeriesLabel();
            seriesView   = new DevExpress.XtraCharts.SplineSeriesView();
            pointOptions = new DevExpress.XtraCharts.PointOptions();

            base.BeginInitialize();
        }
Пример #2
0
        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 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 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; }
        }
Пример #5
0
        private void InitSpline2Inner(string enumValue, string titleName, DataTable dt, Color color)
        {
            Series series = new Series(titleName, (ViewType)Enum.Parse(typeof(ViewType), enumValue));

            DevExpress.XtraCharts.PointSeriesLabel         pointSeriesLabel1      = new DevExpress.XtraCharts.PointSeriesLabel();
            DevExpress.XtraCharts.PieSeriesLabel           pieSeriesLabel1        = new DevExpress.XtraCharts.PieSeriesLabel();
            DevExpress.XtraCharts.SideBySideBarSeriesLabel sideBySizeSeriesLabel1 = new SideBySideBarSeriesLabel();

            //************************************************************BeginInit()********************************************************
            ((System.ComponentModel.ISupportInitialize)(chartControl1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(series)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(pointSeriesLabel1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(pieSeriesLabel1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(sideBySizeSeriesLabel1)).BeginInit();

            series.ArgumentScaleType = ScaleType.Qualitative;

            DevExpress.XtraCharts.PiePointOptions piePointOptions1 = new DevExpress.XtraCharts.PiePointOptions();
            piePointOptions1.PointView = DevExpress.XtraCharts.PointView.ArgumentAndValues;
            series.PointOptions        = piePointOptions1;

            series.LegendText = m_ColumnName;
            series.View.Color = color;
            foreach (DataRow dataRow in dt.Rows)
            {
                string name = dataRow[m_X_NameID + "#" + m_X_Name].ToString();
                if (name == "总计")
                {
                    continue;
                }
                string      value = dataRow[m_ColumnID + "#" + m_ColumnName].ToString();
                SeriesPoint sp    = new SeriesPoint(name, value);
                series.Points.Add(sp);
            }
            chartControl1.Series.Add(series);

            PointSeriesView pointView = series.View as PointSeriesView;

            if (pointView != null)
            {
                pointView.PointMarkerOptions.Kind = MarkerKind.Circle;
            }

            //针对饼图的处理
            if (series.View is PieSeriesView)
            {
                this.chartControl1.RuntimeSelection           = false;
                ((PieSeriesView)series.View).RuntimeExploding = true;
            }
            else
            {
                this.chartControl1.RuntimeSelection = true;
            }

            ChartTitle ct1 = new ChartTitle();

            ct1.Text = titleName;
            chartControl1.Titles.Clear();
            chartControl1.Titles.Add(ct1);

            if (series.Label is PointSeriesLabel)
            {
                pointSeriesLabel1.LineLength   = 15;
                pointSeriesLabel1.LineVisible  = true;
                pointSeriesLabel1.Antialiasing = true;
                pointSeriesLabel1.Angle        = 30;
                pointSeriesLabel1.ResolveOverlappingMinIndent = 10;
                pointSeriesLabel1.ResolveOverlappingMode      = DevExpress.XtraCharts.ResolveOverlappingMode.JustifyAllAroundPoint;
                series.Label = pointSeriesLabel1;
            }
            else if (series.Label is PieSeriesLabel)
            {
                pieSeriesLabel1.LineLength   = 15;
                pieSeriesLabel1.LineVisible  = true;
                pieSeriesLabel1.Antialiasing = true;
                pieSeriesLabel1.ResolveOverlappingMinIndent = 10;
                pieSeriesLabel1.ResolveOverlappingMode      = DevExpress.XtraCharts.ResolveOverlappingMode.JustifyAllAroundPoint;
                series.Label = pieSeriesLabel1;
            }
            else if (series.Label is SideBySideBarSeriesLabel)
            {
                sideBySizeSeriesLabel1.LineLength   = 15;
                sideBySizeSeriesLabel1.LineVisible  = true;
                sideBySizeSeriesLabel1.Antialiasing = true;
                sideBySizeSeriesLabel1.Position     = BarSeriesLabelPosition.Top;
                sideBySizeSeriesLabel1.ResolveOverlappingMinIndent = 10;
                sideBySizeSeriesLabel1.ResolveOverlappingMode      = DevExpress.XtraCharts.ResolveOverlappingMode.JustifyAllAroundPoint;
                series.Label = sideBySizeSeriesLabel1;
            }
            ((System.ComponentModel.ISupportInitialize)(pieSeriesLabel1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(pointSeriesLabel1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(series)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(chartControl1)).EndInit();
            //************************************************************EndInit()********************************************************
        }