Skip to content

Commit 9dfdf23

Browse files
committed
add simple bar graph
1 parent 7889c67 commit 9dfdf23

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

examples/plotting/scottplot/ScottPlotQuickstart/Form1.Designer.cs

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/plotting/scottplot/ScottPlotQuickstart/Form1.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,25 @@ private void LineButton_Click(object sender, EventArgs e)
8484
formsPlot1.plt.YLabel("Vertical Axis Label");
8585
formsPlot1.Render();
8686
}
87+
88+
private void SimpleBar_Click(object sender, EventArgs e)
89+
{
90+
// generate some random Y data
91+
int pointCount = 5;
92+
double[] xs = ScottPlot.DataGen.Consecutive(pointCount);
93+
double[] ys = ScottPlot.DataGen.RandomWalk(rand, pointCount, mult: 50, offset: 100);
94+
95+
// plot the data
96+
formsPlot1.Reset();
97+
formsPlot1.plt.PlotBar(xs, ys);
98+
99+
// additional styling
100+
formsPlot1.plt.Title("Simple Bar Graph");
101+
formsPlot1.plt.XLabel("Horizontal Axis Label");
102+
formsPlot1.plt.YLabel("Vertical Axis Label");
103+
formsPlot1.plt.Legend(location: ScottPlot.legendLocation.upperLeft);
104+
formsPlot1.plt.Axis(y1: 0);
105+
formsPlot1.Render();
106+
}
87107
}
88108
}

0 commit comments

Comments
 (0)