All docs
V19.1
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
17.2
Box
Map
Vue
A newer version of this page is available. Switch to the current version.

jQuery VectorMap - legends

Configures map legends.

Type:

Array<Object>

Default Value: undefined

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.

View Demo

backgroundColor

Colors the legend's background.

Type:

String

Default Value: undefined

This option supports the following colors:

border

Configures the legend's border.

Type:

Object

columnCount

Arranges legend items into several columns.

Type:

Number

Default Value: 0

Use this option when the legend is oriented vertically. Otherwise, use rowCount.

See Also

columnItemSpacing

Specifies an empty space between item columns in pixels.

Type:

Number

Default Value: 20

customizeHint

Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item.

Type:

Function

Function parameters:
itemInfo:

Object

Information on a legend item.

Object structure:
Name Type Description
color

String

The legend item's color. This field is undefined if the source is 'markerSizeGroups'.

end

Number

The end value of the group indicated by the legend item.

index

Number

The group's index.

size

Number

The diameter of the legend item in pixels. This field is undefined if the source is 'areaColorGroups' or 'markerColorGroups'.

start

Number

The start value of the group indicated by the legend item.

Return Value:

String

The text for the hint to display.

Cannot be used in themes.

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.

NOTE
If you have not provided text for legend items using the customizeText option, hints will not appear.

customizeItems

Allows you to change the order and visibility of legend items.

Type:

Function

Function parameters:

Legend items before customizations.

Return Value:

Array<VectorMapLegendItem>

Legend items after customizations.

customizeText

Specifies text for legend items.

Type:

Function

Function parameters:
itemInfo:

Object

Information on a legend item.

Object structure:
Name Type Description
color

String

The legend item's color. This field is undefined if the source is 'markerSizeGroups'.

end

Number

The end value of the group indicated by the legend item.

index

Number

The group's index.

size

Number

The diameter of the legend item in pixels. This field is undefined if the source is 'areaColorGroups' or 'markerColorGroups'.

start

Number

The start value of the group indicated by the legend item.

Return Value:

String

The text for the legend item to display.

Cannot be used in themes.

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.

font

Specifies the legend items' font options.

Type:

Object

horizontalAlignment

Along with verticalAlignment, specifies the legend's position.

Type:

String

Default Value: 'right'
Accepted Values: 'center' | 'left' | 'right'

Use the HorizontalAlignment enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: Left, Center, and Right.

See Also

itemsAlignment

Aligns items in the last column or row (depending on the legend's orientation). Applies when legend items are not divided into columns or rows equally.

Type:

String

Default Value: undefined
Accepted Values: 'center' | 'left' | 'right'

Use the HorizontalAlignment enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: Left, Center, and Right.

itemTextPosition

Specifies the text's position relative to the marker in a legend item.

Type:

String

Default Value: undefined
Accepted Values: 'bottom' | 'left' | 'right' | 'top'

margin

Generates an empty space, measured in pixels, around the legend.

Type:

Number

|

Object

Default Value: 10

When set to a number, this option applies to all the legend's sides. The object allows you to control each side individually.

DevExtreme Legend Margins

markerColor

Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source.

Type:

String

Default Value: undefined

markerShape

Specifies the shape of item markers.

Type:

String

Default Value: 'square'
Accepted Values: 'circle' | 'square'

Use the VectorMapMarkerShape enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: Circle and Square.

markerSize

Specifies the marker's size in a legend item in pixels.

Type:

Number

Default Value: 12

orientation

Arranges legend items vertically (in a column) or horizontally (in a row). The default value is "horizontal" if the legends[].horizontalAlignment is "center". Otherwise, it is "vertical".

Type:

String

Default Value: undefined
Accepted Values: 'horizontal' | 'vertical'

Use the Orientation enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: Horizontal and Vertical.

See Also

paddingLeftRight

Generates an empty space, measured in pixels, between the legend's left/right border and its items.

Type:

Number

Default Value: 10

DevExtreme Legend Left-Right Padding

paddingTopBottom

Generates an empty space, measured in pixels, between the legend's top/bottom border and its items.

Type:

Number

Default Value: 10

DevExtreme Legend Top-Bottom Padding

rowCount

Arranges legend items in several rows.

Type:

Number

Default Value: 0

Use this option when the legend is oriented horizontally. Otherwise, use columnCount.

See Also

rowItemSpacing

Specifies an empty space between item rows in pixels.

Type:

Number

Default Value: 8

source

Specifies the source of data for the legend.

Type:

Object

Cannot be used in themes.

title

Configures the legend title.

Type:

Object

|

String

DevExtreme PieChart: Legend Title

To specify only the title's text, assign it directly to this option. Otherwise, set this option to an object with the text and other fields specified.

The title can be accompanied by a subtitle. Assign it to the title.subtitle option.

verticalAlignment

Along with horizontalAlignment, specifies the legend's position.

Type:

String

Default Value: 'top'
Accepted Values: 'bottom' | 'top'

Use the VerticalEdge enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: Top and Bottom.

See Also

visible

Specifies the legend's visibility.

Type:

Boolean

Default Value: true