Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Persistent Colors for 'Others'

Hi everyone,

I wanted to have persistent colors for field values. I successfully did this by attaching an Excel table with RGB codes, and putting RGB(R,G,B) in Chart Properties -> Background Color.

However, I have a new problem. I have a chart with Dimension Limits -> Show Only Largest 10 Values. I want to show 'Others'. However, how can I set the color for 'Others'? I cannot use the setting in the Colors tab anymore, because I am using a definition in Expressions-> Background Color. Is using an IF statement the only way to do this? If so, can anyone provide the syntax?

Thanks!

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

Ok.  no point in not using the simple solution if we don't have too:)

I adapted my expression to your QVW and  2 dimensions. See it below. Fluorescent green is not a mandatory color either

If(

  isnull(rank(  aggr(sum(Amount),Year,Country) )) ,

  LightGreen(),

rgb(R,G,B)

)

Capture.PNG.png

View solution in original post

9 Replies
Not applicable
Author

Still looking for a solution to this problem. Anyone have a suggestion?

JonnyPoole
Employee
Employee

Here is a solution using rank() to figure out if its 'Others' or not

Capture.PNG.png

Not applicable
Author

Hi Jon,

Thank you very much for your reply and the QVW. Unfortunately it does not seem to be working. My graph is using two dimensions, both Country and Year, to display stacked bar charts over time. In that case do I need to do anything differently?

JonnyPoole
Employee
Employee

Not sure. Can you share a sample that matches what you are trying to do ? 

Not applicable
Author

Here you go. This QVW is using a hierarchy function, I hope it does not confuse you. You will see that I have set dimension limit to 4 - please let me know how I can control the colors of both the first 3 values, and also "Others".

JonnyPoole
Employee
Employee

hmm... in this QVW sample the colors tab / 'others' color setting seems to work.

Here is sample color change :

Untitled.png

Not applicable
Author

Hi Jon,

Sorry - I was not being clear what my problem was. Please see the new attached QVW and excel data file. I have used rgb(R,G,B) for Background Colors expression in order to control Country color. However, this forces Others to become black. Is there a way to control Others color if I am using RGB function?

JonnyPoole
Employee
Employee

Ok.  no point in not using the simple solution if we don't have too:)

I adapted my expression to your QVW and  2 dimensions. See it below. Fluorescent green is not a mandatory color either

If(

  isnull(rank(  aggr(sum(Amount),Year,Country) )) ,

  LightGreen(),

rgb(R,G,B)

)

Capture.PNG.png

Not applicable
Author

It worked! Thank you so, SO much Jon! Just had to include the second dimension in the aggr function, duh!