I need to set different font sizes and different colours for my text strings, which appear in QGIS 3.x labels.
I found a solution at Setting different colors based on value when labeling using QGIS but it doesn't work in my case.
In my data attribute table, which looks like below:
I used the "text" column to define my label.
Now, I want to distinguish some strings, making them bigger (font size) and red instead of black.
Basing on the solution from the link above I prepared the simple function: "color24" = 1
unfortunately, along with the red color, I am getting the "1" value.
In the other case, when my function looks like:
CASE
WHEN "Text" like '%GW%' then color_rgb (255, 0, 0)
END
I am getting nothing.
Is anyone able to help with this? I need to know how to change the font size and the font color on a categorized basis.
After the function:
CASE When "Color24" = 1 Then color_rgb(255,0,0)
end
and other settings, as seen in the image below...
gives the answer, but eventually, the result doesn't work properly. Mainly only 1 of 3 labels are changed. They shift between older settings and new one as the zoom level changes.
How can I fix it?
data defined override
instead of rule based labelling. Also, try removing the space betweencolor_rgb
and the(
. Also, it is rather unclear what you set where.