This is a migrated thread and some comments may be shown as answers.

How to draw a reference line on chart?

2 Answers 153 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
kiran
Top achievements
Rank 1
kiran asked on 11 Jun 2008, 08:13 AM
Hi All,

Can any one please tell me how to draw a reference line at a point on Y-axis?like a threshold line at threshold point.

exact requirement:

i need to draw a horizontal reference line parallel to X-axis like suppose at point 3 on y-axis i need to draw a cut-off line which should be parallel to the x-axis like

Y-axis
|
|
|3-----------------------------------------------------
|
|
|
------------------------------------------------------- X-axis 

is this possible? if so please share some sample code.

Thanks in advance.

regards,
kiran


2 Answers, 1 is accepted

Sort by
0
Jane
Top achievements
Rank 1
answered on 12 Jun 2008, 01:58 PM
Hi Kiran,

you can use Scale breaks to implement this feature. I am not sure. you can check with telerik people.

regards,
jane
0
Dwight
Telerik team
answered on 13 Jun 2008, 05:57 AM
Hi Kirian,

There are two approaches I can suggest. The first one is using marked areas:
ChartMarkedZone zone = new ChartMarkedZone("zone 1"); 
zone.ValueStartY = 20d; 
zone.ValueEndY = 20.5d; 
zone.Appearance.FillStyle.MainColor = Color.FromArgb(128, Color.Red); 
this.radChart1.PlotArea.MarkedZones.Add(zone); 

These marked areas, however, show beneath the series. If you require the reference line to be on top of the rest, I suggest adding a line series using the same values for all Items, or adding only two items, but setting their X values:
ChartSeries referenceSeries = new ChartSeries("Reference line", ChartSeriesType.Line, this.radChart1.Series); 
referenceSeries.Items.Add(new ChartSeriesItem(0, 10)); 
referenceSeries.Items.Add(new ChartSeriesItem(4, 10)); 
referenceSeries.Appearance.LabelAppearance.Visible = false
referenceSeries.Appearance.FillStyle.MainColor = Color.Red; 
 
this.radChart1.Series.Add(referenceSeries); 

Should you need further help, do not hesitate to write us back.

Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Chart (obsolete as of Q1 2013)
Asked by
kiran
Top achievements
Rank 1
Answers by
Jane
Top achievements
Rank 1
Dwight
Telerik team
Share this question
or