JavaScript/jQuery VectorMap API

The VectorMap is a UI component that visualizes geographical locations. This UI component represents a geographical map that contains areas and markers. Areas embody continents and countries. Markers flag specific points on the map, for example, towns, cities or capitals.

import VectorMap from "devextreme/viz/vector_map"

Configuration

An object that specifies configuration properties for the UI component.

Name Description
annotations

Specifies the annotation collection.

background

Specifies the properties for the map background.

bounds

Specifies the positioning of a map in geographical coordinates.

center

Specifies the geographical coordinates of the center for a map.

commonAnnotationSettings

Specifies settings common for all annotations in the VectorMap.

controlBar

Configures the control bar.

customizeAnnotation

Customizes an individual annotation.

disabled

Specifies whether the UI component responds to user interaction.

elementAttr

Specifies the global attributes to be attached to the UI component's container element.

export

Configures the exporting and printing features.

layers

Specifies properties for VectorMap UI component layers.

legends

Configures map legends.

loadingIndicator

Configures the loading indicator.

maxZoomFactor

Specifies a map's maximum zoom factor.

onCenterChanged

A function that is executed each time the center coordinates are changed.

onClick

A function that is executed when any location on the map is clicked or tapped.

onDisposing

A function that is executed before the UI component is disposed of.

onDrawn

A function that is executed when the UI component's rendering has finished.

onExported

A function that is executed after the UI component is exported.

onExporting

A function that is executed before the UI component is exported.

onFileSaving

A function that is executed before a file with exported UI component is saved to the user's local storage.

onIncidentOccurred

A function that is executed when an error or warning occurs.

onInitialized

A function used in JavaScript frameworks to save the UI component instance.

onOptionChanged

A function that is executed after a UI component property is changed.

onSelectionChanged

A function that is executed when a layer element is selected or selection is canceled.

onTooltipHidden

A function that is executed when a tooltip becomes hidden.

onTooltipShown

A function that is executed when a tooltip appears.

onZoomFactorChanged

A function that is executed each time the zoom factor is changed.

panningEnabled

Disables the panning capability.

pathModified

Notifies the UI component that it is embedded into an HTML page that uses a tag modifying the path.

projection

Specifies the map projection.

redrawOnResize

Specifies whether to redraw the UI component when the size of the container changes or a mobile device rotates.

rtlEnabled

Switches the UI component to a right-to-left representation.

size

Specifies the UI component's size in pixels.

theme

Sets the name of the theme the UI component uses.

title

Configures the UI component's title.

tooltip

Configures tooltips.

touchEnabled

Specifies whether the map should respond to touch gestures.

wheelEnabled

Specifies whether or not the map should respond when a user rolls the mouse wheel.

zoomFactor

Specifies a number that is used to zoom a map initially.

zoomingEnabled

Disables the zooming capability.

Methods

This section describes the methods that can be used in code to manipulate objects related to the UI component.

Name Description
beginUpdate()

Postpones rendering that can negatively affect performance until the endUpdate() method is called.

center()

Gets the current map center coordinates.

center(centerCoordinates)

Sets the map center coordinates.

clearSelection()

Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after.

convertToGeo(x, y)

Converts coordinates from pixels to the dataSource coordinate system.

convertToXY(longitude, latitude)

Converts coordinates from the dataSource coordinate system to pixels.

dispose()

Disposes of all the resources allocated to the VectorMap instance.

element()

Gets the root UI component element.

endUpdate()

Refreshes the UI component after a call of the beginUpdate() method.

exportTo(fileName, format)

Exports the UI component.

getInstance(element)

Gets the instance of a UI component found using its DOM node.

getLayerByIndex(index)

Gets a layer with a specific index.

getLayerByName(name)

Gets a layer with a specific name.

getLayers()

Gets all layers.

getSize()

Gets the current UI component size.

hideLoadingIndicator()

Hides the loading indicator.

instance()

Gets the UI component's instance. Use it to access other methods of the UI component.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

option()

Gets all UI component properties.

option(optionName)

Gets the value of a single property.

option(optionName, optionValue)

Updates the value of a single property.

option(options)

Updates the values of several properties.

print()

Opens the browser's print window.

render()

Redraws the UI component.

resetOption(optionName)

Resets a property to its default value.

showLoadingIndicator()

Shows the loading indicator.

svg()

Gets the UI component's SVG markup.

viewport()

Gets the current map viewport coordinates.

viewport(viewportCoordinates)

Sets the map viewport coordinates.

zoomFactor()

Gets the current zoom factor value.

zoomFactor(zoomFactor)

Sets the zoom factor value.

See Also

Events

This section describes events fired by this UI component.

Name Description
centerChanged

Raised each time the center coordinates are changed.

click

Raised when any location on the map is clicked or tapped.

disposing

Raised before the UI component is disposed of.

drawn

Raised when the UI component's rendering has finished.

exported

Raised after the UI component is exported.

exporting

Raised before the UI component is exported.

fileSaving

Raised before a file with exported UI component is saved to the user's local storage.

incidentOccurred

Raised when an error or warning occurs.

initialized

Raised only once, after the UI component is initialized.

optionChanged

Raised after a UI component property is changed.

selectionChanged

Raised when a layer element is selected or selection is canceled.

tooltipHidden

Raised when a tooltip becomes hidden.

tooltipShown

Raised when a tooltip appears.

zoomFactorChanged

Raised each time the zoom factor is changed.

See Also

Map Elements

This section describes vector map elements.

Interfaces

This section describes interfaces that the VectorMap component uses.

Types

Name Description
CenterChangedEvent

The type of the centerChanged event handler's argument.

ClickEvent

The type of the click event handler's argument.

DisposingEvent

The type of the disposing event handler's argument.

DrawnEvent

The type of the drawn event handler's argument.

ExportedEvent

The type of the exported event handler's argument.

ExportingEvent

The type of the exporting event handler's argument.

FileSavingEvent

The type of the fileSaving event handler's argument.

IncidentOccurredEvent

The type of the incidentOccurred event handler's argument.

InitializedEvent

The type of the initialized event handler's argument.

Legend

Configures map legends.

OptionChangedEvent

The type of the optionChanged event handler's argument.

SelectionChangedEvent

The type of the selectionChanged event handler's argument.

Tooltip

Configures tooltips.

TooltipHiddenEvent

The type of the tooltipHidden event handler's argument.

TooltipShownEvent

The type of the tooltipShown event handler's argument.

VectorMapLayerType

Specifies layer type.

VectorMapMarkerShape

Specifies the shape of item markers.

VectorMapMarkerType

Specifies the type of a marker element.

VectorMapProjection

Specifies the map projection.

ZoomFactorChangedEvent

The type of the zoomFactorChanged event handler's argument.