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

Changing the Legend ItemMarker

1 Answer 56 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Brian Favell
Top achievements
Rank 1
Brian Favell asked on 02 Dec 2010, 03:11 PM

I'm not sure if this is the correct terminology, but I think it's the Legend ItemMarker that I want.  It's the symbol in the legend whether it's a squars, circle, triangle,etc that I want to change the color of programatically.  How do I programatically change the fill color and border of these objects?

The following line of code provides an index out of range error message.
RadChart1.Chart.Legend.Items(0).Appearance.FillStyle.MainColor = Drawing.Color.FromArgb(155, 155, 155)

 

 

 

Thanks,

Brian

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 07 Dec 2010, 10:10 AM
Hi Brian,

You should subscribe to the BeforeLayout event of the chart to be able to change anything relating Legend Item Markers. Then you can easily set Border for your Markers or Color by looping through them like this:

Protected Sub RadChart1_BeforeLayout(sender As Object, e As EventArgs)
    For i As Integer = 0 To RadChart1.Legend.Items.Count - 1
        RadChart1.Legend.Items(i).Marker.Appearance.FillStyle.MainColor = Color.Red
        RadChart1.Legend.Items(i).Marker.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid
        RadChart1.Legend.Items(i).Marker.Appearance.Border.Color = Color.Silver
        RadChart1.Legend.Items(i).Marker.Appearance.Border.Width = 1
    Next
End Sub

Regards,
Evgenia
the Telerik team
Browse the vast support resources we have to jumpstart 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
Brian Favell
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or