我正在使用一些 OxyPlot 图表制作一个应用程序。
\n\n我想制作一个在 LineSeries 图表上有一条垂直线的图表,如下链接:
\n\nhttp://theclosetentrepreneur.com/how-to-add-a-vertical-line-to-an-excel-xy-chart
\n\n(我的理想图像位于“格式化图表的提示\xe2\x80\xa6”中。)
\n\n我怎样才能制作这个图表?
\n您可以使用 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)
样本输出