Reputation: 85
I want to display horizontal line in my chart. So I'm using StripLine but the line did not appear in front of the chart. How can I change this?
This is my code..
.aspx.cs
StripLine stripLine1 = new StripLine();
stripLine1.StripWidth = 0;
stripLine1.BorderColor = System.Drawing.Color.Orange;
stripLine1.BorderWidth = 4;
stripLine1.BorderDashStyle = ChartDashStyle.Solid;
stripLine1.IntervalOffset = 50;
stripLine1.BackColor = System.Drawing.Color.Orange;
Chart1.ChartAreas[0].AxisY.StripLines.Add(stripLine1);
Upvotes: 1
Views: 4113
Reputation: 1610
From the MSDN documentation on strip lines: "Strip lines, or strips, are horizontal or vertical ranges that shade the background of a chart in regular or custom intervals.". It seems that strip lines are always drawn as part of the background of the chart, and as such cannot be drawn in front of data points. You could handle the OnPainting
event of the chart, and draw a horizontal line that way
Upvotes: 1