add

fun add(legend: Legend)

Adds a legend to the container.

Implementation Details:

  • Increments a reference count for the legend ID.

  • If it's a new ID, it determines the initial unit system (Metric vs Imperial)

  • Applies the control's current units (synced with the map host) so legend ticks match data-query *-text labels.

  • Injects a LegendView and manages vertical separators.

Parameters

legend

The legend data to be visualized.