VectorMap

A vector map widget.

Included in: dx.chartjs.js, dx.all.js

The dxVectorMap widget is designed to visualize data connected with a geographical location. This widget represents a map that contains areas and markers. The map areas usually reflect geographical regions, such as countries, continents, etc., while the map markers are used to flag certain points on a map, e.g., towns, cities or capitals.

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxVectorMap jQuery plug-in.

    HTML
    <div id="mapContainer"></div>
    JavaScript
    $("#mapContainer").dxVectorMap({
        mapData: DevExpress.viz.map.sources.world,
        //...
    });
  • Knockout
    Add a div element and apply the dxVectorMap binding to this element.

    HTML
    <div data-bind="dxVectorMap: {
        mapData: DevExpress.viz.map.sources.world,
        //...
    }"></div>
  • Angular
    Add a div element and apply the dx-vector-map directive to this element.

    HTML
    <div dx-vector-map="{
        mapData: DevExpress.viz.map.sources.world,
        //...
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required.

See Also

View Demo Watch Video

See Also

To learn the widget's concepts and overview features, refer to the Vector Map section within the Data Visualization Guides.

Configuration

An object that specifies configuration options for the dxVectorMap widget.

Name Description
areaSettings

An object specifying options for the map areas.

background

Specifies the options 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.

controlBar

Specifies the options of the control bar.

legends

Configures map legends.

loadingIndicator

Specifies the appearance of the loading indicator.

mapData

Specifies a data source for the map area.

markers

Specifies a data source for the map markers.

markerSettings

An object specifying options for the map markers.

maxZoomFactor

Specifies a map's maximum zoom factor.

onAreaClick

A handler for the areaClick event.

onAreaSelectionChanged

A handler for the areaSelectionChanged event.

onCenterChanged

A handler for the centerChanged event.

onClick

A handler for the click event.

onDisposing

A handler for the disposing event.

onDrawn

A handler for the drawn event.

onIncidentOccurred

A handler for the incidentOccurred event.

onInitialized

A handler for the initialized event.

onMarkerClick

A handler for the markerClick event.

onMarkerSelectionChanged

A handler for the markerSelectionChanged event.

onOptionChanged

A handler for the optionChanged event.

onTooltipHidden

A handler for the tooltipHidden event.

onTooltipShown

A handler for the tooltipShown event.

onZoomFactorChanged

A handler for the zoomFactorChanged event.

panningEnabled

Disables the panning capability.

pathModified

Notifies a widget that it is embedded into an HTML page that uses a path modifier.

rtlEnabled

Specifies whether or not the widget supports right-to-left representation.

size

Specifies the size of the dxVectorMap widget.

theme

Sets the name of the theme to be used in the widget.

tooltip

Specifies tooltip options.

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 dxVectorMap widget.

Name Description
beginUpdate()

Prevents the component from refreshing until the endUpdate method is called.

center()

Gets the current coordinates of the map center.

center(centerCoordinates)

Sets the coordinates of the map center.

clearAreaSelection()

Deselects all the selected areas on a map. The areas are displayed in their initial style after.

clearMarkerSelection()

Deselects all the selected markers on a map. The markers are displayed in their initial style after.

clearSelection()

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

convertCoordinates(x, y)

Converts client area coordinates into map coordinates.

element()

Returns the root HTML element of the widget.

endUpdate()

Enables the component to refresh after the beginUpdate method call.

getAreas()

Returns an array with all the map areas.

getMarkers()

Returns an array with all the map markers.

hideLoadingIndicator()

Conceals the loading indicator.

instance()

Returns an instance of this component class.

off(eventName)

Detaches all event handlers from the specified event.

off(eventName, eventHandler)

Detaches a particular event handler from the specified event.

on(eventName, eventHandler)

Subscribes to a specified event.

on(events)

Subscribes to the specified events.

option()

Returns the configuration options of this component.

option(optionName)

Gets the value of the specified configuration option of this component.

option(optionName, optionValue)

Sets a value to the specified configuration option of this component.

option(options)

Sets one or more options of this component.

render()

Redraws a widget.

showLoadingIndicator()

Displays the loading indicator.

svg()

Returns the widget's SVG markup.

viewport()

Gets the current coordinates of the map viewport.

viewport(viewportCoordinates)

Sets the coordinates of the map viewport.

zoomFactor()

Gets the current value of the map zoom factor.

zoomFactor(zoomFactor)

Sets the value of the map zoom factor.

Events

This section describes events exposed by this widget.

Name Description
areaClick

Fires when a user clicks an area.

areaSelectionChanged

Fires when a user selects/deselects an area.

centerChanged

Fires when the coordinates of the map center are changed.

click

Fires when a user clicks on any place on the map.

disposing

Fires when the widget is being removed.

drawn

Fires when the widget has finished drawing itself.

incidentOccurred

Fires when an error or warning appears in a widget.

initialized

Fires when the widget is initialized.

markerClick

Fires when a user clicks a marker.

markerSelectionChanged

Fires when a user selects/deselects a marker.

optionChanged

Fires after an option of the component is changed.

tooltipHidden

Fires when a tooltip of an area or marker becomes hidden.

tooltipShown

Fires when a tooltip of an area or marker appears.

zoomFactorChanged

Fires when the map zoom factor is changed.

Map Elements

This section lists the methods and fields of the map elements.