Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line graph using Oxyplot Visual studio C#

Tags:

c#

oxyplot

I'm struggling to get a simple line graph as an output. All tools of Oxyplot is not in my toolbar.

InitializeComponent();
PlotModel model = new PlotModel();

OxyPlot.WindowsForms.PlotView plot1 = new OxyPlot.WindowsForms.PlotView();     

var lineSeries = new LineSeries();
lineSeries.Points.Add(new DataPoint(0, 0))
lineSeries.Points.Add(new DataPoint(10, 4));
lineSeries.Points.Add(new DataPoint(30, 2));
lineSeries.Points.Add(new DataPoint(40, 12));
model.Series.Add(lineSeries);

How can I have Oxyplot commands in the toolbar in Visual Studio?

like image 810
Thejas B Avatar asked Jan 22 '26 06:01

Thejas B


1 Answers

Had the same problem and finally found a solution (for WPF):

(might similarly work for WinForms)


  1. Locate the OxyPlot DLLs in your project tree somewhere in "../packages" and copy both OxyPLot.dll and OxyPlot.Wpf.dll into the same folder (e. g. "../packages/OxyPlot_Wpf").

  2. Then, in the solution explorer, remove the references which NuGet made before, and add references to the copied DLLs instead.

  3. Finally, create a new tab in the Toolbox and drag OxyPlot.Wpf.dll from the file explorer and drop it on the created tab.


You should see some three dozen OxyPlot controls now.

The answer here pointed me in the right direction.

Cheerio, Al

like image 142
Albert -Al- Hollmann Avatar answered Jan 23 '26 20:01

Albert -Al- Hollmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!