UseSelectOnClick: Boolean;
The UseSelectOnClick property determines whether item can be selected by means of the mouse cursor.
The property value can be set from JSON or using the setUseSelectOnClick method.
The property is set to True if the item can be selected by means of the mouse cursor, otherwise the value is False.
To execute the example, the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Handle the ItemSelecting and ItemSelected events displaying to the browser console identifier of being selected map layer area and name of selected map layer area correspondingly:
// Enable selection of map layer areas on mouse click map.setUseSelectOnClick(true); // Handle the ItemSelecting event map.ItemSelecting.add(function (sender, args) { console.log("Identifier of selected area: " + args.ItemId); }); // Handle the ItemSelecting event map.ItemSelected.add(function (sender, args) { // Get map layer area by identifier var shape = map.getShape(args.ItemId); console.log("Name of selected area: " + shape.getValue()); });
Select the following regions in the map of Russia using mouse pointer: Krasnoyarsk region and Sakha. After that the browser console displays identifiers of the map layer areas being selected and names of selected areas:
Identifier of the area being selected: RU-KYA
Name of the selected area: Krasnoyarsk region
Identifier of the area being selected: RU-SA
Name of the selected area: Sakha
See also: