【问题标题】:Line graph using Oxyplot Visual studio C#使用 Oxyplot Visual Studio C# 的折线图
【发布时间】:2020-10-18 21:13:38
【问题描述】:

我正在努力获得一个简单的折线图作为输出。 Oxyplot 的所有工具都不在我的工具栏中。

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);

如何在 Visual Studio 的工具栏中添加 Oxyplot 命令?

【问题讨论】:

  • 请说清楚你的问题是什么。
  • 我在 Visual Studio 的工具箱中找不到任何 oxyplot 组件
  • 这是 WPF 吗?什么平台?

标签: c# oxyplot


【解决方案1】:

遇到了同样的问题,终于找到了解决方案(针对 WPF):

(可能同样适用于 WinForms)


  1. 在您的项目树中的“../packages”中的某处找到 OxyPlot DLL,并将 OxyPLot.dll 和 OxyPlot.Wpf.dll 复制到 同一个 文件夹(例如“../packages/OxyPlot_Wpf”)。

  2. 然后,在解决方案资源管理器中,删除 NuGet 的引用 之前创建的,然后添加对复制的 DLL 的引用。

  3. 最后,在 Toolbox 中新建一个选项卡并拖动 OxyPlot.Wpf.dll 从文件资源管理器中拖放到创建的选项卡上。


您现在应该会看到大约三打 OxyPlot 控件。

here 的答案为我指明了正确的方向。

欢呼, 铝

【讨论】:

    【解决方案2】:

    如果你使用 WPF:

    如果要在设计视图中添加 Plot 控件,请在工具箱中按选择项...并浏览 OxyPlot.Wpf.dll 文件。如果您使用 NuGet,它应该位于解决方案文件夹中的 packages 文件夹中。

    【讨论】:

    • 域名已失效,链接指向错误内容,请修复或删除。
    猜你喜欢
    • 2015-05-04
    • 1970-01-01
    • 2014-02-28
    • 1970-01-01
    • 1970-01-01
    • 2021-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多