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

sik*_*mtt 2 c# wpf oxyplot

我正在使用一些 OxyPlot 图表制作一个应用程序。

\n\n

我想制作一个在 LineSeries 图表上有一条垂直线的图表,如下链接:

\n\n

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

\n\n

(我的理想图像位于“格式化图表的提示\xe2\x80\xa6”中。)

\n\n

我怎样才能制作这个图表?

\n

Anu*_*wan 5

您可以使用 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);
Run Code Online (Sandbox Code Playgroud)

样本输出

在此输入图像描述