Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CustomizeLegend Event

Chart::CustomizeLegend Event

.NET Framework 4.6 and 4.5

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 {
	void add (EventHandler<CustomizeLegendEventArgs^>^ value);
	void remove (EventHandler<CustomizeLegendEventArgs^>^ value);
}

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.6, 4.5, 4
Show:
© 2015 Microsoft