Vue VectorMap Props

An object that specifies configuration properties for the UI component.

annotations[]

Specifies the annotation collection.

Selector: DxAnnotation

Annotations are containers for images, text blocks, and custom content that display additional information about the visualized data.

DevExtreme VectorMap: Annotations

To create annotations, assign an array of objects to the annotations[] property. Each object configures an individual annotation. You can set each annotation's type property to "text", "image", or "custom". Depending on the type, specify the annotation's text, image, or template property:

jQuery
index.js
$(function() {
    $("#vectorMap").dxVectorMap({
        annotations: [{
            type: "text",
            text: "Annotation text"
        }, {
            type: "image",
            image: "http://image/url/myimage.png"
        }, {
            type: "custom",
            template: function(annotation) {
                const data = annotation.data;
                const $svg = $("<svg>");
                // ...
                // Customize the annotation's markup here
                // ...
                return $svg;
            }
        }]
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-vector-map ... >
    <dxi-annotation
        type="text"
        text="Annotation text">
    </dxi-annotation>
    <dxi-annotation
        type="image"
        image="http://image/url/myimage.png">
    </dxi-annotation>
    <dxi-annotation
        type="custom"
        template="custom-annotation">
    </dxi-annotation>
    <svg *dxTemplate="let annotation of 'custom-annotation'">
        <!-- Declare custom SVG markup here -->
    </svg>
</dx-vector-map>
import { Component } from '@angular/core';
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxVectorMapModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxVectorMapModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxVectorMap ... >
        <DxAnnotation
            type="text"
            text="Annotation text"
        />
        <DxAnnotation
            type="image"
            image="http://image/url/myimage.png"
        />
        <DxAnnotation
            type="custom"
            template="custom-annotation"
        />
        <template #custom-annotation="{ data }">
            <svg>
                <!-- Declare custom SVG markup here -->
            </svg>
        </template>
    </DxVectorMap>
</template>

<script>
import DxVectorMap, {
    DxAnnotation
} from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap,
        DxAnnotation
    },
    data() {
        // ...
    }
}
</script>
React
App.js
import React from 'react';

import VectorMap, {
    Annotation
} from 'devextreme-react/vector-map';

function CustomAnnotation(annotation) {
    const data = annotation.data;
    return (
        <svg>
            {/* Declare custom SVG markup here */}
        </svg>
    );
}

export default function App() {
    return (
        <VectorMap ... >
            <Annotation
                type="text"
                text="Annotation text"
            />
            <Annotation
                type="image"
                image="http://image/url/myimage.png"
            />
            <Annotation
                type="custom"
                render={CustomAnnotation}
            />
        </VectorMap>
    );
}

Annotations can be positioned at specific geographic coordinates or coordinates of the client area:

  • Geographic coordinates

    annotations: [{
        coordinates: [-75.4999, 43.00035]
    }]
  • Client area coordinates (x and y)

    annotations: [{
        x: 100,
        y: 200
    }]

When a user long-presses an annotation or hovers the mouse pointer over it, the VectorMap displays a tooltip.

Objects in the annotations[] array configure individual annotations. To specify properties common for all annotations, use the commonAnnotationSettings object. Individual settings take precedence over common settings.

View Demo

See Also

background

Specifies the properties for the map background.

Selector: DxBackground
Type:

Object

The map background is a space on a map that does not contain areas. Within the background configuration object you can specify colors for the map background and its border.

bounds

Specifies the positioning of a map in geographical coordinates.

Type:

Array<Number>

Default Value: undefined
Cannot be used in themes.

When you need to display only a specific region on a map, specify the geographical coordinates of this region using the bounds property. Assign an array of four values to this property. These values represent geographical coordinates in the following format: [minLongitude, maxLatitude, maxLongitude, minLatitude] with the default range of longitude [-180, 180] and latitude [-90, 90]. See the image below to review how these values are applied to a map.

ChartMargin ChartJS

If your dataSource contains coordinates in a different range, implement a custom projection.

NOTE
Specifying the bounds property with the { minLon: minLongitude, maxLat: maxLatitude, maxLon: maxLongitude, minLat: minLatitude } object is now deprecated.

center

Specifies the geographical coordinates of the center for a map.

Type:

Array<Number>

Default Value: [0, 0]
Cannot be used in themes.

By default, the map in the UI component is centered on the (0, 0) point. If you need to center the map on a different geographical point, assign an array of two values in the [longitude, latitude] form.

commonAnnotationSettings

Specifies settings common for all annotations in the VectorMap.

Selector: DxCommonAnnotationSettings
Type:

Object

Settings specified here can be ignored in favor of individual annotation settings specified in the annotations[] array. Refer to the array's description for information on how to configure annotations.

The following code shows the commonAnnotationSettings declaration syntax:

jQuery
index.js
$(function() {
    $("#vectorMap").dxVectorMap({
        // ...
        commonAnnotationSettings: {
            tooltipEnabled: false
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-vector-map ... >
    <dx-common-annotation-settings
        [tooltipEnabled]="false">
    </dx-common-annotation-settings>
</dx-vector-map>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxVectorMapModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxVectorMapModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxVectorMap ... >
        <DxCommonAnnotationSettings
            :tooltip-enabled="false"
        />
    </DxVectorMap>
</template>

<script>
import DxVectorMap, {
    DxCommonAnnotationSettings
} from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap,
        DxCommonAnnotationSettings
    },
    data() {
        // ...
    }
}
</script>
React
App.js
import React from 'react';

import VectorMap, {
    CommonAnnotationSettings
} from 'devextreme-react/vector-map';

class App extends React.Component {
    render() {
        return (
            <VectorMap ... >
                <CommonAnnotationSettings
                    tooltipEnabled={false}
                />
            </VectorMap>
        );
    }
}
export default App;

View Demo

See Also

controlBar

Configures the control bar.

Selector: DxControlBar
Type:

Object

Users can use the pan control and zoom bar in the control bar panel to navigate the map.

DevExtreme Vector Map - Control Bar

The following code shows how to use the controlBar object to move the control bar to the right side of the map:

jQuery
JavaScript
$(function() {
    $("#vectorMapContainer").dxVectorMap({
        // ...
        controlBar: {
            horizontalAlignment: "right"
        }
    });
});
Angular
app.component.html
app.module.ts
<dx-vector-map ... >
    <dxo-control-bar
        horizontalAlignment="right">
    </dxo-control-bar>
</dx-vector-map>
// ...
import { DxVectorMapModule } from 'devextreme-angular';

@NgModule({
    imports: [
        // ...
        DxVectorMapModule
    ],
    // ...
})
export class AppModule { }
Vue
App.vue
<template> 
    <DxVectorMap ... >
        <DxControlBar
            horizontal-alignment="right"
        />
    </DxVectorMap>
</template>

<script>
import { DxVectorMap, DxControlBar } from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap,
        DxControlBar
    },
    // ...
}
</script>
React
App.js
import React from 'react';
import { VectorMap, ControlBar } from 'devextreme-react/vector-map';

class App extends React.Component {
    render() {
        return (
            <VectorMap>
                // ...
                <ControlBar
                    horizontalAlignment="right"
                />
            </VectorMap>
        );
    }
}

export default App;
ASP.NET MVC Controls
Razor C#
@(Html.DevExtreme().VectorMap()
    @* ... *@
    .ControlBar(cb => cb
        .HorizontalAlignment(HorizontalAlignment.Right)
    )    
)

customizeAnnotation

Customizes an individual annotation.

Selector: customize-annotation
Type:

Function

Function parameters:
annotation:

VectorMap Annotation

| any

The annotation before customizations.

Return Value:

VectorMap Annotation

The annotation after customizations.

Default Value: undefined
Cannot be used in themes.

The following code shows how to use the customizeAnnotation function to apply different settings to text and image annotations:

jQuery
JavaScript
$(function() {
    $("#vectorMapContainer").dxVectorMap({
        // ...
        customizeAnnotation: function(annotationItem) {
            if(annotationItem.text) {
                annotationItem.color = "red";
            }
            if(annotationItem.image) {
                annotationItem.color = "blue";
            }
            return annotationItem;
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-vector-map ...
    [customizeAnnotation]="customizeAnnotation">
</dx-vector-map>
// ...
export class AppComponent {
    customizeAnnotation(annotationItem) {
        if(annotationItem.text) {
            annotationItem.color = "red";
        }
        if(annotationItem.image) {
            annotationItem.color = "blue";
        }
        return annotationItem;
    }
}
import { DxVectorMapModule } from 'devextreme-angular';
// ...
@NgModule({
    imports: [
        // ...
        DxVectorMapModule
    ],
    // ...
})
export class AppModule { }
Vue
App.vue
<template> 
    <DxVectorMap ...
        :customize-annotation="customizeAnnotation">
    </DxVectorMap>
</template>

<script>
import DxVectorMap from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap
    },
    methods: {
        customizeAnnotation(annotationItem) {
            if(annotationItem.text) {
                annotationItem.color = "red";
            }
            if(annotationItem.image) {
                annotationItem.color = "blue";
            }
            return annotationItem;
        }
    }
}
</script>
React
App.js
import React from 'react';
import VectorMap from 'devextreme-react/vector-map';

export default function App() {
    const customizeAnnotation = (annotationItem) => {
        if(annotationItem.text) {
            annotationItem.color = "red";
        }
        if(annotationItem.image) {
            annotationItem.color = "blue";
        }
        return annotationItem;
    }

    return (
        <VectorMap ...
            customizeAnnotation={customizeAnnotation}>
        </VectorMap>
    );
}
ASP.NET MVC Controls
Razor C#
@(Html.DevExtreme().VectorMap()
    @* ... *@
    .CustomizeAnnotation("customizeAnnotation")
)

<script type="text/javascript">
    function customizeAnnotation(annotationItem) {
        if(annotationItem.text) {
            annotationItem.color = "red";
        }
        if(annotationItem.image) {
            annotationItem.color = "blue";
        }
        return annotationItem;
    }
</script>
See Also

disabled

Specifies whether the UI component responds to user interaction.

Type:

Boolean

Default Value: false
Cannot be used in themes.

elementAttr

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

Selector: DxElementAttr
Type:

Object

Default Value: {}

jQuery
$(function(){
    $("#vectorMapContainer").dxVectorMap({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-vector-map ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-vector-map>
import { DxVectorMapModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxVectorMapModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxVectorMap ...
        :element-attr="vectorMapAttributes">
    </DxVectorMap>
</template>

<script>
import DxVectorMap from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap
    },
    data() {
        return {
            vectorMapAttributes: {
                id: 'elementId',
                class: 'class-name'
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import VectorMap from 'devextreme-react/vector-map';

class App extends React.Component {
    vectorMapAttributes = {
        id: 'elementId',
        class: 'class-name'
    }

    render() {
        return (
            <VectorMap ...
                elementAttr={this.vectorMapAttributes}>
            </VectorMap>
        );
    }
}
export default App;

export

Configures the exporting and printing features.

Selector: DxExport
Type: viz/core/base_widget:BaseWidgetExport

These features allow a user to export your UI component into a document or print it. When exporting is enabled, the "Exporting/Printing" button appears in the UI component. A click on it invokes a drop-down menu that lists exporting and printing commands. The following formats are supported for exporting into: PNG, PDF, JPEG, SVG and GIF.

See Also

layers

Specifies properties for VectorMap UI component layers.

Selector: DxLayer
Type:

Array<Object>

|

Object

Default Value: undefined
Cannot be used in themes.

The vector map may contain several different layers. Each layer can be of "area", "line" or "marker" type.

The Z-order of layers depends on their order in the layers array in the following way: the first layer occupies the background, the last layer is brought to the foreground.

View Demo

legends[]

Configures map legends.

Selector: DxLegend
Type:

Array<Legend>

Default Value: undefined

A legend is a supplementary map element that helps end-users identify a map area or a map marker. The VectorMap UI component can display several legends simultaneously. To configure legends, declare an array of objects and assign it to the legends property. Each object in this array specifies settings of one legend. These settings are described in this section.

Each legend requires the source property to be set. This property specifies whether it is areas or markers that must be accompanied with a legend. Learn more from the description of the source property.

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 property. To provide texts for legend items, you need to implement the customizeText function.

View Demo

loadingIndicator

Configures the loading indicator.

Selector: DxLoadingIndicator
Type: viz/core/base_widget:BaseWidgetLoadingIndicator

When the UI component is bound to a remote data source, it can display a loading indicator while data is loading.

DevExtreme Charts - Loading indicator

To enable the automatic loading indicator, set the enabled property to true.

If you want to change the loading indicator's visibility, use the show property or the showLoadingIndicator() and hideLoadingIndicator() methods.

maxZoomFactor

Specifies a map's maximum zoom factor.

Selector: max-zoom-factor
Type:

Number

Default Value: 256
Cannot be used in themes.

An end user will not be able to zoom into a map larger than the factor specified here.

onCenterChanged

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

Selector: @center-changed
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
center

Array<Number>

The updated geographical coordinates of the center.

component

VectorMap

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

Default Value: null
Cannot be used in themes.

onClick

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

Selector: @click
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
component

VectorMap

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

event

Event (jQuery or EventObject)

The event that caused the handler execution extended by the x and y fields. It is a EventObject or a jQuery.Event when you use jQuery.

model any

The model data. Available only if you use Knockout.

target

Layer Element

The Layer Element object (if available).

Default Value: null
Cannot be used in themes.

The clicked point's coordinates are available in the event field's x and y properties. The coordinates are calculated relatively to the client area which is the UI component's container. To convert them into map coordinates, use the convertCoordinates(x,y) method.

onDisposing

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

Selector: @disposing
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
model any

The model data. Available only if you use Knockout.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

VectorMap

The UI component's instance.

Default Value: null

onDrawn

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

Selector: @drawn
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
model any

The model data. Available only if you use Knockout.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

VectorMap

The UI component's instance.

Default Value: null
Cannot be used in themes.

onExported

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

Selector: @exported
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
model any

The model data. Available only if you use Knockout.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

VectorMap

The UI component's instance.

Default Value: null

onExporting

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

Selector: @exporting
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
format

String

The resulting file format. One of PNG, PDF, JPEG, SVG and GIF.

fileName

String

The name of the file to which the UI component is about to be exported.

model any

The model data. Available only if you use Knockout.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

VectorMap

The UI component's instance.

Default Value: null

onFileSaving

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

Selector: @file-saving
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
format

String

The format of the file to be saved.
Possible Values: 'PNG' | 'PDF' | 'JPEG' | 'SVG' | 'GIF'

fileName

String

The name of the file to be saved.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

data

BLOB

Exported data as a BLOB.

component

VectorMap

The UI component's instance.

cancel

Boolean

Allows you to prevent file saving.

Default Value: null

onIncidentOccurred

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

Selector: @incident-occurred
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
target any

Information on the occurred incident.

model any

The model data. Available only if you use Knockout.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

VectorMap

The UI component's instance.

Default Value: null

The UI component notifies you of errors and warnings by passing messages to the browser console. Each message contains the incident's ID, a brief description, and a link to the Errors and Warnings section where further information about this incident can be found.

The onIncidentOccurred function allows you to handle errors and warnings the way you require. The object passed to it contains the target field. This field provides information about the occurred incident and contains the following properties:

  • id
    The incident's ID. The full list of IDs can be found in the Errors and Warnings section.
  • type
    The incident's type: "error" or "warning".
  • args
    The argument of the incident's message. Depends on the incident. For example, it may be the name of the data source field that was specified incorrectly, or the name of the property that was not set properly.
  • text
    The text passed to the browser's console. Includes the args content, if there is any.
  • widget
    The name of the UI component that produced the error or warning.
  • version
    The used DevExtreme version.

onInitialized

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

Selector: @initialized
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

VectorMap

The UI component's instance.

Default Value: null

Angular
app.component.html
app.component.ts
<dx-vector-map ...
    (onInitialized)="saveInstance($event)">
</dx-vector-map>
import { Component } from "@angular/core";
import VectorMap from "devextreme/ui/data_grid";
// ...
export class AppComponent {
    vectorMapInstance: VectorMap;
    saveInstance (e) {
        this.vectorMapInstance = e.component;
    }
}
Vue
App.vue (Options API)
App.vue (Composition API)
<template>
    <div>
        <DxVectorMap ...
            @initialized="saveInstance">
        </DxVectorMap>
    </div>
</template>

<script>
import DxVectorMap from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap
    },
    data: function() {
        return {
            vectorMapInstance: null
        };
    },
    methods: {
        saveInstance: function(e) {
            this.vectorMapInstance = e.component;
        }
    }
};
</script>
<template>
    <div>
        <DxVectorMap ...
            @initialized="saveInstance">
        </DxVectorMap>
    </div>
</template>

<script setup>
import DxVectorMap from 'devextreme-vue/vector-map';

let vectorMapInstance = null;

const saveInstance = (e) => {
    vectorMapInstance = e.component;
}
</script>
React
App.js
import VectorMap from 'devextreme-react/vector-map';

class App extends React.Component {
    constructor(props) {
        super(props);

        this.saveInstance = this.saveInstance.bind(this);
    }

    saveInstance(e) {
        this.vectorMapInstance = e.component;
    }

    render() {
        return (
            <div>
                <VectorMap onInitialized={this.saveInstance} />
            </div>
        );
    }
}
See Also
jQuery
  • Get a UI component Instance in jQuery
Angular
  • Get a UI component Instance in Angular
Vue
  • Get a UI component Instance in Vue
React
  • Get a UI component Instance in React

onOptionChanged

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

Selector: @option-changed
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
value any

The modified property's new value.

previousValue any

The UI component's previous value.

name

String

The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into.

model any

Model data. Available only if you use Knockout.

fullName

String

The path to the modified property that includes all parent properties.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

VectorMap

The UI component's instance.

Default Value: null

The following example shows how to subscribe to component property changes:

jQuery
index.js
$(function() {
    $("#vectorMapContainer").dxVectorMap({
        // ...
        onOptionChanged: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-vector-map ...
    (onOptionChanged)="handlePropertyChange($event)"> 
</dx-vector-map>
import { Component } from '@angular/core'; 

@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['./app.component.css'] 
}) 

export class AppComponent { 
    // ...
    handlePropertyChange(e) {
        if(e.name === "changedProperty") { 
            // handle the property change here
        }
    }
}
import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule } from '@angular/core'; 
import { AppComponent } from './app.component'; 
import { DxVectorMapModule } from 'devextreme-angular'; 

@NgModule({ 
    declarations: [ 
        AppComponent 
    ], 
    imports: [ 
        BrowserModule, 
        DxVectorMapModule 
    ], 
    providers: [ ], 
    bootstrap: [AppComponent] 
}) 

export class AppModule { }  
Vue
App.vue
<template> 
    <DxVectorMap ...
        @option-changed="handlePropertyChange"
    />            
</template> 

<script>  
import 'devextreme/dist/css/dx.light.css'; 
import DxVectorMap from 'devextreme-vue/vector-map'; 

export default { 
    components: { 
        DxVectorMap
    }, 
    // ...
    methods: { 
        handlePropertyChange: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    } 
} 
</script> 
React
App.js
import React from 'react';  
import 'devextreme/dist/css/dx.light.css'; 

import VectorMap from 'devextreme-react/vector-map'; 

const handlePropertyChange = (e) => {
    if(e.name === "changedProperty") {
        // handle the property change here
    }
}

export default function App() { 
    return ( 
        <VectorMap ...
            onOptionChanged={handlePropertyChange}
        />        
    ); 
} 

onSelectionChanged

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

Selector: @selection-changed
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
component

VectorMap

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

target

Layer Element

The selected/deselected layer element; described in the Layer Element section.

Default Value: null
Cannot be used in themes.

To identify whether the selection has been applied or canceled, call the layer element's selected() method.

onTooltipHidden

A function that is executed when a tooltip becomes hidden.

Selector: @tooltip-hidden
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
component

VectorMap

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

target

Layer Element

|

VectorMap Annotation

The layer element whose tooltip is hidden; described in the Layer Element section.

Default Value: null
Cannot be used in themes.

onTooltipShown

A function that is executed when a tooltip appears.

Selector: @tooltip-shown
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
component

VectorMap

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

target

Layer Element

|

VectorMap Annotation

The layer element whose tooltip is shown; described in the Layer Element section.

Default Value: null
Cannot be used in themes.

onZoomFactorChanged

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

Selector: @zoom-factor-changed
Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
component

VectorMap

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

The model data. Available only if you use Knockout.

zoomFactor

Number

The updated zoom factor.

Default Value: null
Cannot be used in themes.

panningEnabled

Disables the panning capability.

Selector: panning-enabled
Type:

Boolean

Default Value: true

Setting this property to false disables a user to pan the map. However, you still can pan the map in code using the center(centerCoordinates) and viewport(viewportCoordinates) methods.

pathModified

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

Selector: path-modified
Type:

Boolean

Default Value: false
Cannot be used in themes.

If you place the UI component on a page that uses a tag modifying the path (<base>, <iframe>, etc.), some of the UI component elements may get mixed up or disappear. To solve this problem, set the pathModified property to true.

See Also

projection

Specifies the map projection.

Selector: DxProjection
Default Value: 'mercator'
Cannot be used in themes.

You can use one of the following out-of-the-box projections:

To set a custom projection, implement two functions (from and to) that convert coordinates from geographical to UI component coordinate systems. The to callback is executed to render initial data in VectorMap. The from callback is called when a user executes the pan or move action. The from and to callbacks should have the same ratio:

JavaScript
 const projection = {
    from: ([x, y]) => [x * A, y * B],
    to: ([lon, lat]) => [lon / A, lat / B],
};

In addition, specify the projection's aspectRatio.

Custom Projection Demo Floor Plan Demo

redrawOnResize

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

Selector: redraw-on-resize
Type:

Boolean

Default Value: true
Cannot be used in themes.

When this property is set to true, the UI component will be redrawn automatically in case the size of its container changes.

rtlEnabled

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

Selector: rtl-enabled
Type:

Boolean

Default Value: false
Cannot be used in themes.

When this property is set to true, the UI component text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.

JavaScript
DevExpress.config({
    rtlEnabled: true
});
NOTE
In a right-to-left representation, SVG elements have the direction attribute with the rtl value. This might cause problems when rendering left-to-right texts. Use this property if you have only right-to-left texts.

size

Specifies the UI component's size in pixels.

Selector: DxSize
Type: viz/core/base_widget:BaseWidgetSize
Default Value: {height: 400, width: 800}

You can specify a custom width and height for the component:

Fixed Relative
Assign values to the size object's height and width properties or specify a container for the component. Specify a container for the component. The component occupies the container area.
NOTE
The size object has priority over the container.
jQuery
index.js
$(function() {
    $("#vectorMapContainer").dxVectorMap({
        // ...
        size: {
            height: 300,
            width: 600
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-vector-map ... >
    <dxo-size
        [height]="300"
        [width]="600">
    </dxo-size>
</dx-vector-map>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxVectorMapModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxVectorMapModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxVectorMap ... >
        <DxSize
            :height="300"
            :width="600"
        />
    </DxVectorMap>
</template>

<script>

import DxVectorMap, {
    DxSize
} from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap,
        DxSize
    },
    // ...
}
</script>
React
App.js
import React from 'react';

import VectorMap, {
    Size
} from 'devextreme-react/vector-map';

class App extends React.Component {
    render() {
        return (
            <VectorMap ... >
                <Size
                    height={300}
                    width={600}
                />
            </VectorMap>
        );
    }
}
export default App;

Alternatively, you can use CSS to style the UI component's container:

jQuery
index.js
styles.css
$(function() {
    $("#vectorMap").dxVectorMap({
        // ...
    });
});
#vectorMap {
    width: 85%;
    height: 70%;
}
Angular
app.component.html
app.styles.css
<dx-vector-map ...
    id="vectorMap">
</dx-vector-map>
#vectorMap {
    width: 85%;
    height: 70%;
}
Vue
App.vue
<template>
    <DxVectorMap ...
        id="vectorMap">
    </DxVectorMap>
</template>

<script>
import DxVectorMap from 'devextreme-vue/vector-map';

export default {
    components: {
        DxVectorMap
    },
    // ...
}
</script>

<style>
#vectorMap {
    width: 85%;
    height: 70%;
}
</style>
React
App.js
styles.css
import React from 'react';

import VectorMap from 'devextreme-react/vector-map';

class App extends React.Component {
    render() {
        return (
            <VectorMap ...
                id="vectorMap">
            </VectorMap>
        );
    }
}
export default App;
#vectorMap {
    width: 85%;
    height: 70%;
}

theme

Sets the name of the theme the UI component uses.

Type:

Theme

Default Value: 'generic.light'

A theme is a UI component configuration that gives the UI component a distinctive appearance. You can use one of the predefined themes or create a custom one. Changing the property values in the UI component's configuration object overrides the theme's corresponding values.

title

Configures the UI component's title.

Selector: DxTitle
Type: viz/core/base_widget:BaseWidgetTitle

The UI component's title is a short text that usually indicates what is visualized. If you need to specify the title's text only, assign it directly to the title property. Otherwise, set this property to an object with the text and other fields specified.

The title can be accompanied by a subtitle elaborating on the visualized subject using the title.subtitle object.

tooltip

Configures tooltips.

Selector: DxTooltip
Type:

Tooltip

A tooltip is a miniature rectangle displaying data of an area or a marker. A tooltip appears when the end-user hovers the cursor over an area or a marker. To show tooltips, do the following.

  • Enable tooltips.
    Set the enabled property to true.

  • Specify text to be displayed in tooltips. Specify the customizeTooltip property.

You can also change the appearance of tooltips using fields of the tooltip configuration object.

View Demo

touchEnabled

Specifies whether the map should respond to touch gestures.

Selector: touch-enabled
Type:

Boolean

Default Value: true

Assign false to this property if your map is not supposed to be viewed on touch-enabled devices.

wheelEnabled

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

Selector: wheel-enabled
Type:

Boolean

Default Value: true

Rolling the mouse wheel zooms a map. If you need to disable this capability, assign false to the wheelEnabled property. A user will still be able to zoom the map using the control bar.

zoomFactor

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

Selector: zoom-factor
Type:

Number

Default Value: 1
Cannot be used in themes.

Use this property to specify a zoom factor for a map while configuring it. This property accepts a value that is greater than 1. Note that the zooming is performed with relation to the center of the map.

zoomingEnabled

Disables the zooming capability.

Selector: zooming-enabled
Type:

Boolean

Default Value: true

Setting this property to false disables a user's ability to zoom the map. However, you can still zoom the map in code using the zoomFactor(zoomFactor) method.