LegendItem LegendItem LegendItem LegendItem Class


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

public ref class LegendItem : System::Web::UI::DataVisualization::Charting::ChartNamedElement, System::Web::UI::DataVisualization::Charting::IChartMapArea
public class LegendItem : System.Web.UI.DataVisualization.Charting.ChartNamedElement, System.Web.UI.DataVisualization.Charting.IChartMapArea
type LegendItem = class
    inherit ChartNamedElement
    interface IChartMapArea
Public Class LegendItem
Inherits ChartNamedElement
Implements IChartMapArea


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.


LegendItem() LegendItem() LegendItem() LegendItem()

Initializes a new instance of the LegendItem class.

LegendItem(String, Color, String) LegendItem(String, Color, String) LegendItem(String, Color, String) LegendItem(String, Color, String)

Initializes a new instance of the LegendItem class with the specified name, color and image path.


BackGradientStyle BackGradientStyle BackGradientStyle BackGradientStyle

Gets or sets the orientation for the background gradient of a legend item. Also determines whether a gradient is used.

BackHatchStyle BackHatchStyle BackHatchStyle BackHatchStyle

Gets or sets the hatching style of a legend item.

BackImageTransparentColor BackImageTransparentColor BackImageTransparentColor BackImageTransparentColor

Gets or sets a color which will be replaced with a transparent color when the background image is drawn.

BackSecondaryColor BackSecondaryColor BackSecondaryColor BackSecondaryColor

Gets or sets the secondary color of a legend item.

BorderColor BorderColor BorderColor BorderColor

Gets or sets the border color of a legend item.

BorderDashStyle BorderDashStyle BorderDashStyle BorderDashStyle

Gets or sets the border style of a legend item.

BorderWidth BorderWidth BorderWidth BorderWidth

Gets or sets the border width of a legend item.

Cells Cells Cells Cells

Gets the collection of cells in the legend item.

Color Color Color Color

Gets or sets the color of a legend item.

Enabled Enabled Enabled Enabled

Gets or sets a flag that indicates whether the legend item is enabled.

Image Image Image Image

Gets or sets the image that will be displayed for a legend item symbol.

ImageStyle ImageStyle ImageStyle ImageStyle

Gets or sets the display style of the legend item image.

Legend Legend Legend Legend

Gets or sets the Legend object associated with this legend item.

MapAreaAttributes MapAreaAttributes MapAreaAttributes MapAreaAttributes

Gets or sets the map area attributes of a legend item.

MarkerBorderColor MarkerBorderColor MarkerBorderColor MarkerBorderColor

Gets or sets the border color of the markers, if used.

MarkerBorderWidth MarkerBorderWidth MarkerBorderWidth MarkerBorderWidth

Gets or sets the border width of the markers, if used. Measured in pixels.

MarkerColor MarkerColor MarkerColor MarkerColor

Gets or sets the color of the markers, if used.

MarkerImage MarkerImage MarkerImage MarkerImage

Gets or sets a marker image.

MarkerImageTransparentColor MarkerImageTransparentColor MarkerImageTransparentColor MarkerImageTransparentColor

Gets or sets a color that will be replaced with a transparent color when the marker image is drawn.

MarkerSize MarkerSize MarkerSize MarkerSize

Gets or sets the size of the legend item markers, if used.

MarkerStyle MarkerStyle MarkerStyle MarkerStyle

Gets or sets a legend item marker style. Also used to enable or disable the display of markers.

Name Name Name Name

Gets or sets the name of the legend item.

PostBackValue PostBackValue PostBackValue PostBackValue

Gets or sets the postback value which can be processed on a Click event.

SeparatorColor SeparatorColor SeparatorColor SeparatorColor

Gets or sets the color of the legend item separator.

SeparatorType SeparatorType SeparatorType SeparatorType

Gets or sets the separator style of the legend item.

SeriesName SeriesName SeriesName SeriesName

Gets or sets the name of the Series associated with a default legend item.

SeriesPointIndex SeriesPointIndex SeriesPointIndex SeriesPointIndex

Gets or sets the index of a DataPoint object associated with a default legend item.

ShadowColor ShadowColor ShadowColor ShadowColor

Gets or sets the shadow color of a legend item.

ShadowOffset ShadowOffset ShadowOffset ShadowOffset

Gets or sets the shadow offset, in pixels, of a legend item.

Tag Tag Tag Tag

Gets or sets an object associated with this chart element.

(Inherited from ChartElement)
ToolTip ToolTip ToolTip ToolTip

Gets or sets the tooltip of the legend item.

Url Url Url Url

Gets or sets the destination URL of a legend item.


Dispose() Dispose() Dispose() Dispose()

Releases the resources used by the ChartElement.

(Inherited from ChartElement)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by the LegendItem class and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified Object is equal to the current ChartElement.

(Inherited from ChartElement)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Returns a hash function for a particular type.

(Inherited from ChartElement)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current Object.

(Inherited from ChartElement)

Applies to