Customize Legend Items on RadChart DataTable

Thread is closed for posting
3 posts, 0 answers
  1. Ryan
    Ryan avatar
    8 posts
    Member since:
    Oct 2012

    Posted 20 Nov 2012 Link to this post

    I have a radchart with a dataTable but no legend.  I know it is possible to customize items in the chart legend, but is it possible to customize the legend on the radchart dataTable?  
  2. Nikolay
    Nikolay avatar
    395 posts

    Posted 21 Nov 2012 Link to this post

    Hello Ryan,

    Unfortunately it is not possible to customize the legend items of the RadChart DataTable. Please, excuse us for the inconvenience caused.

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Ed
    Ed avatar
    1 posts
    Member since:
    Nov 2012

    Posted 04 Dec 2012 Link to this post

    There is a way I found to customize the legend, but only for what's displayed.  Let's say you have a Data.DataTable that contains Description and Value fields.  You can customize the legend by creating another column for the legend where you want to show the Description field if they're all <= 10 characters long and the Value if the Description is > 10 characters.

    dt.Columns.Add(New Data.DataColumn("legend"))
    For Each row As Data.DataRow In dt.Rows
      If Len(row.Item("description")) > 10 Then
        blnUseValueForLegend = True
        Exit For
      End If
    If blnUseValueForLegend Then
      For Each row As Data.DataRow In dt.Rows
        row.Item("legend") = row.Item("value").ToString
      For Each row As Data.DataRow In dt.Rows
        row.Item("legend") = row.Item("description").ToString
    End If

    Then, you can say in your chart RadChart1.Series(0).DataLabelsColumn = "legend" and you're done.
    The whole thing is calculated dynamically as run-time.


Back to Top