C# 未显示Oxyplot线性注释
我将Oxyplot与WPF和C一起使用# 我不熟悉Oxyplot,并试图了解如何使用线性注释 我想在plotmodel中添加两个线性注释,一个垂直,另一个水平 我的问题是只显示水平线注释(注释2),而不显示垂直线注释 代码如下:C# 未显示Oxyplot线性注释,c#,oxyplot,C#,Oxyplot,我将Oxyplot与WPF和C一起使用# 我不熟悉Oxyplot,并试图了解如何使用线性注释 我想在plotmodel中添加两个线性注释,一个垂直,另一个水平 我的问题是只显示水平线注释(注释2),而不显示垂直线注释 代码如下: var annotation = new LineAnnotation(); annotation.Color = OxyColors.Blue; annotation.LineStyle = LineStyle.Solid; annotation.StrokeThi
var annotation = new LineAnnotation();
annotation.Color = OxyColors.Blue;
annotation.LineStyle = LineStyle.Solid;
annotation.StrokeThickness = 5;
annotation.X = 0;
annotation.Type = LineAnnotationType.Vertical;
Model.Annotations.Add(annotation);
//this works
var annotation2 = new LineAnnotation();
annotation2.Color = OxyColors.Blue;
annotation2.LineStyle = LineStyle.Solid;
annotation2.StrokeThickness = 5;
annotation2.Y = 0;
annotation2.Type = LineAnnotationType.Horizontal;
Model.Annotations.Add(annotation2);
Model.InvalidatePlot(true);
垂直批注未显示的原因可能是什么?看起来您的批注位于轴之外。请确保定义了轴,以便注释在其中对齐 以下声明将确保注释(上面声明)与轴处于相同的位置
Model.Axes.Add(new OxyPlot.Axes.LinearAxis
{
Position = Axes.AxisPosition.Bottom,
Minimum = 0
});
Model.Axes.Add(new OxyPlot.Axes.LinearAxis
{
Position = Axes.AxisPosition.Left,
Minimum = 0
});
看起来注释位于轴之外。请确保定义了轴,以便注释在其中对齐 以下声明将确保注释(上面声明)与轴处于相同的位置
Model.Axes.Add(new OxyPlot.Axes.LinearAxis
{
Position = Axes.AxisPosition.Bottom,
Minimum = 0
});
Model.Axes.Add(new OxyPlot.Axes.LinearAxis
{
Position = Axes.AxisPosition.Left,
Minimum = 0
});