Outdated version of the documentation. Find the latest one here.

` `

L’élément Légende

To add a map legend, click the addLegend Add new legend icon, place the element with the left mouse button on the Print Composer canvas and position and customize the appearance in the legend Item Properties panel.

The Item properties panel of a legend item provides the following functionalities (see figure_composer_legend):

../../../../_images/legend_properties.png

Legend Item Properties Panel

Propriétés principales

The Main properties dialog of the legend Item Properties panel provides the following functionalities (see figure_composer_legend_ppt):

../../../../_images/legend_mainproperties.png

Legend Main properties Dialog

Dans les Propriétés Principales vous pouvez :

  • change the title of the legend;
  • set the title alignment to Left, Center or Right;
  • choose which Map item the current legend will refer to in the select list;
  • wrap the text of the legend title on a given character;
  • use checkbox Resize to fit contents to control whether or not a legend should be automatically resized to fit its contents. If unchecked, then the legend will never resize and instead just stick to whatever size the user has set. Any content which doesn’t fit the size is cropped out.

Objets de légende

The Legend items dialog of the legend Item Properties panel provides the following functionalities (see figure_composer_legend_items):

../../../../_images/legend_items.png

Legend Items Dialog

  • La légende sera automatiquement mise à jour si checkbox Mise à jour auto est cochée. Lorsque Mise à jour auto n’est pas cochée, cela vous donnera plus de contrôle sur les éléments de la légende. Les icônes en-dessous de la liste des éléments de légende seront activés.

  • La fenêtre des éléments de légende répertorie tous les éléments de la légende et vous permet de changer l’ordre des éléments, de grouper les couches, de supprimer ou de restaurer des éléments de la liste, de modifier les noms des couche et d’ajouter un filtre.

    • The item order can be changed using the arrowUp and arrowDown buttons or with ‘drag-and-drop’ functionality. The order can not be changed for WMS legend graphics.
    • Use the addGroup button to add a legend group.
    • Use the signPlus button to add layers and signMinus button to remove groups, layers or symbol classes.
    • The projectProperties button is used to edit the layer, group name or title. First you need to select the legend item. Double-clicking the item also opens the text box to rename it.
    • The sum button adds a feature count for each class of vector layer.
    • With the filterMap Filter legend by map content button, only the legend items visible in the map will be listed in the legend. This tool remains available when checkbox Auto-update is active.
    • The expressionFilter Filter legend by expression helps you filter which of the legend items of a layer will be displayed, i.e. using a layer that has different legend items (e.g., from a rule-based or categorized symbology), you can specify a boolean expression to remove from the legend tree, styles that have no feature satisfying a condition. Note that the features are nevertheless kept and shown in the composer map item.

    While the default behavior of the legend item is to mimic the Layers panel tree, displaying the same groups, layers and classes of symbology, right-click any item offers you options to hide layer’s name or raise it as a group or subgroup. In case you have made some changes to a layer, you can revert them by choosing Reset to defaults from the contextual menu.

    After changing the symbology in the QGIS main window, you can click on [Update All] to adapt the changes in the legend element of the Print Composer.

  • While generating an atlas with polygon features, you can filter out legend items that lie outside the current atlas feature. To do that, check the checkbox Only show items inside current atlas feature option.

Polices, Colonnes, Symbole et Espacement

The Fonts, Columns and Symbol dialogs of the legend Item Properties panel provide the following functionalities (see figure_composer_legend_fonts):

../../../../_images/legend_fonts.png

Legend Fonts, Columns and Symbol Dialogs

  • You can change the font of the legend title, group, subgroup and item (layer) in the legend item. Click on a category button to open a Select font dialog.
  • You provide the labels with a Color using the advanced color picker, however the selected color will be given to all font items in the legend..
  • Legend items can be arranged over several columns. Set the number of columns in the Count selectNumber field.
    • La case checkbox Égaliser la largeur des colonnes permet d’ajuster la taille des colonnes de la légende.

    • L’option checkbox Séparer les couches permet de présenter sur plusieurs colonnes les éléments de légende d’une couche ayant un style catégorisé ou gradué.

  • You can also change the width and height of the legend symbol, set a color and a thickness in case of raster layer symbol.

Légende Graphique WMS et Espacement

The WMS LegendGraphic and Spacing dialogs of the legend Item Properties panel provide the following functionalities (see figure_composer_legend_wms):

../../../../_images/legend_wms.png

WMS LegendGraphic and Spacing Dialogs

When you have added a WMS layer and you insert a legend composer item, a request will be sent to the WMS server to provide a WMS legend. This Legend will only be shown if the WMS server provides the GetLegendGraphic capability. The WMS legend content will be provided as a raster image.

La Légende WMS est utilisée pour ajuster la Largeur de la légende et la Hauteur de la légende pour la légende WMS des images raster.

Spacing around title, group, subgroup, symbol, icon label, box space or column space can be customized through this dialog.