public Form1() { InitializeComponent(); // add this manually because the .NET winforms designer is still in preview mode // and the FormsPlot user control typically does not appear in the toolbox formsPlot1 = new ScottPlot.FormsPlot() { Dock = DockStyle.Fill }; Controls.Add(formsPlot1); var xs = new double[] { 1, 2, 3, 4, 5 }; var ys = new double[] { 1, 4, 9, 16, 25 }; formsPlot1.plt.AddScatter(xs, ys); var vline = formsPlot1.plt.AddVerticalLine(3.5); vline.LineWidth = 3; vline.DragEnabled = true; vline.Dragged += new EventHandler(OnDragLine); var vspan = formsPlot1.plt.AddVerticalSpan(10, 20); vspan.DragEnabled = true; vspan.Dragged += new EventHandler(OnDragSpan); formsPlot1.Render(); }
private void Form1_Load(object sender, EventArgs e) { var xs = new double[] { 1, 2, 3, 4, 5 }; var ys = new double[] { 1, 4, 9, 16, 25 }; formsPlot1.plt.PlotScatter(xs, ys); formsPlot1.Render(); }
/// <summary> /// Initialize <see cref="ScottPlot.Plot"/> object. /// </summary> /// <param name="formsPlot">Where to fit the fig to.</param> /// <param name="labelTitle">Fig label.</param> /// <param name="labelX">X axis label.</param> /// <param name="labelY">Y axis label.</param> /// <returns></returns> private ScottPlot.Plot PlotInitialize(ScottPlot.FormsPlot formsPlot, string labelTitle, string labelX, string labelY) { ScottPlot.Plot plt = formsPlot.plt; plt.Grid(enable: false); plt.Style(figBg: Color.Transparent, dataBg: Color.White); plt.Title(labelTitle); plt.XLabel(labelX); plt.YLabel(labelY); plt.Axis(null, null, 0, null); formsPlot.Render(); return(plt); }
public Form1() { InitializeComponent(); // add this manually because the .NET winforms designer is still in preview mode // and the FormsPlot user control typically does not appear in the toolbox formsPlot1 = new ScottPlot.FormsPlot() { Dock = DockStyle.Fill }; Controls.Add(formsPlot1); double[] ys = { 200, 150, 1100, 100, 125, 175, 125, 450, 250, 1000, 150, 450, 50, 50, 200, 400, 150, 100 }; double[] xs = ScottPlot.DataGen.Consecutive(ys.Length); formsPlot1.plt.AddFillAboveAndBelow(xs, ys, 200); formsPlot1.Render(); }