public void Test_Axis_FramelessShowsGridLines() { var plt = new ScottPlot.Plot(400, 300); plt.AddSignal(ScottPlot.DataGen.Sin(51)); plt.AddSignal(ScottPlot.DataGen.Cos(51)); plt.Frameless(); // start with default settings var bmp1 = TestTools.GetLowQualityBitmap(plt); //TestTools.SaveFig(bmp1, "1"); // make the grid darker plt.Grid(color: System.Drawing.Color.Black); var bmp2 = TestTools.GetLowQualityBitmap(plt); //TestTools.SaveFig(bmp2, "2"); // measure what changed var before = new MeanPixel(bmp1); var after = new MeanPixel(bmp2); Console.WriteLine($"Before: {before}"); Console.WriteLine($"After: {after}"); Assert.That(after.IsDarkerThan(before)); }
public void Test_Text_Alignment() { ScottPlot.Alignment[] alignments = (ScottPlot.Alignment[])Enum.GetValues(typeof(ScottPlot.Alignment)); var plt = new ScottPlot.Plot(400, 300); for (int i = 0; i < alignments.Length; i++) { double frac = (double)i / alignments.Length; double x = Math.Sin(frac * Math.PI * 2); double y = Math.Cos(frac * Math.PI * 2); var txt = plt.AddText(alignments[i].ToString(), x, y); txt.Alignment = alignments[i]; txt.Font.Color = System.Drawing.Color.Black;; txt.BackgroundColor = System.Drawing.Color.LightSteelBlue; txt.BackgroundFill = true; txt.Rotation = 5; txt.BorderSize = 2; txt.BorderColor = System.Drawing.Color.Navy; plt.AddPoint(x, y, System.Drawing.Color.Black); } plt.Frameless(); plt.Margins(.5, .2); TestTools.SaveFig(plt); }
public void Test_RadarPlot_WithFrame() { var plt = new ScottPlot.Plot(600, 400); double[,] values = { { 78, 83, 84, 76, 43 }, { 100, 50, 70, 60, 90 } }; plt.AddRadar(values); plt.Grid(enable: false); TestTools.SaveFig(plt, "1"); plt.Frameless(false); TestTools.SaveFig(plt, "2"); }
public void Test_Frameless_HasNoFrame() { var plt = new ScottPlot.Plot(600, 400); plt.Style(figureBackground: System.Drawing.Color.Magenta); plt.Grid(false); plt.Frameless(); plt.AddSignal(ScottPlot.DataGen.Sin(51), color: System.Drawing.Color.Gray); plt.Margins(0, 0); var bmp = TestTools.GetLowQualityBitmap(plt); TestTools.SaveFig(bmp); var after = new MeanPixel(bmp); Assert.That(after.IsGray()); }
public void AxisHSpan_Frameless() { var plt = new ScottPlot.Plot(200, 100); plt.Style(dataBackground: System.Drawing.Color.Blue); plt.Style(figureBackground: System.Drawing.Color.Green); plt.AddHorizontalSpan(10, 20, System.Drawing.Color.Magenta); plt.XAxis.Ticks(false); plt.YAxis.Ticks(false); plt.XAxis.Line(false); plt.XAxis2.Line(false); plt.YAxis.Line(false); plt.YAxis2.Line(false); TestTools.SaveFig(plt, "noline"); plt.Frameless(); TestTools.SaveFig(plt, "frameless"); }
public void Test_Pie_Center() { double[] values = { 778, 43, 283, 76, 184 }; string[] labels = { "C#", "JAVA", "Python", "F#", "PHP" }; var plt = new ScottPlot.Plot(800, 300); var pie = plt.AddPie(values); pie.SliceLabels = labels; pie.ShowLabels = false; plt.Legend(); plt.Grid(false); plt.Frameless(); plt.XAxis.Ticks(false); plt.YAxis.Ticks(false); TestTools.SaveFig(plt); }