VectorMap

The dxVectorMap is a widget that visualize geographical locations. This widget 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.

Included in: dx.chartjs.js, dx.all.js
VectorMap interactive configuration
Copy Code
Copy to Codepen
$("#vectormap").dxVectorMap({
});

                    

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

  • jQuery
    Use the dxVectorMap jQuery plug-in.

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

    HTML
    <div data-bind="dxVectorMap: {
        layers: [{
            type: 'area',
            dataSource: DevExpress.viz.map.sources.world
        }]
        //...
    }"></div>
  • AngularJS
    Add a div element and apply the dx-vector-map directive to this element.

    HTML
    <div dx-vector-map="{
        layers: [{
            type: 'area',
            dataSource: 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 AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on how to link the needed libraries, refer to the Installation article.

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

layers

Specifies options for dxVectorMap widget layers.

legends

Configures map legends.

loadingIndicator

Specifies the appearance of the loading indicator.

maxZoomFactor

Specifies a map's maximum zoom factor.

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.

onOptionChanged

A handler for the optionChanged event.

onSelectionChanged

A handler for the selectionChanged 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.

projection

Specifies the map projection.

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.

title

Specifies a title for the vector map.

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.

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.

getLayerByIndex(index)

Gets the layer by its index.

getLayerByName(name)

Gets the layer by its name.

getLayers()

Gets all map layers.

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 fired by this widget.

Name Description
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.

optionChanged

Fires after an option of the component is changed.

selectionChanged

Fires when a user selects/deselects a layer element.

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.