Angular VectorMap - legends
Configures map legends.
A legend is a supplementary map element that helps end-users identify a map area or a map marker. The VectorMap widget can display several legends simultaneously. To configure legends, declare an array of objects and assign it to the legends option. Each object in this array specifies settings of one legend. These settings are described in this section.
Each legend requires the source option to be set. This option specifies whether it is areas or markers that must be accompanied with a legend. Learn more from the description of the source option.
A map legend contains several legend items. A legend item consists of a marker and a text. You can change the size of markers using the markerSize option. To provide texts for legend items, you need to implement the customizeText function.
backgroundColor
Specifies the color of the legend's background.
This option supports the following colors:
- Hexadecimal colors
- RGB colors
- RGBA colors
- Predefined/cross-browser color names
- Predefined SVG colors
border
Specifies legend border settings.
This object configures the appearance of the legend border. By default, the legend border is hidden. To make it visible, set the visible option of the border object to true. Then, you can adjust settings of the legend border, such as color, width or opacity using the corresponding options of the border object.
columnCount
Specifies how many columns must be taken to arrange legend items.
To arrange legend items, specify how many rows and columns they must occupy. To do this, use the rowCount and columnCount options.
columnItemSpacing
Specifies the spacing between a pair of neighboring legend columns in pixels.
customizeHint
Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item.
Information on a legend item.
Name | Type | Description |
---|---|---|
start |
The start value of the group indicated by the legend item. |
|
end |
The end value of the group indicated by the legend item. |
|
index |
The group's index. |
|
color |
The legend item's color. This field is undefined if the source is 'markerSizeGroups'. |
|
size |
The diameter of the legend item in pixels. This field is undefined if the source is 'areaColorGroups' or 'markerColorGroups'. |
The text for the hint to display.
This option accepts a function that must return the required text. When implementing this function, use its parameter to access information on the legend item.
customizeText
Specifies text for legend items.
Information on a legend item.
Name | Type | Description |
---|---|---|
start |
The start value of the group indicated by the legend item. |
|
end |
The end value of the group indicated by the legend item. |
|
index |
The group's index. |
|
color |
The legend item's color. This field is undefined if the source is 'markerSizeGroups'. |
|
size |
The diameter of the legend item in pixels. This field is undefined if the source is 'areaColorGroups' or 'markerColorGroups'. |
The text for the legend item to display.
This option accepts a function that returns the text for a legend item. When implementing this function, you can access useful data on the legend item using the function's argument.
horizontalAlignment
Specifies the legend's position on the map.
To position a legend on the map, use this option in conjunction with the verticalAlignment option.
When using the widget as an ASP.NET MVC Control, specify this option using the HorizontalAlignment
enum. This enum accepts the following values: Left
, Center
and Right
.
itemsAlignment
Specifies the alignment of legend items.
This option is useful when there is an odd count of items in the legend and they are placed in several columns.
When using the widget as an ASP.NET MVC Control, specify this option using the HorizontalAlignment
enum. This enum accepts the following values: Left
, Center
and Right
.
margin
Specifies the distance between the legend and the container borders in pixels.
When this option is set to a number, the specified margin applies to all sides of the legend. Alternatively, the margin option can be set to an object. This object specifies margins for each side of the legend separately.
Whether or not the specified margin is applied to a particular side of the legend depends on the legend's location. The location is determined by the horizontalAlignment and verticalAlignment options. Refer to the top, bottom, left and right options' description to discover when the margin applies to the corresponding side of the legend.
markerColor
Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source.
markerShape
Specifies the shape of item markers.
When using the widget as an ASP.NET MVC Control, specify this option using the VectorMapMarkerShape
enum. This enum accepts the following values: Circle
and Square
.
orientation
Specifies whether to arrange legend items horizontally or vertically.
When this option is set to 'vertical', legend items are displayed vertically (i.e., in a column). When this option is set to 'horizontal', legend items are displayed horizontally (i.e, in a row). When this option is not defined, the legend orientation is chosen automatically.
When using the widget as an ASP.NET MVC Control, specify this option using the Orientation
enum. This enum accepts the following values: Horizontal
and Vertical
.
paddingLeftRight
Specifies the spacing between the legend left/right border and legend items in pixels.
paddingTopBottom
Specifies the spacing between the legend top/bottom border and legend items in pixels.
rowCount
Specifies how many rows must be taken to arrange legend items.
To arrange legend items, specify how many rows and columns they must occupy. To do this, use the rowCount and columnCount options.
rowItemSpacing
Specifies the spacing between a pair of neighboring legend rows in pixels.
verticalAlignment
Specifies the legend's position on the map.
To position a legend on the map, use this option in conjunction with the horizontalAlignment option.
When using the widget as an ASP.NET MVC Control, specify this option using the VerticalEdge
enum. This enum accepts the following values: Top
and Bottom
.
If you have technical questions, please create a support ticket in the DevExpress Support Center.