Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Layout composer - Legend item expression not displaying correctly #53244

Closed
2 tasks done
Hopper92 opened this issue May 26, 2023 · 3 comments · Fixed by #53434
Closed
2 tasks done

Map Layout composer - Legend item expression not displaying correctly #53244

Hopper92 opened this issue May 26, 2023 · 3 comments · Fixed by #53434
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks

Comments

@Hopper92
Copy link

Hopper92 commented May 26, 2023

What is the bug or the crash?

When trying to set a legend item with an expression to rename to another field value the legend displays the expression rather than the target field value.

Steps to reproduce the issue

Set legend to auto update and only show items inside linked map:
image

Expression for the target layer and confirmation it is valid in the preview:
image

The legend in the map composer showing the expression rather than the target "unitname" value:
image

Versions

QGIS version
3.30.2-'s-Hertogenbosch
QGIS code revision
0992b53
Qt version
5.15.3
Python version
3.9.5
GDAL/OGR version
3.6.4
PROJ version
9.2.0
EPSG Registry database version
v10.082 (2023-02-06)
GEOS version
3.11.2-CAPI-1.17.2
SQLite version
3.41.1
PDAL version
2.5.2
PostgreSQL client version
unknown
SpatiaLite version
5.0.1
QWT version
6.1.6
QScintilla2 version
2.13.1
OS version
Windows 10 Version 2009

Active Python plugins
DataPlotly
4.0.1
debug_vs
0.7
enmapboxplugin
3.12.1
FreehandRasterGeoreferencer
0.8.3
geoscience
1.11
inspireatomclient
0.8.1
MagneticDeclination
2.3.1
mapswipetool_plugin
1.2
Mergin
2023.1
processing_saga_nextgen
0.0.7
ProjectPackager
0.7.2
project_report
1.2
qfieldsync
v4.4.9
Qgis2threejs
2.7.1
QGISSortAndNumber-master
1.0
quick_map_services
0.19.33
SemiAutomaticClassificationPlugin
7.10.11
slyr
6.3.1
slyr_community
4.0.7
splitmultipart
1.0.0
SpreadsheetLayers
2.1.0
SRTM-Downloader
3.1.17
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

I hope this one is an easy fix or an easy workaround is possible? Thankyou!

@Hopper92 Hopper92 added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 26, 2023
@YoannQDQ YoannQDQ added the Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks label May 28, 2023
@roya0045
Copy link
Contributor

Not a bug, the problem is that the expression generator has a feature context where it shouldn't have one to reflect the legend.

@Hopper92
Copy link
Author

Hopper92 commented Jun 1, 2023

Not a bug, the problem is that the expression generator has a feature context where it shouldn't have one to reflect the legend.

Thankyou for the response Alex. I don't really understand though, you might have to dumb it down for me haha. Is there a way to achieve what I want without having to manually type the other field value into the legend items?

@roya0045
Copy link
Contributor

roya0045 commented Jun 1, 2023

Depends on what you're using for the symbology. If it's only a single field you can use the collection function with the filter set to replicate the symbology rule used and pick the first element of the returned array. Though for that to work at the moment it will work in your symbol label is exactly the same value as what is used to perform the classification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants