我可以在LineSeries图上绘制垂直线吗?

时间:2019-04-08 02:32:13

标签: c# wpf oxyplot

我正在使用一些OxyPlot图进行应用。

我想制作一个在LineSeries Graph上具有垂直线的图形,如下所示:

http://theclosetentrepreneur.com/how-to-add-a-vertical-line-to-an-excel-xy-chart

(我的理想图像是“格式化图表的提示…”。)

如何制作这张图?

1 个答案:

答案 0 :(得分:2)

您可以为此使用LineAnnotation。例如,

var annotation = new LineAnnotation();
annotation.Color = OxyColors.Blue;
annotation.MinimumY = 10;
annotation.MaximumY = 40;
annotation.X = 5;
annotation.LineStyle = LineStyle.Solid;
annotation.Type = LineAnnotationType.Vertical;
MyPlotModel.Annotations.Add(annotation);

样本输出

enter image description here