TransWikia.com

Wrapping legend text in QGIS MapComposer at character count

Geographic Information Systems Asked by Enzo Baldini on December 11, 2020

I want to wrap legend text after a certain amount of characters. Is there an automatic way to do that?

I don’t want to enter a character (e.g. *) for each line as described in this post, that is too much work…

enter image description here

Edit: I tried to use an expression, but the button is greyed out…

enter image description here

One Answer

You could use an expression string for your labels:

enter image description here

with_variable( 'column',37,
   if(length(@symbol_label) > @column,
      regexp_replace(left(@symbol_label,@column),'(.+)([s,;.])([^s,;.]+)$','12n3') + substr(@symbol_label,@column+1),@symbol_label))

Without expression string: enter image description here

With expression string: enter image description here

Answered by christoph on December 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP