2

This question already has an answer here:

I would like to keep in black a part of my label (title) and make the other one varying according to a value.

In this (simplified) example, as required, the value color is varying according to a concentration, but also the title.

enter image description here

I would like to keep the first line in black and make the second one varying.

Text formula:

'Drill ' ||  "id"    ||  '\n'  || 
CASE
    WHEN "Conc" >100 
        THEN  
            "Polutant"  || ': ' ||  "Conc" 
        else
        ''
END

Color formula:

if  ("Conc"> 220, color_rgb( 255,0,0) , color_rgb( 0,0,0))

Can QGis handle such a situation and how, or have I to program a function? In this last case, do you have an example to put me on the right way?

marked as duplicate by underdark qgis Feb 7 '18 at 17:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I would just use rule-based labeling and offset the 2nd line below the title – DPSSpatial Feb 7 '18 at 17:55

Browse other questions tagged or ask your own question.