Configuration

An object defining configuration options for the dxMap widget.

accessKey

Specifies a shortcut key that sets focus on the widget element.

Type: String
Default Value: null

The accessKey option value is passed to the accesskey attribute of the actual HTML element of the widget.

activeStateEnabled

A Boolean value specifying whether or not the widget changes its state when interacting with a user.

Type: Boolean
Default Value: false

This option is used when the widget is displayed on a platform whose guidelines include the active state change for widgets.

autoAdjust

Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes.

Type: Boolean
Default Value: true

Note that the zoom level can only be decreased to display all markers and routes. If the current zoom level and center position allow all routes and markers to be displayed on the map, they remain unchanged.

center

An object, a string, or an array specifying the location displayed at the center of the widget.

You can specify the center value in one of the following formats.

  • { lat: 40.749825, lng: -73.987963}
  • "40.749825, -73.987963"
  • [40.749825, -73.987963]
  • 'Brooklyn Bridge,New York,NY'

controls

Specifies whether or not map widget controls are available.

Type: Boolean
Default Value: false

Assign a Boolean value to this option to enable or disable all controls at once - both the map navigation control and the map type control.

Show Example:
AngularJS
Knockout
jQuery

disabled

A Boolean value specifying whether or not the widget can respond to user interaction.

Type: Boolean
Default Value: false

Create an observable variable and assign it to this option to specify the availability of the widget at runtime.

Show Example:
AngularJS
Knockout
jQuery

focusStateEnabled

Specifies whether or not the widget can be focused.

Type: Boolean
Default Value: false
Default for generic:

true

height

Specifies the height of the widget.

Type: Number|String| function
Default Value: 300

The option can hold a value of the following types.

  • number
    The height of the widget in pixels

  • string
    A CSS measurement of the widget height (e.g., "55px", "80%", "auto" and "inherit")

  • function
    A function returning the widget height (e.g., height:function(){ return baseHeight - 10 + "%"; })

hint

Specifies the text of the hint displayed for the widget.

Type: String
Default Value: undefined

hoverStateEnabled

A Boolean value specifying whether or not the widget changes its state when being hovered by an end user.

Type: Boolean
Default Value: false

key

A key used to authenticate the application within the required map provider.

Type: String|Object
Default Value: ''

This option can hold a string representing an authentication key of a certain provider. In addition, this option can hold an object with specified keys for every used provider: { bing: BINGAPIKEY, google: GOOGLEAPIKEY, googleStatic: GOOGLESTATICAPI_KEY}.

For more information on authentication keys, see the required map provider documentation.

NOTE
The value of this option cannot be changed dynamically.

markerIconSrc

A URL pointing to the custom icon to be used for map markers.

Type: String

To set a custom icon for an individual marker, specify the iconSrc field of the corresponding marker data source object.

View Demo

markers

An array of markers displayed on a map.

Type: Array

An item of the array assigned to the markers option is an object containing the following properties.

  • location (required) - an object, a string, or an array specifying the marker location (see the center option description).
  • tooltip (optional) - takes on an object containing the text and isShown fields. The text field specifies the tooltip text. The isShown field takes on a Boolean value that specifies whether a tooltip is visible by default or not. If the tooltip should be hidden by default, pass the tooltip text directly to the tooltip property.
  • onClick (optional)- a callback function performed when the marker is clicked.
  • iconSrc (optional) - a URL pointing to the custom icon to be used for the marker.

If you use the Knockout approach when working with the dxMap widget, you can pass an observable array to the markers option to easily manage markers.

View Demo

Show Example:
AngularJS
Knockout
jQuery

onClick

A handler for the click event.

Type: function |String
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
location: Object
Specifies the location of the clicked point on the map (if the 'google' or 'bing' provider is used).
jQueryEvent: jQuery.Event
The jQuery event that caused action execution (if a static google provider is used).
Default Value: null

Assign a function to perform a custom action when the map is clicked.

To navigate to a specific URL when the click event fires, assign that URL or the anchor part (#) of that URL directly to this option as a string.

Show Example:
AngularJS
Knockout
jQuery

onDisposing

A handler for the disposing event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action when the widget is being removed.

NOTE
The function assigned to this option is executed only if the widget is removed using the remove(), empty(), or html() jQuery methods.

onInitialized

A handler for the initialized event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
Default Value: null

Assign a function to perform a custom action when the widget is initialized.

onMarkerAdded

A handler for the markerAdded event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
options: Object
Returns the object that defines the currently added marker in the "markers" array
originalMarker: Object
Returns an original marker object used by the current map provider (only for 'google' and 'bing' providers).
Default Value: null

Assign a function to perform a custom action after a marker is added to the map.

Show Example:
AngularJS
Knockout
jQuery

onMarkerRemoved

A handler for the markerRemoved event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
options: Object
Returns the object that defines the currently removed marker in the "markers" array.
Default Value: null

Assign a function to perform a custom action after a marker is removed from the map.

Show Example:
AngularJS
Knockout
jQuery

onOptionChanged

A handler for the optionChanged event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
name: String
Specifies the name of the option whose value is changed.
fullName: String
Specifies a full name of the option whose value is changed. The full name is formed by concatenating the names of the options that are presented in the hierarchy of the given option. The names are delimited by commas.
value: any
Specifies a new value for the option.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action after an option of the component is changed.

onReady

A handler for the ready event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
originalMap: Object
Provides access to the map instance of the current provider.
Default Value: null

Assign a function to perform a custom action after a map is rendered.

onRouteAdded

A handler for the routeAdded event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
options: Object
Returns the object that defines the currently added route in the "routes" array.
originalRoute: Object
Returns an original route object used by the current map provider (only for 'google' and 'bing' providers).
Default Value: null

Assign a function to perform a custom action after a route is added to the map.

Show Example:
AngularJS
Knockout
jQuery

onRouteRemoved

A handler for the routeRemoved event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
options: Object
Returns the object that defines the currently removed route in the "markers" array.
Default Value: null

Assign a function to perform a custom action after a route is removed from the map.

Show Example:
AngularJS
Knockout
jQuery

provider

The name of the current map data provider.

Type: String
Default Value: 'google'
Accepted Values: 'bing' | 'google' | 'googleStatic'
NOTE
The "googleStatic" provider does not create routes using streets, but rather connects route points using straight lines.

View Demo

Show Example:
AngularJS
Knockout
jQuery

routes

An array of routes shown on the map.

Type: Array

An item of the array assigned to the routes option is an object containing the following fields.

  • locations (required)
    Contains an array of objects making up the route. These objects have the same structure as an object passed to the center option.
  • mode (optional)
    Specifies a transportation mode to use in the displayed route. Acceptable values: 'driving' (set by default) and 'walking'.
  • color (optional)
    Specifies the color of the line displaying the route.
  • weight (optional)
    Specifies the thickness of the line displaying the route in pixels.
  • opacity (optional)
    Specifies the opacity of the line displaying the route.

View Demo

Show Example:
AngularJS
Knockout
jQuery

rtlEnabled

Specifies whether or not the current component supports a right-to-left representation.

Type: Boolean
Default Value: false

If you need to switch the display of this DevExtreme component to right-to-left, enable a specifically designed configuration option - rtlEnabled. When this option is set to true, the text flows from right to left, and the layout the component's elements is reversed. To switch the entire application/site to a right-to-left representation, use the static DevExpress.rtlEnabled field.

tabIndex

Specifies the widget tab index.

Type: Number
Default Value: 0

type

The type of a map to display.

Type: String
Default Value: 'roadmap'
Accepted Values: 'hybrid' | 'roadmap' | 'satellite'

The available option values are based on map types supported by the Google map provider. If you use the Bing map, the widget casts the option value to the appropriate value supported by the "Bing" provider.

  • hybrid -> Aerial
  • roadmap -> Road

View Demo

Show Example:
AngularJS
Knockout
jQuery

visible

A Boolean value specifying whether or not the widget is visible.

Type: Boolean
Default Value: true

width

Specifies the width of the widget.

Type: Number|String| function
Default Value: 300

The option can hold a value of the following types.

  • numeric - the widget width in pixels
  • string - a CSS measurement of the widget width (e.g., "55px", "80%", "auto" and "inherit")
  • function - the function returning the widget width (e.g., width:function(){ return baseWidth - 10 + "%"; })

zoom

The zoom level of the map.

Type: Number
Default Value: 1

By default, the widget sets the automatically calculated zoom value each time a marker or a route is added to the map. In this case, zoom is set to the maximum value, allowing all markers and routes to be displayed at the same time. Set the autoAdjust option to false to disable this behavior.

Note that if the autoAdjust option is set to true, the zoom level can only be decreased to display all markers and routes. If the current zoom level and center position allow all routes and markers to be displayed on the map, they remain unchanged.

Show Example:
AngularJS
Knockout
jQuery