Use the label option instead.

Configures area labels.

Type: Object

An area label is a text that accompanies a map area. Usually, an area label displays the name of a certain geographical object, such as a country, a continent, etc.

Texts for area labels are provided by one of the fields of the attributes object. This object must be declared in the map data source, while the required field must be assigned to the dataField option of the label object.

If you have provided data for area labels, enable them on your map by assigning true to the enabled option of the label object.

In addition, you can change the appearance of area labels using the label.font object.

View Demo



Use the dataField option instead.

Specifies the data field that provides data for area labels.

Type: String

The map data source can contain an object of attributes assigned to the attributes field. In order to display area labels, assign the name of one of these attributes to the label's dataField option.



Use the enabled option instead.

Enables area labels.

Type: Boolean

After you have enabled area labels in your map, specify the field that provides data for them using the label's dataField option.



Use the font option instead.

Specifies font options for area labels.

Type: Object