简体   繁体   中英

Line graph using Oxyplot Visual studio C#

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?

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 (eg "../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

If you use WPF:

If you want to add a Plot control in the design view, press Choose Items... in the Toolbox and browse for the OxyPlot.Wpf.dll file. If you used NuGet, it should be located in the packages folder in your solution folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM