Esempio n. 1
0
 public void ClearAll(PlotModel pM)
 {
     Plotter.ClearAnnotations(pM);
     Plotter.ClearPoints(pM);
     pM.InvalidatePlot(true);
 }
Esempio n. 2
0
        public PlotModel CreatePlotModel(List <string> RegDescriptions, List <string> RegUnits)
        {
            PlotModel pM;

            if (RegDescriptions != null)
            {
                if (RegDescriptions.Count() > 0)
                {
                    if (RegDescriptions.Count() == 1)
                    {
                        pM = new PlotModel(RegDescriptions[0]);
                    }
                    else
                    {
                        pM = new PlotModel("");
                    }

                    pM.LegendBackground = OxyColors.White;
                    pM.LegendBorder     = OxyColors.Black;
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }

            pM.Axes.Clear();
            pM.Axes.Add(new DateTimeAxis(AxisPosition.Bottom, resourceDictionary["L_TimeAxis"] + "")
            {
                Key                = "X",
                StringFormat       = "dd-MM-yyyy hh:mm",
                IsZoomEnabled      = true,
                IntervalLength     = 100,
                MinorIntervalType  = DateTimeIntervalType.Days,
                IntervalType       = DateTimeIntervalType.Days,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.None,
                IsPanEnabled       = false
            });
            pM.Axes.Add(new LinearAxis(AxisPosition.Left, resourceDictionary["L_DataAxis"] + "")
            {
                Key = "Primary",
                MajorGridlineStyle = LineStyle.Solid,
                IsZoomEnabled      = true
            });

            if (RegUnits != null)
            {
                if (RegUnits.Contains(N3PR_Data.PERCENTAGE))
                {
                    pM.Axes.Add(new LinearAxis(AxisPosition.Right, N3PR_Data.PERCENTAGE)
                    {
                        Key = "Secondary",
                        MajorGridlineStyle = LineStyle.Solid,
                        Minimum            = 0,
                        Maximum            = 100,
                        MajorGridlineColor = OxyColors.LightBlue,
                        TicklineColor      = OxyColors.LightBlue,
                        TitleColor         = OxyColors.Blue,
                        TextColor          = OxyColors.Blue,
                        IsZoomEnabled      = true
                    });
                }
            }

            pM.MouseDown += new EventHandler <OxyMouseEventArgs>((sender, e) => Plotter.OnMouseDown(sender, e, pM));

            return(pM);
        }