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

Customize Legend Items on RadChart DataTable

2 Answers 69 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 20 Nov 2012, 11:08 PM
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 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 21 Nov 2012, 07:38 AM
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,
Nikolay
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.
0
Ed
Top achievements
Rank 1
answered on 04 Dec 2012, 07:02 PM
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
Next
If blnUseValueForLegend Then
  For Each row As Data.DataRow In dt.Rows
    row.Item("legend") = row.Item("value").ToString
  Next
Else
  For Each row As Data.DataRow In dt.Rows
    row.Item("legend") = row.Item("description").ToString
  Next
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.

HTH


Tags
Chart (Obsolete)
Asked by
Ryan
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Ed
Top achievements
Rank 1
Share this question
or