A newer version of this page is available. Switch to the current version.

JavaScript/jQuery VectorMap - Layer Element.Methods

Methods used to control the vector map layer element.

applySettings(settings)

Applies the layer element settings and updates element appearance.

Parameters:
settings:

Object

A configuration object for the element.

The settings object should contain one or more properties to be changed for the layer element. The properties available to change using this method are listed in the layers property description.

Note that you cannot change the dataSource property for a separate layer element.

attribute(name)

Gets the value of an attribute.

Parameters:
name:

String

The name of an attribute.

Return Value: any

The value of the required attribute.

The map marker data source can contain an object of attributes assigned to the attributes field. These attributes can hold any information you require. To obtain the value of an attribute, call the attribute(name) method with the name of the required attribute passed as the parameter.

attribute(name, value)

Sets the value of an attribute.

Parameters:
name:

String

The name of an attribute.

value: any

The new attribute value.

coordinates()

Gets the layer element coordinates.

Return Value:

Object

The element coordinates.

selected()

Gets the selection state of the layer element.

Return Value:

Boolean

Is true when the element is selected, otherwise, false.

selected(state)

Sets the selection state of the layer element.

Parameters:
state:

Boolean

Pass true to select the element and false to deselect it.