Can be used to remove, modify, and change the order of both custom and default legend items. Custom items can also be added to the legend.
Legend items collection.
Visual Basic (Declaration) | |
---|---|
Public ReadOnly Property LegendItems As LegendItemsCollection |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public LegendItemsCollection LegendItems {get;} |
Return Value
A LegendItemsCollection object.
Visual Basic | Copy Code |
---|---|
Imports Dundas.Charting.WebControl<CRLF>...<CRLF> <CRLF>Private Sub Chart1_CustomizeLegend(ByVal chart As Chart, ByVal e As CustomizeLegendEventArgs) Handles Chart1.CustomizeLegend<CRLF><CRLF> ' declare a LegendItem object<CRLF> Dim legendItem As LegendItem<CRLF> For Each legendItem In e.LegendItems<CRLF> If legendItem.SeriesName = "Sales" Then<CRLF> legendItem.Color = Color.Red<CRLF> End If<CRLF> Next<CRLF> <CRLF>End Sub |
This property allows for the deletion and customization of both default and custom legend items in the CustomizeLegend event. It can also be used to add custom legend items, and the order of legend entries can also be changed.
Note that the LegendItem.SeriesName and LegendItem.SeriesPointIndex properties can be used to determine the data element that a default legend item is associated with. These properties will be zero-length strings for custom items since custom items are not associated with chart data.
This property allows for the determination of the Legend that the event was raised for, enabling the customization of an individual Legend.
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family