Currently, I can draw stripe lines on the chart but there is some error when I want to draw on the line of the x/ y-axis but it cannot be drawn.
There is no error for the drawing stripline as there is no message box pop up but still nothing gets drawn.
try
{
StripLine stripLine6 = new StripLine();
stripLine6.StripWidth = 0;
stripLine6.BorderColor = System.Drawing.Color.Green;
stripLine6.BorderWidth = 4;
stripLine6.BorderDashStyle = ChartDashStyle.DashDotDot;
stripLine6.IntervalOffset = Convert.ToDouble(textBox12.Text);
stripLine6.BackColor = System.Drawing.Color.Orange;
stripLine6.Text = "x̅";
chart2.ChartAreas[0].AxisY.StripLines.Add(stripLine6);
}
catch
{
MessageBox.Show("Error for Stripline 6 to be drawn");
}
It looks as if the combination of
StripWidth = 0;
and
IntervalOffset = 0;
results in the whole Stripline not being drawn at all.
Could be a bug, as per MSDN:
StripLine.StripWidth Property
A setting of 0.0 will result in a line being drawn; this line will use the BorderColor, BorderDashStyle and BorderWidth property settings for its color, width and style. None of the Back* properties in this class are utilized when the value of StripWidth is 0.0.
To workaround you can set either to a positive value:
StripWidth = 0.001;
or
IntervalOffset= 0.001;