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_TextRotationAlignment_LowerRight() { var plt = new ScottPlot.Plot(400, 300); int[] rotations = { 0, 90, -90, 180 }; for (int i = 0; i < rotations.Length; i++) { string label = $"Rot{rotations[i]}"; double x = i / 2; double y = i % 2; var txt = plt.AddText(label, x, y); txt.Rotation = rotations[i]; txt.Alignment = ScottPlot.Alignment.LowerRight; txt.Font.Size = 24; plt.AddPoint(x, y, Color.Red, size: 5); } plt.Title("TextAlignment.lowerRight"); plt.AxisAuto(.5, .5); TestTools.SaveFig(plt); }