//[Test] // this test takes 30s to complete, so don't run it routinely public void Test_Benchmark_Step() { var plt = new ScottPlot.Plot(); int pointCount = 200_000; double[] xs = ScottPlot.DataGen.Consecutive(pointCount); double[] ys = ScottPlot.DataGen.RandomWalk(new Random(0), pointCount); plt.Title($"Scatter Plot ({pointCount.ToString("N0")} points)"); plt.PlotStep(xs, ys); plt.Benchmark(true); // the first render allocates memory for pointF arrays plt.GetBitmap(true); Console.WriteLine($"Render 1: {plt.GetSettings(false).benchmark}"); // subsequent renders re-use the same arrays plt.GetBitmap(true); Console.WriteLine($"Render 2: {plt.GetSettings(false).benchmark}"); string name = System.Reflection.MethodBase.GetCurrentMethod().Name; string filePath = System.IO.Path.GetFullPath(name + ".png"); plt.SaveFig(filePath); Console.WriteLine($"Saved {filePath}"); // 2019-01-26 // Render 1: Full render of 1 object (200,000 points) took 490.078 ms (2.04 Hz) // Render 2: Full render of 1 object (200,000 points) took 454.589 ms (2.20 Hz) <-- 7% faster }
public string Figure_31_Signal_With_Antialiasing_Off() { string name = System.Reflection.MethodBase.GetCurrentMethod().Name.Replace("Figure_", ""); string fileName = System.IO.Path.GetFullPath($"{outputFolderName}/{name}.png"); // A slight performance enhancement is achieved when anti-aliasing is disabled var plt = new ScottPlot.Plot(width, height); plt.Benchmark(); plt.AntiAlias(true, false); plt.PlotSignal(dataSignal, sampleRate: 20_000); plt.SaveFig(fileName); Console.WriteLine($"Saved: {System.IO.Path.GetFileName(fileName)}"); return(name + ":" + ScottPlot.Tools.BitmapHash(plt.GetBitmap())); }
public string Figure_30_Signal() { string name = System.Reflection.MethodBase.GetCurrentMethod().Name.Replace("Figure_", ""); string fileName = System.IO.Path.GetFullPath($"{outputFolderName}/{name}.png"); // PlotSignal is ideal for plotting large arrays of evenly-spaed data at high framerates. // Note that we are testing it here by plotting an array with one million data points. var plt = new ScottPlot.Plot(width, height); plt.Benchmark(); plt.PlotSignal(dataSignal, sampleRate: 20_000); plt.SaveFig(fileName); Console.WriteLine($"Saved: {System.IO.Path.GetFileName(fileName)}"); return(name + ":" + ScottPlot.Tools.BitmapHash(plt.GetBitmap())); }