Legend

The legend object shows a legend of the layers that are displayed in the map. Not every layer provides a legend. In addition to the legend image you can display the service title, layer name and group name (if a group exists).

../../../_images/legend1.png

Configuration

../../../_images/legend_configuration1.png
  • Auto-open: If activated, the legend opens when the application is started (default: active)

  • Title: Title of the element. The title will be listed in “Layouts”. Is also shown next to the button, if “Show layer title” is activated.

  • Show source title: shows WMS/source title (default: true)

  • Show layer title: shows layer title (default: true)

  • Show grouped layer title: shows group title for grouped layers (default: true)

The Legend element is integrated via a button or in the sidepane. If you look for configurational details for the button, head over to this page: Button.

Configuration Examples:

Legend in the Sidepane:

If yout want to integrate a legend in the sidepane, click the + -button in the “Layouts”-tab (section “Sidepane”).

../../../_images/add_sidepane2.png

Then, choose the element “Legend” in the appearing window. The configurational dialog “Add element – Legend” will open.

../../../_images/legend_example_sidepane_dialog1.png

Our configured element has the title “Legend”. The legend opens automatically (set checkbox Auto-open). Moreover, the layer title and the title of all grouped layers will appear if the checkboxes Show layer title and Show grouped layer title are set.

Given this configuration, the result looks like this:

../../../_images/legend_example_sidepane1.png

In the example the legend was added to the sidepane.

Legend in the toolbar

The legend element can be integrated with a button in the toolbar. First step: Open the application backend and add the legend element into the content section of the Layout tab.

../../../_images/add_content1.png

In this example, the following settings are chosen:

../../../_images/legend_example_toolbar_dialog1.png

In our example, the checkbox Auto-open is dismissed. Therefore, the legend opens only with a click on a button. This button has to be implemented into the toolbar section. For detailed instructions on buttons, see the Mapbender-Documentation page Button.

The configuration of a button can look like this:

../../../_images/legend_example_button1.png

Following the above instructions, the result in the application looks like this:

../../../_images/legend_example_toolbar1.png

The toolbar shows the button for the legend element. If the button is clicked, the dialog with the generated legend opens.

The activation and deactivation of checkboxes in the configurational settings leads to:

../../../_images/legend_example_toolbar_checkboxes1.png

YAML-Definition:

This template can be used to insert the element into a YAML application.

tooltip: 'Legend'                    # text to use as tooltip
elementType: dialog                  # dialog/blockelement (default: dialog)
autoOpen: true                       # true/false open when application is started (default: true)
displayType: list                    # accordion/list type of display (default: list)
target: ~                            # Id of Map element to query
hideEmptyLayer: true                 # true/false hide when no legend is available (default: true)
showWmsTitle: true                   # true/false show WMS title (default: true)
showLayerTitle: true                 # true/false show layer title (default: true)
showGroupedLayerTitle: true          # true/false show group title for grouped layers (default: true)

You can optionally use a button to show this element. See Button for inherited configuration options. You also can define the layertree with type element. Then you can display the layertree in a frame like the sidebar.