public NormalizingPlotter(NPlot.Windows.PlotSurface2D plotSurface, TimeSpan displayPeriod) : base(plotSurface) { this.DisplayPeriod = displayPeriod; HeartRate heartRate = HeartRate.Instance; NormalizerFilter normalizerFilter = new NormalizerFilter(TimeSpan.FromSeconds(1.5)); LightStoneDevice.Instance.RawHeartSignalOutput.Add(normalizerFilter); int bufferSize = (int)(m_DisplayPeriod.Ticks / LightStoneDevice.SamplingInterval.Ticks); m_PointBuffer = TimeSpanBuffer<double>.Synchronized(m_DisplayPeriod, bufferSize); normalizerFilter.Output.Add(m_PointBuffer); this.PlotSurface.Clear(); m_LinePlot = new LinePlot(); m_LinePlot.Pen = new Pen(Color.Red, 2.0f); this.PlotSurface.Add(m_LinePlot); this.PlotSurface.XAxis1 = new DateTimeAxis(this.PlotSurface.XAxis1); this.PlotSurface.XAxis1.NumberFormat = "hh:mm:ss"; this.PlotSurface.Title = "Normalized Heart Signal"; this.PlotSurface.XAxis1.Label = "Time"; this.PlotSurface.YAxis1.Label = "Magnitude"; Refresh(); }
public void AddPlot(NPlot.Windows.PlotSurface2D graphSurface, string chosenGraphName, string mode, string tourTypeFilter) { switch (chosenGraphName) { case "Kill/Death Trend": AddRatioTrendPlot(_pilotName, chosenGraphName, "OverAllKills", "OverAllDeathPlus1", Color.Blue, mode, tourTypeFilter); break; case "HTC Kill/Death Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "HTCKillsPerDeath", Color.CadetBlue, mode, tourTypeFilter); break; case "Kill/Landed Trend": AddRatioTrendPlot(_pilotName, chosenGraphName, "OverAllKills", "OverAllLanded", Color.Crimson, mode, tourTypeFilter); break; case "Kill/Sortie Trend": AddRatioTrendPlot(_pilotName, chosenGraphName, "OverAllKills", "OverAllSorties", Color.Chartreuse, mode, tourTypeFilter); break; case "Kill/Hour Trend": AddRatioTrendPlot(_pilotName, chosenGraphName, "OverAllKills", "OverAllTimeInHours", Color.Chocolate, mode, tourTypeFilter); break; case "Kill/Assist Trend": AddRatioTrendPlot(_pilotName, chosenGraphName, "OverAllKills", "OverAllAssists", Color.DarkOliveGreen, mode, tourTypeFilter); break; case "Hit % Trend": AddHitPercentageTrendPlot(_pilotName, chosenGraphName, mode, tourTypeFilter); break; case "Sorties/Landed Trend": AddRatioTrendPlot(_pilotName, chosenGraphName, "OverAllSorties", "OverAllLanded", Color.IndianRed, mode, tourTypeFilter); break; case "Sorties/Death Trend": AddRatioTrendPlot(_pilotName, chosenGraphName, "OverAllSorties", "OverAllDeath", Color.DarkRed, mode, tourTypeFilter); break; case "Total Kills Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllKills", Color.Teal, mode, tourTypeFilter); break; case "Total Assists Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllAssists", Color.YellowGreen, mode, tourTypeFilter); break; case "Total Sorties Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllSorties", Color.DarkMagenta, mode, tourTypeFilter); break; case "Total Landed Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllLanded", Color.Turquoise, mode, tourTypeFilter); break; case "Total Bailed Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllBailed", Color.Salmon, mode, tourTypeFilter); break; case "Total Captured Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllCaptured", Color.MidnightBlue, mode, tourTypeFilter); break; case "Total Death Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllDeath", Color.HotPink, mode, tourTypeFilter); break; case "Total Time Trend": AddSimpleTrendPlot(_pilotName, chosenGraphName, "OverAllTimeInHours", Color.DarkOrchid, mode, tourTypeFilter); break; } }
public SimplePlotter(NPlot.Windows.PlotSurface2D plotSurface, int bufferSize) : base(plotSurface) { m_BufferSize = bufferSize; m_PointBuffer = CircularBuffer<Sample>.Synchronized(bufferSize); LightStoneDevice.Instance.RawOutput.Add(m_PointBuffer); m_BufferWrapper = new BufferWrapper(m_PointBuffer); this.PlotSurface.Clear(); m_LinePlot = new LinePlot(); m_LinePlot.Pen = new Pen(Color.Red, 2.0f); this.PlotSurface.Add(m_LinePlot); this.PlotSurface.Title = "Heart Signal"; this.PlotSurface.XAxis1.Label = "Time"; this.PlotSurface.YAxis1.Label = "Magnitude"; Refresh(); }
public LineGrapher(NPlot.Windows.PlotSurface2D canvas, string y_key, string title, string x_label, string y_label) { containers = new List<VisFileContainer>(); this.y_key = y_key; this.y_label = y_label; this.x_label = x_label; this.title = title; this.canvas = canvas; canvas.Title = title; SetGraphDefaults(this.canvas, title); //F**K YOU, GRID /* Grid grid = new Grid(); grid.VerticalGridType = Grid.GridType.Coarse; grid.HorizontalGridType = Grid.GridType.Coarse; grid.MajorGridPen = new Pen(Color.LightGray, 1.0f); this.canvas.Add(grid); */ }
public void SetBarGraphWidths(NPlot.Windows.PlotSurface2D canvas) { double numBars = (canvas.XAxis1.WorldLength)/(double)this.timeScale[canvas]; foreach (IDrawable drawable in canvas.Drawables) { if (drawable is BarPlot) { BarPlot bp = (BarPlot)drawable; bp.BarWidth = (float)Math.Floor(canvas.Width/(numBars))-4.0f; if (bp.BarWidth < 0) bp.BarWidth = 1.0f; } } canvas.Refresh(); }
public static void SetState(NPlot.Windows.PlotSurface2D graph, MouseState mouseState) { switch(mouseState) { case MouseState.Pan: graph.RemoveInteraction(zoomInteraction); graph.AddInteraction(panInteraction); break; case MouseState.Zoom: graph.RemoveInteraction(panInteraction); graph.AddInteraction(zoomInteraction); break; case MouseState.Pointer: graph.RemoveInteraction(zoomInteraction); graph.RemoveInteraction(panInteraction); break; } }
public static void SetGraphDefaults(NPlot.Windows.PlotSurface2D plot) { // Console.WriteLine("Setting defaults"); // plot.Add(grid); // plot.CacheAxes(); // plot.InteractionOccured += new NPlot.Windows.PlotSurface2D.InteractionHandler(Grapher.zoomRefresh); }
public void Add(IDrawable p, NPlot.PlotSurface2D.XAxisPosition xp, NPlot.PlotSurface2D.YAxisPosition yp) { ps.Add (p, xp, yp); }
private static void SaveSurface(NPlot.Bitmap.PlotSurface2D surface, string path, string plotName) { if (!Directory.Exists(path)) (new System.IO.FileInfo(path)).Directory.Create(); surface.Bitmap.Save(path + plotName + ".bmp"); }
public void ResetGraph(NPlot.Windows.PlotSurface2D graphSurface) { _plots.Clear(); RefreshPlots(graphSurface); }
public static void SetPowerLabels(NPlot.Windows.PlotSurface2D plot) { plot.YAxis1.LabelOffsetAbsolute = true; plot.YAxis1.LabelOffset = 40; plot.XAxis1.HideTickText = false; plot.Title = "Power Dissipation (watts)"; plot.XAxis1.Label = "Time (milliseconds)"; plot.YAxis1.Label = "Average Power (watts)"; }
private static void SetGraphDefaults(NPlot.Windows.PlotSurface2D canvas, string title) { canvas.Padding = 15; canvas.ShowCoordinates = false; canvas.Dock = DockStyle.Fill; canvas.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; canvas.Title = title; }
private void SetAxes(NPlot.Bitmap.PlotSurface2D npSurface, Font AxisFont, Font TickFont) { //X axis npSurface.XAxis1.Label = "Time"; npSurface.XAxis1.NumberFormat = "{0:####0.0}"; npSurface.XAxis1.TicksLabelAngle = 90; npSurface.XAxis1.TickTextNextToAxis = true; npSurface.XAxis1.FlipTicksLabel = true; npSurface.XAxis1.LabelOffset = 110; npSurface.XAxis1.LabelOffsetAbsolute = true; npSurface.XAxis1.LabelFont = AxisFont; npSurface.XAxis1.TickTextFont = TickFont; //Y axis npSurface.YAxis1.Label = this.Title; npSurface.YAxis1.NumberFormat = "{0:####0.0}"; npSurface.YAxis1.LabelFont = AxisFont; npSurface.YAxis1.TickTextFont = TickFont; //Legend definition: NPlot.Legend npLegend = new NPlot.Legend(); npLegend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Right); npLegend.VerticalEdgePlacement = Legend.Placement.Inside; npLegend.HorizontalEdgePlacement = Legend.Placement.Outside; npLegend.BorderStyle = NPlot.LegendBase.BorderType.Line; npLegend.XOffset = -5; npLegend.YOffset = -20; npLegend.BackgroundColor = Color.White; npSurface.Legend = npLegend; //Update PlotSurface: npSurface.Refresh(); }
private void InitPlot(out NPlot.Bitmap.PlotSurface2D npSurface, out Font AxisFont, out Font TickFont, out NPlot.Grid p, int width, int height) { npSurface = new NPlot.Bitmap.PlotSurface2D(width, height); npSurface.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; //Font definitions: AxisFont = new Font("Arial", 10); TickFont = new Font("Arial", 8); //Prepare PlotSurface: npSurface.Clear(); npSurface.Title = this.Title; npSurface.BackColor = System.Drawing.Color.White; //Left Y axis grid: p = new Grid(); npSurface.Add(p, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); }
public void zoomOut(NPlot.Windows.PlotSurface2D plot) { double xLen = plot.XAxis1.WorldMax - plot.XAxis1.WorldMin; double newMinX = plot.XAxis1.WorldMin - xLen * 0.5; double newMaxX = plot.XAxis1.WorldMax + xLen * 0.5; if (newMinX < 0) { newMinX = 0; } if (newMaxX > this.maxValue[plot]) { newMaxX = this.maxValue[plot]; } plot.XAxis1.WorldMax = newMaxX ; plot.XAxis1.WorldMin = newMinX; if (!timeScale.ContainsKey(plot)) { computeBarGraphTimeScales(); } this.SetBarGraphWidths(plot); plot.Refresh(); }
public void plot_nplot(out NPlot.Gtk.PlotSurface2D graph ) { DateTime dt = DateTime.Now; int __width_factor = 45; int __graph_width = _c_device_logfile_entries.Count * __width_factor; NPlot.Gtk.PlotSurface2D _graph = new NPlot.Gtk.PlotSurface2D (); _graph.SetSizeRequest ( __graph_width, 500); _graph.ModifyBg (StateType.Normal, cutil.get_light_grey()); Bitmap _graphBitmap = new Bitmap (1000, 500); DateTimeAxis x = new DateTimeAxis (); LinearAxis y = new LinearAxis (-50, 0); x.SmallTickSize = 10; x.LargeTickStep = new TimeSpan (0, 30, 0); x.NumberFormat = "hh:mm"; _graph.PlotBackImage = _graphBitmap; _graph.YAxis1 = y; _graph.XAxis1 = x; _graph.XAxis1.Label = _XAxisLabel; _graph.XAxis1.AutoScaleTicks = false; _graph.YAxis1.Label = _YAxisLabel; _linePlot.AbscissaData = _ar_x_axis_data; _linePlot.OrdinateData = _ar_y_axis_data; _linePlot.Label = _title; _linePlot.ShowInLegend = true; _linePlot.Pen.Width = 2.5f; _linePlot.Color = Color.Orange; _linePlotLegend.AttachTo ( NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Left); _linePlotLegend.VerticalEdgePlacement = NPlot.Legend.Placement.Inside; _linePlotLegend.HorizontalEdgePlacement = NPlot.Legend.Placement.Outside; _linePlotLegend.BorderStyle = LegendBase.BorderType.Shadow; _linePlotLegend.YOffset = -10; _linePlotLegend.XOffset = -5; _graph.Legend = _linePlotLegend; _graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; NPlot.Grid grid = new Grid (); grid.HorizontalGridType = Grid.GridType.Fine; grid.VerticalGridType = Grid.GridType.Fine; _graph.Add (grid, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); _graph.Add (_linePlot); _graph.QueueDraw (); graph = _graph; }
private void AttachLegend(NPlot.Windows.PlotSurface2D surf) { Legend leg = new Legend(); leg.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Right); leg.HorizontalEdgePlacement = Legend.Placement.Inside; leg.VerticalEdgePlacement = Legend.Placement.Outside; leg.XOffset = 10; leg.YOffset = 10; surf.Legend = leg; surf.LegendZOrder = 10; }
/// <summary> /// Adds a drawable object to the plot surface against the specified axes. If /// the object is an IPlot, the PlotSurface2D axes will also be updated. /// </summary> /// <param name="p">the IDrawable object to add to the plot surface</param> /// <param name="xp">the x-axis to add the plot against.</param> /// <param name="yp">the y-axis to add the plot against.</param> /// <param name="zOrder">The z-ordering when drawing (objects with lower numbers are drawn first)</param> public void Add( IDrawable p, NPlot.PlotSurface2D.XAxisPosition xp, NPlot.PlotSurface2D.YAxisPosition yp, int zOrder ) { ps_.Add( p, xp, yp , zOrder); }
public void RefreshPlots(NPlot.Windows.PlotSurface2D graphSurface) { graphSurface.Clear(); if (_plots.Count == 0) { graphSurface.Hide(); return; } foreach (XYData plot in _plots) { LinePlot lp = new LinePlot(); lp.Color = plot.PlotColour; lp.AbscissaData = plot.xData; lp.OrdinateData = plot.yData; lp.Label = plot.PlotName; graphSurface.Add(lp); } graphSurface.Title = "Pilot Trends"; Grid grid = new Grid(); grid.VerticalGridType = Grid.GridType.Fine; grid.HorizontalGridType = Grid.GridType.Fine; grid.MajorGridPen = new Pen(Color.LightGray, 0.5f); graphSurface.Add(grid); graphSurface.Refresh(); Legend leg = new Legend(); leg.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Right); leg.HorizontalEdgePlacement = Legend.Placement.Inside; leg.VerticalEdgePlacement = Legend.Placement.Outside; leg.XOffset = 10; leg.YOffset = 10; graphSurface.Legend = leg; graphSurface.LegendZOrder = 10; graphSurface.YAxis1.WorldMin = 0; graphSurface.XAxis1.Label = "Tour Number"; graphSurface.XAxis1.WorldMin -= 1; graphSurface.XAxis1.WorldMax += 1; graphSurface.Show(); graphSurface.Refresh(); }