Area Fields

This section describes the fields that can be used in code to manipulate the Area object.

type

Contains the element type.

Type: String

This field can be used to recognize whether an element is an area or a marker since it equals either the 'area' or 'marker'.

Show Example:
jQuery

In this example, tooltips are enabled only for areas. The type field of a map element is used to distinguish areas from markers. Hover over any area to see its tooltip.

<div id="mapContainer" style="height:500px; max-width:800px; margin: 0 auto"></div>
var markers = [{
	coordinates: [-121.2808, 38.3320],
	attributes: { name: 'Sacramento' }
}, {
	coordinates: [-97.75, 30.25],
	attributes: { name: 'Austin' }
}, {
	coordinates: [-73.7572, 42.6525],
	attributes: { name: 'Albany' }
}, {
	coordinates: [-84.2533, 30.455],
	attributes: { name: 'Tallahassee' }
}, {
	coordinates: [-89.65, 39.783],
	attributes: { name: 'Springfield' }
}];

$(function () {
    $('#mapContainer').dxVectorMap({
        mapData: '/Content/data/vectorMap-sources/usa.txt',
        markers: markers,
        bounds: {
            minLon: -135, maxLon: -65,
            minLat: 20, maxLat: 60
        },
        zoomFactor: 1.25,
        markerSettings: {
            customize: function (m) {
                return { text: m.attributes.name }
            }
        },
        tooltip: {
            enabled: true,
            customizeText: function (element) {
                if (element.type == 'area') {
                    return element.attribute('name');
                }
            }
        }
    });
});