- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在我的窗口窗体中放置一个 OxyPlot 图,并绘制函数 y = 2x - 7
。我已经下载了 OxyPlot 并将引用添加到我的项目中。我使用以下代码将绘图添加到我的表单中:
public partial class GraphForm : Form
{
public OxyPlot.WindowsForms.Plot Plot;
public Graph()
{
InitializeComponent();
Plot = new OxyPlot.WindowsForms.Plot();
Plot.Model = new PlotModel();
Plot.Dock = DockStyle.Fill;
this.Controls.Add(Plot);
Plot.Model.PlotType = PlotType.XY;
Plot.Model.Background = OxyColor.FromRgb(255, 255, 255);
Plot.Model.TextColor = OxyColor.FromRgb(0, 0, 0);
}
}
通过这段代码,我看到了白色背景,控件已经创建,但它只是一个白色背景。我查看了 OxyPlot.Plot
类的成员,但找不到绘制方程式的方法。如何在图表中绘制方程式?
最佳答案
您需要添加一些数据来显示,您将其添加到 Models Series 属性中。
线 (X,Y) 图示例。
public Graph()
{
InitializeComponent();
Plot = new OxyPlot.WindowsForms.Plot();
Plot.Model = new PlotModel();
Plot.Dock = DockStyle.Fill;
this.Controls.Add(Plot);
Plot.Model.PlotType = PlotType.XY;
Plot.Model.Background = OxyColor.FromRGB(255, 255, 255);
Plot.Model.TextColor = OxyColor.FromRGB(0, 0, 0);
// Create Line series
var s1 = new LineSeries { Title = "LineSeries", StrokeThickness = 1 };
s1.Points.Add(new DataPoint(2,7));
s1.Points.Add(new DataPoint(7, 9));
s1.Points.Add(new DataPoint(9, 4));
// add Series and Axis to plot model
Plot.Model.Series.Add(s1);
Plot.Model.Axes.Add(new LinearAxis(AxisPosition.Bottom, 0.0, 10.0));
Plot.Model.Axes.Add(new LinearAxis(AxisPosition.Left, 0.0, 10.0));
}
这个例子:
关于c# - 在 Windows 窗体中渲染 OxyPlot 图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14391195/
我有一个 oxyplot 图,它偶尔会抛出异常并将其显示给我的用户,但它不会冒泡到我的应用程序。有没有办法附加到抛出此异常时发生的事件?或者通过其他方式冒泡异常,以便我可以看到它是什么并适本地处理它?
我正在使用 OxyPlot 导出绘图。 当我导出它们时,我想为这些图添加一个页脚,其中包含保存路径、时间戳等信息... 现在,我通过在不同的位置层上创建一个额外的 X 轴,然后将所有刻度和标签的大小设
我在 Oxyplot 热图小部件的边缘看到了空间。我想让 X0、X1、Y0、Y1 绘制在热图 Canvas 的最边缘,即没有边距和填充。 OxyPlot 的 HeatMapSeries 如何做到这一点
我对 OxyPlot 有如下问题: 我创建了一个新的 PlotView 并在我的程序启动时附加了一个带有一些轴的 PlotModel。 在我的程序中,用户可以打开一个文件,该文件在 PlotView
我一直在将 OxyPlot 用于我目前正在进行的项目之一,并且效果非常好。但是,我一直无法解决在一个窗口中绘制多个图形的问题。我的目标是能够做类似 this 的事情. 我当前的单图看起来像 this
有谁知道如何更改氧绘图上分割标记的颜色?我似乎无法在任何地方找到该特定属性。这是我用来生成下图的代码。如您所见,分割标记是黑色的。真想换个颜色。谢谢。 最佳答案 您要查
我正在为 WPF 寻找一个简单、免费的图表控件。经过一番阅读(例如 WPF chart controls ),我查看了 OxyPlot:http://oxyplot.codeplex.com/ 它看起
我正在寻找 oxyplot 已经实现的所有快捷方式功能的列表! 像 A == 重置Ctrl + 鼠标左键...等。 最佳答案 我猜这个文档就是您正在寻找的内容,但它目前标有“TODO”,所以可能不完整
我想用 oxyplot 绘制如下图所示的图表,问题是我不知道如何在值 50 处绘制轴(带值)。 代码: var model = new PlotModel { Title = "Ell
有没有办法管理图例中的项目?我的意思是从图例中删除一些项目而不是从整个情节中删除?我知道情节中的每个系列都与图例中的一个项目相关联,但我想打破这个规则,只将选定的系列放到图例中。 感谢您的请求。 最佳
最近我一直在使用 OxyPlot 库制作一些图表。我想知道我是否可以为每个矩形制作一个带有注释的热图。期待答案。 最佳答案 我终于发现我需要创建一个新类并扩展热图系列并覆盖 RenderLabels
AutoScale OxyPlot 图表。例如我有这样的东西。 using OxyPlot; using OxyPlot.Axes; using System; using System.Collec
当缩小图表时,蜡烛开始与另一根蜡烛重叠。 例如 轴 DateTimeAxis timeSPanAxis1 = new DateTimeAxis() {
我想对 LineSeries 执行一个简单的仿射变换 不幸的是我不能简单地这样做: foreach (var point in myLineSeries.Points) { point.X =
我想使用 OXYPLOT 库添加多个具有共享 x 轴的绘图。示例代码如下,设置了4个不同的y轴共享同一个x轴。但是我只能在第一个 x&y 轴上绘制数据,而不能在其他轴上绘制数据。任何类型的建议将不胜感
我必须在 WPF 项目中实现一个简单的柱形图输出。我为此选择了 OxyPlot 库。设计模式当然是MVVM。相关源码部分见下。当我运行该项目时,我得到的是一个空图表,x 轴上有类别 1 到 5(这是正
我有一个 WPF 应用程序,我在其中使用 OxyPlot 绘制图表。我不断地向图表中的线系列添加点。 X 轴是一个日期时间轴,其间隔类型设置为秒。点被连续添加到线系列中。当第一个点和最后一个点之间的时
我想创建一个没有任何轴可见的 Oxyplot View 。 谁能告诉我怎么做? 为避免误解,我从未向绘图模型添加任何轴。 这段代码已经添加了坐标轴。如何避免显示它们? C# plot
我正在为我的 Xamarin.iOS 项目使用 Oxyplot 来绘制条形图 这是我目前的情节 这里我需要隐藏右轴和上轴 我试过了: model.Axes.Add(new LinearAxis() {
我想在具有对数 y 尺度的柱状图中可视化 1024 个值。使用线性标度它工作正常,但是使用对数标度图形看起来很奇怪。我的代码或 oxyplot 中是否存在错误? 我的主干图是这样的: reversed
我是一名优秀的程序员,十分优秀!