Series Item Label Font in Chart

2 posts, 0 answers
  1. Joel
    Joel avatar
    165 posts
    Member since:
    Oct 2006

    Posted 08 Mar 2012 Link to this post

    I can't find this anywhere.  Your help is appreciated.

    I want to change the font and color of the series item label in my chart.  The properties all seem to be exposed as I have changed every font in the chart so far except this label.

    I have tried it several different ways in the code behind as well with no luck.

    I can go in and set it via properties, series collection, items but that does not display in the report (just the VS preview).  I am databinding in the code behind in new:    Chart1.DataSource = _ds.Tables(0) 

    Suggestions greatly appreciated.

    Private Sub Chart1_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles Chart1.ItemDataBound
        Chart1.Series(1).Appearance.TextAppearance.TextProperties.Color = Color.Red
        Dim myseries As ChartSeries
        Dim myitem As ChartSeriesItem
        For Each myseries In Chart1.Series
            myseries.Appearance.TextAppearance.TextProperties.Color = Color.Red
            For Each myitem In myseries.Items
                myitem.Label.TextBlock.Appearance.TextProperties.Color = Color.Red
                myitem.Label.TextBlock.Text = "xxxx"
    End Sub
  2. Steve
    Steve avatar
    10941 posts

    Posted 09 Mar 2012 Link to this post

    Hi Joel,

    This is a known limitation of the chart item, whenever you bind it via the DataSource property, you cannot alter some of its styles/formattings. Additionally the ItemDataBound event of the chart item is too late to do this and this event is not the same as in the RadChart for ASP.NET AJAX control, such changes can be done latest in the NeedDataSource event. The solution is to create and bind the chart manually which gives you full control over it. For a sample code snippet please refer to the Data Binding Chart to a Generic List of Objects.

    the Telerik team
    NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
  3. DevCraft R3 2016 release webinar banner
Back to Top