WPF - OXY Drawing _old

 plotModel = new PlotModel()
            {
                Title = "数据统计",
                LegendTitle = "Max:红色,Min:黄色",
                LegendOrientation = LegendOrientation.Horizontal,
                LegendPlacement = LegendPlacement.Inside,
                LegendPosition = LegendPosition.TopRight,
                LegendBackground = OxyColor.FromAColor(200, OxyColors.Beige),
                LegendBorder = OxyColors.Black,
                DefaultFont = "微软雅黑",
            };

            #region X,Y轴


            //X轴
            var _dateAxis = new DateTimeAxis()
            {
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                IntervalLength = 80,
                IsZoomEnabled = false,
                IsPanEnabled = false,
                StringFormat = "M / D HH: mm: SS " , 
                the Title = " Time " 
            }; 
            plotModel.Axes.Add (_dateAxis); 

            // the Y-axis 
            var _valueAxis = new new the LinearAxis () 
            { 
                the Title = " value " , 
                the Maximum = USL USL + / . 4 , 
                Minimum = LSL - LSL / . 3 , 
                MajorGridlineStyle = LineStyle.Solid, // main scale disposed grid 
                MinorGridlineStyle = LineStyle.Dot,// the sub-scale grid pattern is provided 
                IntervalLength = 80 , 
                Angle = 60 , 
                IsZoomEnabled = to true , // coordinate axis scaling 
                IsPanEnabled = to true , // chart zoom 
                the Position = AxisPosition.Left, 
            }; 
            plotModel.Axes.Add (_valueAxis); 

            #endregion 

            #region lines // dynamic line var lineSerial = new new the LineSeries () 
            { 
                the Title = SvidSelected.ParaName, //

            
            eqpParam name
                Color = OxyColors.Black,
                Smooth = true,
                MarkerType = MarkerType.Circle,
                StrokeThickness = 0,
                MarkerSize = 1,
                MarkerStroke = OxyColors.BlueViolet,
            };
            plotModel.Series.Add(lineSerial);

            Task.Factory.StartNew(() =>
               {
                   for (int i = 0; i < resData.Count; i++)
                   { 
                       LineSerial.Points.Add (DateTimeAxis.CreateDataPoint (ResData [I] .occurenceTime, ResData [I] .val)); 
                       plotModel.InvalidatePlot ( to true ); // refreshed every second view 
                        // the Thread.Sleep (200 is); 
                   } 
                   sw.Stop (); 
                   TotalDate = " total rendering time (ms): " + sw.ElapsedMilliseconds; // sw.ElapsedTicks / (decimal) Stopwatch.Frequency; 
               }); 

            #endregion 

            #region caps, floors, middle // Add dimension line var lineMaxAnnotation =

            
            new LineAnnotation()
            {//上限
                Type = LineAnnotationType.Horizontal,
                Y = usl,
                Text = "上限:" + usl,
                Color = OxyColors.Red,
                LineStyle = LineStyle.DashDashDot,
                StrokeThickness = 2
            };
            plotModel.Annotations.Add(lineMaxAnnotation);

            var lineMinAnnotation = new LineAnnotation()
            {//下限
                Type = LineAnnotationType.Horizontal,
                Color = OxyColors.Blue,
                LineStyle = LineStyle.Dash,
                StrokeThickness = 2,
                Y = lsl,
                Text = "下限:" + lsl
            };
            plotModel.Annotations.Add(lineMinAnnotation);

            var lineMean = new LineAnnotation()
            {//平均
                Type = LineAnnotationType.Horizontal,
                Color = OxyColors.Green,
                LineStyle = LineStyle.LongDash,
                StrokeThickness = 2,
                Y = mean,
                Text = "平均:" + mean
            };
            plotModel.Annotations.Add(lineMean);

            #endregion

            #region 最大值,最小值

            var min = new ScatterSeries();
            var maxDataPoint = DateTimeAxis.CreateDataPoint(maxPoint.occurenceTime, maxPoint.val);
            min.Points.Add(new ScatterPoint(maxDataPoint.X, maxDataPoint.Y, 15));
            min.MarkerFill = OxyColor.FromAColor(20, OxyColors.Red);
            min.MarkerType = MarkerType.Circle;
            plotModel.Series.Add(min);

            var max = new ScatterSeries();
            var minDataPoint = DateTimeAxis.CreateDataPoint(minPoint.occurenceTime, minPoint.val);
            max.Points.Add(new ScatterPoint(minDataPoint.X, minDataPoint.Y, 15));
            max.MarkerFill = OxyColor.FromAColor(20, OxyColors.Yellow);
            max.MarkerType = MarkerType.Circle;
            plotModel.Series.Add(max);

            #endregion

 

Guess you like

Origin www.cnblogs.com/ingstyle/p/11243304.html
Old