/// <summary> /// Builds the realtime plot. /// </summary> private void BuildRealTimePlot () { RealTimeXAxis = new DateTimeAxis { Key = "RealTimeXAxis", Position = AxisPosition.Bottom, MajorGridlineThickness = 1, MajorGridlineStyle = OxyPlot.LineStyle.Solid, MinorGridlineColor = OxyColors.LightGray, MinorGridlineStyle = OxyPlot.LineStyle.Dot, MinorGridlineThickness = .5, MinorStep = TimeSpan.FromSeconds (1).Ticks, }; var YAxis = new LinearAxis { Position = AxisPosition.Left, IsPanEnabled = false, IsZoomEnabled = false, MajorGridlineThickness = 1, MajorGridlineStyle = OxyPlot.LineStyle.Solid, MinorGridlineColor = OxyColors.LightGray, MinorGridlineStyle = OxyPlot.LineStyle.Dot, MinorGridlineThickness = .5, }; RealTimePlotModel = new PlotModel { PlotType = PlotType.XY, Background = OxyPlot.OxyColors.White, IsLegendVisible = true, LegendOrientation = LegendOrientation.Horizontal, LegendPlacement = LegendPlacement.Outside, LegendPosition = LegendPosition.RightMiddle, }; RealTimePlotController = new PlotController (); RealTimePlotModel.Axes.Add (YAxis); RealTimePlotModel.Axes.Add (RealTimeXAxis); //Enable double buffered to prevent flickering RealTimePlotView = new PlotView (){ Name = "", Model = RealTimePlotModel, DoubleBuffered = true }; vboxRealTimePlot.PackStart (RealTimePlotView, true, true, 0); (vboxRealTimePlot [RealTimePlotView] as Box.BoxChild).Position = 0; RealTimePlotView.SetSizeRequest (hbSequences.Allocation.Width, fSequences.Allocation.Height / 2); vpanedSequences.Position = fSequences.Allocation.Height / 2; RealTimePlotView.ShowAll (); cbtnRealTimePlotSmoothValues.Toggled += OnCbtnRealTimePlotSmoothValues; cbtnRealTimePlotShowMarker.Toggled += OnCbtnRealTimePlotShowMarkerToggled; btnRealTimePlotJumpStart.Clicked += OnBtnRealTimePlotJumpStartClicked; btnRealTimePlotJumpLatest.Clicked += OnBtnRealTimePlotJumpLatestClicked; btnRealTimePlotSnapshot.Clicked += OnBtnRealTimePlotSnapshotClicked; btnRealTimePlotPause.Clicked += OnBtnRealTimePlotPauseClicked; btnRealTimePlotResetZoom.Clicked += OnBtnRealTimePlotResetZoomClicked; btnRealTimePlotFitData.Clicked += OnBtnRealTimePlotFitDataClicked; cbtnRealTimePlotLimitPoints.Active = Frontend.Settings.Default.LimitPlotPoints; cbtnRealTimePlotLimitPoints.Toggled += OnCbtnRealTimePlotLimitPoints; }
/// <summary> /// Setups the oxyplot. /// </summary> private void SetupOxyPlot() { XAxis = new LinearAxis { Key = "X", Position = AxisPosition.Bottom, AbsoluteMinimum = TimeSpan.FromSeconds (0).Ticks, LabelFormatter = x => { if (x <= TimeSpan.FromSeconds (0).Ticks) { return "Start"; } return string.Format ("+{0}", TimeSpan.FromSeconds (x).ToString ("c")); }, MajorGridlineThickness = 1, MajorGridlineStyle = LineStyle.Solid, MinorGridlineColor = OxyColors.LightGray, MinorGridlineStyle = LineStyle.Dot, MinorGridlineThickness = .5, }; var YAxis = new LinearAxis { Position = AxisPosition.Left, Minimum = -0.1, Maximum = 1.1, LabelFormatter = x => ((int)x == 0) ? "LOW" : "HIGH", IsPanEnabled = false, IsZoomEnabled = false, AbsoluteMaximum = 1.1, AbsoluteMinimum = -0.1, MinorStep = 1, MajorStep = 1, }; sequenceSeries = new OxyPlot.Series.StairStepSeries () { DataFieldX = "Time", DataFieldY = "Value", }; repeateSeries = new OxyPlot.Series.LineSeries () { DataFieldX = "Time", DataFieldY = "Value", StrokeThickness = 2, LineStyle = LineStyle.Dot }; plotModel = new PlotModel { PlotType = PlotType.XY, Background = OxyPlot.OxyColors.White, }; plotModel.Axes.Add (YAxis); plotModel.Axes.Add (XAxis); plotModel.Series.Add (sequenceSeries); plotView = new PlotView (){ Name = "", Model = plotModel }; vboxOptions.Add (plotView); ((Box.BoxChild)(vboxOptions [plotView])).Position = 2; plotView.SetSizeRequest (nvSequenceOptions.WidthRequest, this.HeightRequest / 3); plotView.ShowAll (); }
/// <summary> /// Builds the sequence preview plot. /// </summary> private void BuildSequencePreviewPlot () { XAxis = new LinearAxis { Key = "X", Position = AxisPosition.Bottom, AbsoluteMinimum = TimeSpan.FromSeconds (0).Ticks, LabelFormatter = x => { if (x <= TimeSpan.FromSeconds (0).Ticks) { return "Start"; } return string.Format ("+{0}", TimeSpan.FromSeconds (x).ToString ("g")); }, MajorGridlineThickness = 1, MajorGridlineStyle = OxyPlot.LineStyle.Solid, MinorGridlineColor = OxyColors.LightGray, MinorGridlineStyle = OxyPlot.LineStyle.Dot, MinorGridlineThickness = .5, }; var YAxis = new LinearAxis { Position = AxisPosition.Left, Minimum = -0.1, Maximum = 1.1, LabelFormatter = x => ((int)x == 0) ? "LOW" : "HIGH", IsPanEnabled = false, IsZoomEnabled = false, AbsoluteMaximum = 1.1, AbsoluteMinimum = -0.1, MinorStep = 1, MajorStep = 1, }; SequencePreviewPlotModel = new PlotModel { PlotType = PlotType.XY, Background = OxyPlot.OxyColors.White, }; SequencePreviewPlotModel.Axes.Add (YAxis); SequencePreviewPlotModel.Axes.Add (XAxis); SequencePreviewPlotView = new PlotView (){ Name = "", Model = SequencePreviewPlotModel }; vpanedSequences.Pack2 (SequencePreviewPlotView, true, true); SequencePreviewPlotView.SetSizeRequest (hbSequences.Allocation.Width, fSequences.Allocation.Height / 2); vpanedSequences.Position = fSequences.Allocation.Height / 2; SequencePreviewPlotView.ShowAll (); }