Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Coloring and Divided Legend

I am having trouble conditionally formatting the colors within my chart to display red for values below zero and green for values above zero. My questions are as follows:

1) My colors are displaying based on my conditional statement, however, I like the style 'Light Gradient.' However, I wish the green would display as the other colors, in a solid manner.

     ssss.png

Example Chart

2) I would also like a split legend icon that represent two potential values for a single expression. For example, profit margin. If margins are below zero, it should be colored rgb(255,0,0), else rgb(0,255,0). 

split icon.png

Example Split Legend Icon

Thanks in advance to any and all help!

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

You can use the background color option of the expression (click on the plus sign in front of the expression) and use something like

if(MyExp<0,red(),green())

Where MyExp is the label of your expression (put between [] brackets if there are spaces)

LineGreenRed.png

View solution in original post

6 Replies
stigchel
Partner - Master
Partner - Master

Hi Michael,

1) Change the color in the color tab(You can not make/use gradient colors in expressions) or include it in your conditions  to display a solid color.

2) that's not natively possible, but you create your own custom legend, see e.g.

Listbox Color Chips | Qlikview Cookbook

stigchel
Partner - Master
Partner - Master

Hi Michael,

My previous post is in moderation, probably because I referred to an external link. This is an alternative link from the community, as this moderation may take some time

1) Change the color in the color tab(You can not make/use gradient colors in expressions) or include it in your conditions  to display a solid color.

2) that's not natively possible, but you create your own custom legend, see e.g.

Use of a Silent Legend

Not applicable
Author

Thanks for the fast reply. What is the syntax to display a solid color?

stigchel
Partner - Master
Partner - Master

You can use one of the following for e.g. red

=rgb(255,0,0)

=red()

=Color(1)

for the last one, 1 is an index referring to the colors in the color tab of the chart's properties, so only if color 1 is red

stigchel
Partner - Master
Partner - Master

You can use the background color option of the expression (click on the plus sign in front of the expression) and use something like

if(MyExp<0,red(),green())

Where MyExp is the label of your expression (put between [] brackets if there are spaces)

LineGreenRed.png

Not applicable
Author

Thanks Piet!