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

RadChart Series Label Formatting

1 Answer 467 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
grant
Top achievements
Rank 1
grant asked on 08 Apr 2011, 05:25 PM

I have been able to programmatically apply formatting to both the XAxis and YAxis (although not successfully for every chart), however, I am unable to figure out how to format the series labels.
For example, I have used the following, which has zero effect upon the series labels - regardless of what is provided in the DefaultLabelValue parameter:

<telerik:ChartSeries DataYColumn="TotalCost" Type="Line" Name="TotalCost" DataLabelsColumn="TotalCost" DefaultLabelValue="#Y{C}">

Nor do any of my codebehind (located within the ItemDataBound event) attempts:

RadChart_ProjectTrends_Costs.PlotArea.Chart.Series[0].DefaultLabelValue

the .Appearance.CustomFormat parameter applies to Style.Axis, and not Chart.Series

Any advice on how to apply *any* formatting to databound values in RadChart would be greatly, greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 14 Apr 2011, 08:18 AM
Hello grant,

The following code snippet shows how to create Bar Chart with DataTable as datasource and set percentage format for Series Items Labels:
DataTable table = new DataTable();
     table.Columns.Add(new DataColumn("Value", typeof(int)));
     table.Rows.Add(new object[] { 10});
     table.Rows.Add(new object[] { 20 });
     table.Rows.Add(new object[] { 30 });
     ChartSeries chartSeries1 = new ChartSeries();
     chartSeries1.DataYColumn = "Value";
     chartSeries1.DefaultLabelValue = "#Y%";
     chartSeries1.Type = Telerik.Charting.ChartSeriesType.Bar;
     RadChart1.AddChartSeries(chartSeries1);
     RadChart1.DataSource = table;
     RadChart1.DataBind();

DefaultLabelValue property specifies a format for label values that will be displayed automatically if you do not specifically assign text to a chart series item. This is described in our help topic.

Kind regards,
Evgenia
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Chart (Obsolete)
Asked by
grant
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or