4
Reply

Drawing line on chart area

Farhan Shariff

Farhan Shariff

Jul 8 2014 12:18 PM
5.2k
I am trying to mark lower and upper value(vertical lines for X axis values) on the graph in my png file 
I am looping this code for different columns ,some columns have values in Nano ,some have whole numbers and some are milli (X axis)
so the stripwidth becomes wider for some and sometimes not drawn . I have to adjust stripwidth accordingly how do I do that.

I am guessing the other way to  do it is using pen. Is it possible to draw line using pen on chart area ,if so how

http://i.imgur.com/eJ2P613.png  This how i want it
http://i.imgur.com/D0KwX1c.png  But for few cases it spreads
 

v1_ lower and v1_upper are the values where the strip has to be drawn


// strip for lower limit
StripLine limit_lower_strip = new StripLine();
limit_lower_strip.Interval = 0;
limit_lower_strip.IntervalOffset = v1_lower;
limit_lower_strip.StripWidth = 0.000001;
limit_lower_strip.BackColor = Color.FromArgb(100, Color.Red);
chart1.ChartAreas[0].AxisX.StripLines.Add(limit_lower_strip);



// strip for upper limit
StripLine upper_lower_strip = new StripLine();
upper_lower_strip.Interval = 0;
upper_lower_strip.IntervalOffset = v1_upper;
upper_lower_strip.StripWidth = 0.000001;
upper_lower_strip.BackColor = Color.FromArgb(100, Color.Red);
chart1.ChartAreas[0].AxisX.StripLines.Add(upper_lower_strip);
 

Answers (4)