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

Position Labels in CodeBehind

5 Answers 69 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
IT
Top achievements
Rank 1
IT asked on 09 Jun 2009, 09:30 AM
Hi Folks - Just wanted to know how you go about positioning the value labels of a chart in code behind.

i know you can position them in design view but i really want to position them all in code behind
i would need hem positioned in the middle of the bar if possible.


Thanks Folks

5 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 11 Jun 2009, 02:04 PM
Hi Brian,

I assume you are talking for the series labels. Here is a sample code:
series.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside; 
series.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Center; 

Let me know if those are not the labels you want to position but, please, specify to which labels you refer.

Best,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
IT
Top achievements
Rank 1
answered on 12 Jun 2009, 08:27 AM
Hi Evrim,

Thanks for the reply

that looks about right but not sure how to use it?

can you give me an example?

0
Accepted
Dwight
Telerik team
answered on 15 Jun 2009, 07:20 AM
Hello Brian,

Here is a sample usage in Page_Load:
protected void Page_Load(object sender, EventArgs e) 
    // In this case, we use SqlDataSource to fill in the chart 
    this.RadChart1.DataSource = SqlDataSource1; 
    this.RadChart1.DataBind(); 
 
    foreach(Series series in this.RadChart1.Series) 
    { 
        series.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;  
        series.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Center; 
    } 

Best,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
IT
Top achievements
Rank 1
answered on 15 Jun 2009, 01:57 PM
Hi there,

thanks for the quick reply.

what namespace is 'series' in?


Regards,


0
Dwight
Telerik team
answered on 17 Jun 2009, 05:51 AM
Hi Brian,

Here is the foreach statement again, including the namespace:
foreach(Telerik.Charting.ChartSeries series in radChart1.Series) 
  ... 

All the best,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Chart (Obsolete)
Asked by
IT
Top achievements
Rank 1
Answers by
Dwight
Telerik team
IT
Top achievements
Rank 1
Share this question
or