Controls
Legend

Legend Control

A legend control is responsible for managing the collection of legends currently visible within the context of an interface or map and provides the interface needed for adding and removing legends.

// Initialize a legend control
val legendControl = LegendControl()
 
// Adds a legend control to the map.
controller.add(legendControl)
 
// Removes the legend control
controller.removeLegendControl()

Refer to the LegendControl API reference for more information about the available properties and methods.

Legend Presentation

Once a LegendControl has been configured and added to the MapController, it is the client’s responsibility to place the view appropriately within the view hierarchy.

The presentation method will vary depending on the UI framework, as shown below. For best results, fix the view’s width to the desired layout and allow its height to adjust automatically based on its intrinsic content size.