This documentation is archived and is not being maintained.

Chart.CustomizeLegend Event

Occurs just before the chart legend is drawn. Use this event to customize the chart legend items.

Namespace:  System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)

public event EventHandler<CustomizeLegendEventArgs> CustomizeLegend
<asp:Chart OnCustomizeLegend="EventHandler" />

The CustomizeLegend event is primarily used to customize the legend just before it is drawn. Both default and custom legend items can be removed or modified, and custom items can also be added. In addition, the order of legend items can be changed.

The chart image can also be modified before being drawn by using the sender argument.

Note that a default legend item is an item that is created for either a data series or data point, but a custom legend item is not connected in any way to the chart data.

.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.