[Qgis-user] Data defined text color in QGIS3 print composer?

Andreas Neumann a.neumann at carto.net
Tue Aug 13 13:27:16 PDT 2019


Hi Raymond,

Right - this is a good workaround until the data-defined override 
support ends up at the text label object.

Fairly easy to implement.

Thanks for the idea,

Andreas

Am 13.08.19 um 21:48 schrieb Raymond Nijssen:
> Hi Ville,
>
> Not exactly what you asked for, but you could get a similar result 
> with this workaround using html-frames.
>
>
> 1. Add an html-frame to your layout.
> 2. Create an expression that generates the html source (not the URL)
> 3. Set "evaluate expression as html source"
> 4. Press "update" to check.
>
> For me this works in an atlas. As an example I used this:
>
> <h1 style="color: [%CASE WHEN $id % 2 = 0 THEN '#00ff00' ELSE 
> '#0000ff' END%]">Feature: [% $id %]<h1>
>
> Which will generate html code based on the feature id. If the id is 
> odd the text will be blue and if even it will be green.
>
> 0:
> <h1 style="color: #00ff00">Feature: 0<h1>
>
> 1:
> <h1 style="color: #0000ff">Feature: 1<h1>
>
>
> Hope this works for you.
>
> Raymond
>
>
> On 13-08-19 14:43, Ville Koivisto wrote:
>> *Hi list,*
>>
>> Do we have a possibility to define print composer text’s color 
>> according to data values? I would like to assign certain colors based 
>> on values in one field. So looking the exact same thing as you have 
>> in layer’s symbology and label settings in the right edge of the panels.
>>
>> *Best regards,*
>>
>> Ville Koivisto
>>
>> +35840 701 4283
>>
>> GIS Expert
>>
>> Suomen kuntotekniikka Oy
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the Qgis-user mailing list