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],
        text: 'Sacramento'
    }, {
        coordinates: [-97.75, 30.25],
        text: 'Austin'
    }, {
        coordinates: [-73.7572, 42.6525],
        text: 'Albany'
    }, {
        coordinates: [-84.2533, 30.455],
        text: 'Tallahassee'
    }, {
        coordinates: [-89.65, 39.783],
        text: 'Springfield'
    }
];

$(function () {
    $('#mapContainer').dxVectorMap({
        mapData: '/Content/data/vectorMap-sources/usa.txt',
        markers: markers,
        bounds: [-135, 60, -65, 20],
        zoomFactor: 1.25,
        tooltip: {
            enabled: true,
            customizeTooltip: function (element) {
                if (element.type == 'area') {
                    return {
                        text: element.attribute('name')
                    };
                }
            }
        }
    });
});