JohnnyPP wrote at 2012-07-11 23:35:
I would like to make a simple plot in a Windows Forms Application. After pressing a button the plot should be displayed. So far I have done following steps:
1. Created Windows Forms Application project,
2. Added one button that should display the plot,
3. Added OxyPlot Package by choosing Tools->Library Package Manager-> Package Manager Console and printing Install-Package OxyPlot.WindowsForms
4. I chose one Plot from the examples:
public static PlotModel LineSeries()
var plotModel1 = new PlotModel();
plotModel1.LegendSymbolLength = 24;
plotModel1.Title = "LineSeries";
var linearAxis1 = new LinearAxis();
linearAxis1.Position = AxisPosition.Bottom;
var linearAxis2 = new LinearAxis();
var lineSeries1 = new LineSeries();
lineSeries1.Color = OxyColors.SkyBlue;
lineSeries1.MarkerFill = OxyColors.SkyBlue;
lineSeries1.MarkerSize = 6;
lineSeries1.MarkerStroke = OxyColors.White;
lineSeries1.MarkerStrokeThickness = 1.5;
lineSeries1.MarkerType = MarkerType.Circle;
lineSeries1.Title = "Series 1";
End there is my question. I have the code for the button like this:
private void button1(object sender, EventArgs e)
How to use the code from [Example("LineSeries")] in button1?
Any help appreciated.
objo wrote at 2012-07-11 23:43:
You need to add an OxyPlot.WindowsForms.Plot control to your Form.
Then set the Model property of that control to the model provided by your LineSeries method.
JohnnyPP wrote at 2012-07-12 00:17:
Thanks for the answer. In Examples\WindowsForms\WindowsFormsDemo\ I can find only these flies: OxyPlot.dll, OxyPlot.WindowsForms.dll, WindowsFormsDemo.exe and no Form1.cs
objo wrote at 2012-07-13 09:32:
See the "Source code" tab on top of the page
Customer support service by UserEcho