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

问题描述 投票:0回答:1

我正在使用一些OxyPlot Graphs制作应用程序。

我想在LineSeries图上创建一个垂直线的图形,如下链接:

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

(我的理想形象出现在“关于格式化图表的提示......”中。)

我该如何制作这张图?

c# wpf oxyplot
1个回答
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

© www.soinside.com 2019 - 2024. All rights reserved.