Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hlines_usacs
Contributor II

Color by Expression - Line Chart and Pie Chart

Hello,

I have a line chart and a bar chart in which I want to use the same expression to color.

Below is the expression and a screen shot of the two charts.

Is there a reason that they pie chart colors wouldn't work?

IF([Code] = '91'

,red()

    ,IF ([Code] = '83'

    ,blue()

        ,If(

 = '84'

            ,yellow()

        ,green()

                )

        )

   )

line and pie colors.jpg

25 Replies

Re: Color by Expression - Line Chart and Pie Chart

Try this you have some extra comma may be please check this now

IF( [Code] = 91,red(),

IF( [Code] = 83,blue(),

If(

  = 84,yellow(),green() )))

hlines_usacs
Contributor II

Re: Color by Expression - Line Chart and Pie Chart

That did not work. I also tried putting the values inside single quotes and that did not work either.

shraddha_g
Honored Contributor III

Re: Color by Expression - Line Chart and Pie Chart

in Color by Expression,

Pick(wildmatch([Code],'91','83','84','85'),

red(),

blue(),

yellow(),

green()

)

or

Pick(wildmatch(

,91,83,84,85),

red(),

blue(),

yellow(),

green()

)

sureshqv
Esteemed Contributor III

Re: Color by Expression - Line Chart and Pie Chart

Expression seeem correct,

did you tried with RGB values instead of  red,green,yellow?   try once

saurabh_karlewa
New Contributor II

Re: Color by Expression - Line Chart and Pie Chart

Expression looks OK.

It works form me with red, green,yellow and blue functions. However does not work with RGB values.

hlines_usacs
Contributor II

Re: Color by Expression - Line Chart and Pie Chart

Neither of these worked. I tried RGB values and those did not work either.

omarbensalem
Esteemed Contributor

Re: Color by Expression - Line Chart and Pie Chart

What version are you using?

hlines_usacs
Contributor II

Re: Color by Expression - Line Chart and Pie Chart

3.4 SR 4

omarbensalem
Esteemed Contributor

Re: Color by Expression - Line Chart and Pie Chart

Can u please share with me a "test app" containing only these 2 charts?