Apologies for repeating Don Kirkby's answer, but I have no answer to add a comment.
Using HorizontalLineAnnotation , you can set ClipToChartArea , which will limit the length of the line inside the chart to solve the problem you specified.
ChartArea area = ...; var line = new HorizontalLineAnnotation(); line.IsInfinitive = true;
Assuming your y axis has values ββon a scale from 0..1, you can attach the line to the Y axis with line.AxisY = area.AxisY
, which causes its position to be interpreted as the axis value, and then set line.Y = 0.8;
for attaching in position 80%.
source share