I’m building a Column chart with System.Web.UI.DataVisualization.Charting and would like to show a dotted line to represent an average. StripeLine seems to be exactly what I’m looking for except it sits under/behind the columns (see example).
Is there a way to adjust the “Z-Index” of a StripeLine so that it is shown in front of/on top of the Series?
I don’t see a property for this and changing the order I add the Series and StripeLine doesn’t make a difference.

Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You can use Annotations
double avg = Chart1.Series[0].Points.Average(p => p.XValue); double lineHeight = avg; HorizontalLineAnnotation ann = new HorizontalLineAnnotation(); ann.AxisX = Chart1.ChartAreas[0].AxisX; ann.AxisY = Chart1.ChartAreas[0].AxisY; ann.IsSizeAlwaysRelative = false; ann.AnchorY = lineHeight; ann.IsInfinitive = true; ann.ClipToChartArea = Chart1.ChartAreas[0].Name; ann.LineColor = Color.Red; ann.LineWidth = 3; Chart1.Annotations.Add(ann);
HTML Code
<asp:Chart runat="server" ID="Chart1" ImageStorageMode="UseImageLocation" Width="800px" Height="400px" OnClick="Chart1_Click">
<ChartAreas >
<asp:ChartArea></asp:ChartArea>
</ChartAreas>
<series>
<asp:Series Name="Students" BorderColor="180, 26, 59, 105">
<Points>
<asp:DataPoint AxisLabel="jon" XValue="5" YValues="4" />
<asp:DataPoint AxisLabel="kon" XValue="15" YValues="44" />
<asp:DataPoint AxisLabel="pol" XValue="85" YValues="90" />
</Points>
</asp:Series>
</series>
</asp:Chart>
Code for Text Annotation
TextAnnotation txtAnn = new TextAnnotation(); txtAnn.AxisX = Chart1.ChartAreas[0].AxisX; txtAnn.AxisY = Chart1.ChartAreas[0].AxisY; txtAnn.IsSizeAlwaysRelative = false; txtAnn.AnchorY = lineHeight; txtAnn.AnchorX = Chart1.Series[0].Points.Last().XValue; txtAnn.AnchorAlignment = ContentAlignment.BottomLeft; txtAnn.Text = "DivisionOne(35.5)"; txtAnn.ClipToChartArea = Chart1.ChartAreas[0].Name; txtAnn.ForeColor = Color.Red; Chart1.Annotations.Add(txtAnn);
You can get more information here
More Information About Annotations
Method 2
You can just use the text property of the stripeline
Chart1.ChartAreas(“ChartArea1”).AxisY.StripLines(0).Text = “Line
Title”
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0