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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pie Chart Individual Colors

Hi,

I am using Qlikview 9.0. Is there was a way to change an individual Pie chart color with a given criteria(script)?

What I would like to do is run the Pie chart data thru some script criteria and if one of them meets it then change that particular color to something else.

Thanks,

Mike C.

5 Replies
johnw
Champion III
Champion III

You can enter an expression to select the color in the "Background Color" definition when you click on the + next to the expression. Here's an example expression:

pick(1+match(only(Customer),'Company 1','Company 2'),green(),red(),black())

So company 1's pie slice will be red, company 2's will be black, and the rest will be green. You can use rgb() expressions and other things to specify the colors themselves. I believe that if the expression doesn't assign a color to a pie slice, it will use the a default color from the color tab.

Not applicable
Author

Thanks for the reply John. I can use that.

Can you provide what's the simpliest formula to use in order to make that color change? I am doing a calculation to pull a percent value and if that value is greater or = (>=) than 60 then change the color.

I was trying this ->



If (round((Count(IF(PPE_EquipmentTestResults='P', PPE_EquipmentTestResults))*100/ Count(PPE_EquipmentTestResults)), .10) >=60,RGB(250,0,0))

Thanks,

Mike C.

johnw
Champion III
Champion III

Well, it's not really any simpler, but it will likely execute faster by using set analysis and avoiding the multiplication and the round() function:

if(count({<PPE_EquipmentTestResults*={'P'}>} PPE_EquipmentTestResults)/count(PPE_EquipmentTestResults)>=.5995,rgb(250,0,0))

Not applicable
Author

That worked great, Thanks.

I have one more question about the inital pie slice selection. In the example, is the "Customer" related to the dimension or expression?

Thanks,

Mike C.

johnw
Champion III
Champion III

In my example, Customer was the dimension, but I was setting the color for the expression.