RadChart Series Label Formatting

Thread is closed for posting
2 posts, 0 answers
  1. grant
    grant avatar
    1 posts
    Member since:
    Nov 2010

    Posted 08 Apr 2011 Link to this post

    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.

  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 14 Apr 2011 Link to this post

    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.

Back to Top