Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Setting Pie Chart Colours

Hi,

I have produced a pie chart that uses a Traffic Lighting system ie Red = High Risk, Amber = Medium Risk and Green = Low Risk.

The pie chart shows the data I require, however the colours are not consistent with the variables ie 'Red' = Green, 'Amber' = Red and 'Green' = Blue

I thought I could add the following expression to resolve this issue, but it doesn't seem to work:

if(TRAFFIC_LIGHTING='Red',rgb(220,20,60),if(TRAFFIC_LIGHTING='Amber',rgb(255,97,3),if(TRAFFIC_LIGHTING='Green',rgb(0,255,0))

I would really appreciate any ideas as to how to code this in the expressions tab.

Regards,

Daniel

8 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Could you please post your example?

danielnevitt
Creator
Creator
Author

Hi,

Thank you for your response, unfortunately I am unable to post the example as it contains the company trading data.

A sample is attached below:

TRADE_NUM          TRAFFIC_LIGHTING

7893897                  Red

7893360                  Amber      

7893359                  Red

7893355                  Green

7893871                  Red 

7893870                  Amber 

7893861                  Green

7893918                  Red

I then create a pie chart:

Count(TRADE_NUM)  

Dimensions TRAFFIC_LIGHTING

The pie chart shows Green as segment colour blue, Amber as segment colour red and Red as segment colour green.

Hope the above makes sense.

Regards,

Daniel

alexandros17
Partner - Champion III
Partner - Champion III

Hi, look at the proprierties of the expression (click on )

alexandros17
Partner - Champion III
Partner - Champion III

What about the answer I sent to you? Is it helpful?

danielnevitt
Creator
Creator
Author

Hi,

Thanks again for your reply.

Unfortunately I am on the personal edition of Qlikview at the moment.

Would it be possible to post the code on here?

Thanks for your help.

Regards,

Daniel

danielnevitt
Creator
Creator
Author

Hi,

Thanks again for your reply.

Unfortunately I am on the personal edition of Qlikview at the moment.

Would it be possible to post the code on here?

Thanks for your help.

Regards,

Daniel

alexandros17
Partner - Champion III
Partner - Champion III

the expression is correct, i,ve used the following code.

if

(TRAFFIC_LIGHTING='Red',rgb(255,0,0),

if(TRAFFIC_LIGHTING='Amber',rgb(255,97,3),RGB(0,255,0))

)

copy it in the background colour property for expression (click on the icon) and let me know the result.

Bye

Alessandro

danielnevitt
Creator
Creator
Author

Hi,

The pie chart now shows black for all the chart colours.

I added the the code to the following:

Expressions - Count(TRADE_NUM) - Background Color

I'm not sure where I can find the + icon you mention above.

Thanks,

Daniel