Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
helge_jorg
Contributor

Bar Chart - Color by expression

Hi all,

I know that similar questions have been asked before and I have tried to follow the suggestions, but I still struggle to define colours to the different bars in my chart.

I would like to define the different colours to the different measurements in my bar chart (oil and ags) using colour by expression. Oil should be green and gas should be red.

Hopefully some uf you can help me

Cheers

Helge

snip_20160912105944.png

snip_20160912111630.png

1 Reply
Partner
Partner

Re: Bar Chart - Color by expression

Do you have a dimension (or can you create a dimension) where you can tell if it is gas or oil?

maybe it also works on a measruement, but i'm not sure, never tried.

Here is my example:

I have a dimension "Doelgroep", on which i coloured my measures, like this:

Doelgroep.PNG

I used this code for coloring the measures:

if(Doelgroep = 'Primair',vRed,

if(Doelgroep = 'Secundair',vBlue))

I put the code here

where.PNG

(Op uitdrukking = On expresion || Uiterlijk = Appearance)

Don;t forget the box "expression is a colorcode" (or whatever it may be in English).

I declared to variables with the Hex codes, you don't have to do this, It is just a normal Hex code:

variable.PNG

Does this help?