Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

LegendItem Class

Represents a legend item, which is stored in the LegendItemsCollection class.

Namespace:  System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)
public class LegendItem : ChartNamedElement, IChartMapArea

The LegendItem type exposes the following members.

  NameDescription
Public methodLegendItem()Initializes a new instance of the LegendItem class.
Public methodLegendItem(String, Color, String)Initializes a new instance of the LegendItem class with the specified name, color and image path.
Top
  NameDescription
Public propertyBackGradientStyleGets or sets the orientation for the background gradient of a legend item. Also determines whether a gradient is used.
Public propertyBackHatchStyleGets or sets the hatching style of a legend item.
Public propertyBackImageTransparentColorGets or sets a color which will be replaced with a transparent color when the background image is drawn.
Public propertyBackSecondaryColorGets or sets the secondary color of a legend item.
Public propertyBorderColorGets or sets the border color of a legend item.
Public propertyBorderDashStyleGets or sets the border style of a legend item.
Public propertyBorderWidthGets or sets the border width of a legend item.
Public propertyCellsGets the collection of cells in the legend item.
Public propertyColorGets or sets the color of a legend item.
Public propertyEnabledGets or sets a flag that indicates whether the legend item is enabled.
Public propertyImageGets or sets the image that will be displayed for a legend item symbol.
Public propertyImageStyleGets or sets the display style of the legend item image.
Public propertyLegendGets or sets the Legend object associated with this legend item.
Public propertyMapAreaAttributesGets or sets the map area attributes of a legend item.
Public propertyMarkerBorderColorGets or sets the border color of the markers, if used.
Public propertyMarkerBorderWidthGets or sets the border width of the markers, if used. Measured in pixels.
Public propertyMarkerColorGets or sets the color of the markers, if used.
Public propertyMarkerImageGets or sets a marker image.
Public propertyMarkerImageTransparentColorGets or sets a color that will be replaced with a transparent color when the marker image is drawn.
Public propertyMarkerSizeGets or sets the size of the legend item markers, if used.
Public propertyMarkerStyleGets or sets a legend item marker style. Also used to enable or disable the display of markers.
Public propertyNameGets or sets the name of the legend item. (Overrides ChartNamedElement.Name.)
Public propertyPostBackValueGets or sets the postback value which can be processed on a Click event.
Public propertySeparatorColorGets or sets the color of the legend item separator.
Public propertySeparatorTypeGets or sets the separator style of the legend item.
Public propertySeriesNameGets or sets the name of the Series associated with a default legend item.
Public propertySeriesPointIndexGets or sets the index of a DataPoint object associated with a default legend item.
Public propertyShadowColorGets or sets the shadow color of a legend item.
Public propertyShadowOffsetGets or sets the shadow offset, in pixels, of a legend item.
Public propertyTagGets or sets an object associated with this chart element. (Inherited from ChartElement.)
Public propertyToolTipGets or sets the tooltip of the legend item.
Public propertyUrlGets or sets the destination URL of a legend item.
Top
  NameDescription
Public methodDispose()Releases the resources used by the ChartElement. (Inherited from ChartElement.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the LegendItem class and optionally releases the managed resources. (Overrides ChartElement.Dispose(Boolean).)
Public methodEqualsDetermines whether the specified Object is equal to the current ChartElement. (Inherited from ChartElement.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeReturns a hash function for a particular type. (Inherited from ChartElement.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current Object. (Inherited from ChartElement.)
Top

The LegendItem class represents a legend item, which can be either a default or custom item:

  • Default legend items are automatically inserted into the legend for either data series or data points. Default entries for pie and doughnut charts represent the plotted data points, whereas entries for all other chart types represent the plotted series. By default, these legend entries use the data point or series color for the symbol color, and the name of the series or data point for the legend item text. Default legend items can be customized or deleted at run time by using the CustomizeLegend event of the Chart control.

  • Custom legend items have user-defined text, symbol color, and so forth. Unlike the default entries, they are not connected with the plotted data. Custom legend items can be added at either design time or run time, using the CustomItems property of the Legend object.

Legend symbols can be rectangles, lines or markers, depending on the ImageStyle property setting of a LegendItem object.

The text of a custom legend item is determined by the Name property.

.NET Framework

Supported in: 4.5.1, 4.5, 4

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft. All rights reserved.