Legends
- 2 minutes to read
A Legend is a panel that shows information about value meanings of vector items. This may be information either about item colors or item sizes, depending on the item nature.
To add a legend to the Map control, it is necessary to create an appropriate MapLegendBase class descendant (either color-based or size-based legend) and add it to the MapControl.Legends collection.
Then, it is required to specify a layer, which contains vector items to be annotated by this legend. To do this, assign this layer object to the ItemsLayerLegend.Layer property.
Below you will find the more detailed information about various types of legends supported by the Map control.
Color-Based Legend
A Color-Based Legend is intended to detail the meaning of specific colors. In this case, a layer specified via a legend’s ItemsLayerLegend.Layer property should contain vector items colorized by one of the following colorizers:
There are two types of color-based legends.
The main properties that affect element appearance and functionality are listed below.
For more information on using these legends, see the following examples:
- How to: Colorize Map Contours Using the Choropleth Colorizer (an example of using a ColorScaleLegend);
- Lesson 2 - Load a Vector Cartesian Map (an example of using a ColorListLegend).
Size-Based Legend
A Size-Based Legend details the meaning of various bubble sizes in MapBubble charts.
This legend type is represented by the SizeLegend class. The appearance of the size-based legend is defined by its SizeLegend.Type property value.
SizeLegend.Type = Inline
SizeLegend.Type = Nested
The main properties that affect element appearance and functionality are listed below.
Group | Properties |
---|---|
Availability | MapControl.Legends |
Layout | MapLegendBase.Alignment |
Elements | ItemsLayerLegend.Layer, SizeLegend.CustomItems |
Appearance | MapLegendBase.Header, MapLegendBase.Description,MapLegendBase.BackgroundStyle, MapLegendBase.DescriptionStyle, MapLegendBase.HeaderStyle, MapLegendBase.ItemStyle, SizeLegend.Type, SizeLegend.ShowTickMarks |
To learn how to create a SizeLegend object, refer to How to: Manually Generate Bubble Chart Items.