Redigera

Dela via


LegendItem Class

Definition

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

public ref class LegendItem : System::Windows::Forms::DataVisualization::Charting::ChartNamedElement
public class LegendItem : System.Windows.Forms.DataVisualization.Charting.ChartNamedElement
type LegendItem = class
    inherit ChartNamedElement
Public Class LegendItem
Inherits ChartNamedElement
Inheritance

Remarks

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.

Constructors

LegendItem()

Initializes a new instance of the LegendItem class.

LegendItem(String, Color, String)

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

Properties

BackGradientStyle

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

BackHatchStyle

Gets or sets the hatching style of a legend item.

BackImageTransparentColor

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

BackSecondaryColor

Gets or sets the secondary color of a legend item.

BorderColor

Gets or sets the border color of a legend item.

BorderDashStyle

Gets or sets the border style of a legend item.

BorderWidth

Gets or sets the border width of a legend item.

Cells

Gets the collection of cells in the legend item.

Color

Gets or sets the color of a legend item.

Enabled

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

Image

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

ImageStyle

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

Legend

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

MarkerBorderColor

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

MarkerBorderWidth

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

MarkerColor

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

MarkerImage

Gets or sets a marker image of the legend item.

MarkerImageTransparentColor

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

MarkerSize

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

MarkerStyle

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

Name

Gets or sets the name of the legend item.

SeparatorColor

Gets or sets the color of the legend item separator.

SeparatorType

Gets or sets the separator style of the legend item.

SeriesName

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

SeriesPointIndex

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

ShadowColor

Gets or sets the shadow color of a legend item.

ShadowOffset

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

Tag

Gets or sets an object associated with this chart element.

(Inherited from ChartElement)
ToolTip

Gets or sets the tooltip of the legend item.

Methods

Dispose()

Releases the resources used by the ChartElement.

(Inherited from ChartElement)
Dispose(Boolean)

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

Equals(Object)

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

(Inherited from ChartElement)
GetHashCode()

Returns a hash function for a particular type.

(Inherited from ChartElement)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current Object.

(Inherited from ChartElement)

Applies to