Você está na página 1de 5

testing

English

(../../../index.html) » previous (composer_map.html) | next (composer_legend.html)


QGIS User Guide (../../index.html) » Laying out the maps (../index.html) » Layout Items
(index.html) »

TABLE OF CONTENTS (../../../INDEX.HTML)

User Guide/Manual (QGIS Testing) (../../index.html)


Preamble (../../preamble/preamble.html)
Foreword (../../preamble/foreword.html)
Conventions (../../preamble/conventions.html)
Features (../../preamble/features.html)
What’s new in QGIS testing (../../preamble/whats_new.html)
Getting Started (../../introduction/getting_started.html)
QGIS GUI (../../introduction/qgis_gui.html)
QGIS Configuration (../../introduction/qgis_configuration.html)
Working with Projections (../../working_with_projections
/working_with_projections.html)
General Tools (../../introduction/general_tools.html)
Managing Data Source (../../managing_data_source/index.html)
Working with Vector Data (../../working_with_vector/index.html)
Working with Raster Data (../../working_with_raster/index.html)
Working with Mesh Data (../../working_with_mesh/index.html)
Laying out the maps (../index.html)
Working with OGC Data (../../working_with_ogc/index.html)
Working with GPS Data (../../working_with_gps/index.html)
Authentication System (../../auth_system/index.html)
GRASS GIS Integration (../../grass_integration/grass_integration.html)
QGIS processing framework (../../processing/index.html)
Processing providers and algorithms (../../processing_algs/index.html)
Plugins (../../plugins/index.html)
Help and Support (../../preamble/help_and_support.html)
Contributors (../../preamble/contributors.html)
Appendix (../../appendices/appendices.html)
Literature and Web References (../../literature_web
/literature_and_web_references.html)
User Guide/Manual PDF's (https://docs.qgis.org/testing/pdf/)
PyQGIS Cookbook (QGIS Testing) (../../../pyqgis_developer_cookbook/index.html)
Developers Guide (../../../developers_guide/index.html)
Documentation Guidelines (../../../documentation_guidelines/index.html)
A Gentle Introduction to GIS (../../../gentle_gis_introduction/index.html)
Training Manual (../../../training_manual/index.html)
Docs in progress for ‘QGIS testing’. Visit https://docs.qgis.org/3.4 for QGIS
3.4 docs and translations.

The Label Item


Main properties
Appearance
Exploring expressions in a label item

The Label item is a tool that helps decorate your map with texts that would help to
understand it; it can be the title, author, data sources or any other information… You can
add a label with the (../../../../_images/mActionLabel.png) Add Label tool following
items creation instructions (composer_items_options.html#create-layout-item) and
manipulate it the same way as exposed in Interacting with layout items
(composer_items_options.html#interact-layout-item).

By default, the label item provides a default text that you can customize using its Item
Properties panel. Other than the items common properties
(composer_items_options.html#item-common-properties), this feature has the
following functionalities (see figure_layout_label):
Label Item Properties Panel

Main properties
The Main properties group is the place to provide the text (it can be in HTML) or the
expression to build the label. Expressions need to be surrounded by [% and %] in
order to be interpreted as such.

Labels can be interpreted as HTML code: check (../../../../_images


/checkbox.png) Render as HTML . You can now insert a URL, a clickable image that
links to a web page or something more complex.
You can also use expressions (../../working_with_vector
/expression.html#expression-builder): click on Insert an expression button, write
your formula as usual and when the dialog is applied, QGIS automatically adds the
surrounding characters.

Note

Clicking the Insert an Expression button when no selection is made in the textbox
will append the new expression to the existing text. If you want to update an existing
text, you need to select it the part of interest beforehand.

You can combine HTML rendering and expressions, leading to e.g. a text like:

[% '<b>Check out the new logo for ' || '<a href="https://www.qgis.org


" title="Nice logo" target="_blank">QGIS ' ||@@qqggiiss__sshhoorrtt__vveerrssiioonn || '
</a>' || ' : <img src="https://qgis.org/en/_downloads/qgis-icon128.pn
g" alt="QGIS icon"/>' %]

which will render: Check out the new logo for QGIS 3.0 (https://www.qgis.org) :
(../../../../_images/logo.png)

Appearance
Define Font by clicking on the Font… button or a Font color by pushing the color
widget (../../introduction/general_tools.html#color-selector).
You can specify different horizontal and vertical margins in mm . This is the margin
from the edge of the layout item. The label can be positioned outside the bounds of
the label e.g. to align label items with other items. In this case you have to use
negative values for the margin.
Using the text alignment is another way to position your label. It can be:
Left , Center , Right or Justify for Horizontal alignment
and Top , Middle , Bottom for Vertical alignment .

Exploring expressions in a label item


Below some examples of expressions you can use to populate the label item with
interesting information - remember that the code, or at least the calculated part, should
be surrounded by [% and %] in the Main properties frame:

Display a title with the current atlas feature value in “field1”:

'This is the map for ' || "field1"

or, written in the Main properties section:

This iiss the map ffoorr [% "field1" %]

Add a pagination for processed atlas features (eg, Page 1/10 ):

concat( 'Page ', @@aattllaass__ffeeaattuurreennuummbbeerr, '/', @@aattllaass__ttoottaallffeeaattuurreess )

Return the X coordinate of the bottom left corner of a map canvas:

x_min( map_get( item_variables( 'Map 1' ), 'map_extent' ) )

Retrieve the name of the layers in the current layout ‘Map 1’ item, and formats in one
name by line:

array_to_string(
array_foreach(
map_get( item_variables( 'Map 1' ), 'map_layers' ), -- retriev
e the layers list
layer_property( @@eelleemmeenntt, 'name' ) -- retrieve each layer name
),
'\\nn' -- converts the list to string separated by breaklines
)

(../../../index.html) » previous (composer_map.html) | next (composer_legend.html)


QGIS User Guide (../../index.html) » Laying out the maps (../index.html) » Layout Items
(index.html) »

(http://twitter.com/qgis)
(https://www.facebook.com/pages/QGIS-Quantum-GIS-/298112000235096)

(http://plus.google.com/communities/114776597176808981624)

(http://github.com/qgis/) (http://www.qgis.org/en/site/getinvolved/index.html)

If not stated otherwise, all content is licensed under Creative Commons Attribution-ShareAlike 3.0 licence (CC BY-
SA) (http://creativecommons.org/licenses/by-sa/3.0/)

Select graphics from The Noun Project collection (http://thenounproject.com)

Textual error, missing text or you know better: fix me (https://github.com/qgis/QGIS-Documentation/edit/master

/source/docs/user_manual/print_composer/composer_items/composer_label.rst)

Você também pode gostar