Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Gradient Colour in straight table

Hi All,

I have a situation where I need 3 colors , Red, white and green in straight table , if the value is increasing it should increase towards green and if the value is decreasing it should be towards red .

for example :

if my expression returns -2 it should be darker red

and if my expression returns -1 it should be less red

same way if my expression returns +2 it should be lighter green

and if my expression returns +4 it should be darker green.

Any help is much appreciated .

Thanks

6 Replies
Anonymous
Not applicable
Author

Peter_Cammaert
Partner - Champion III
Partner - Champion III

See the ColorMix1() and ColorMix2() functions in QV Desktop help. The first one selects a gradient color between two extremes (red and green in your case), the second one allows you to add a third color for the center.

You may have to do some calculations on the expression results to bring them into range, though.

Anonymous
Not applicable
Author

ColorMix Wizard.pngHi,

You can try ColorMix wizard option in subexpression (background color).

Not applicable
Author

Hi Peter, as suggested I am using colormix function but when I enter my expressions which is the below one

(CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100 . I have expression which is the combination of other column names and variables .

so when I enter the expression using color wizard .my expression is failing.

all I need is 3 colours , Red, white and green .

the below expression is what I am getting if I use colormix wizard :

ColorMix1 ((1+Sign(2*((CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100-RangeMin (top(total (CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100,1,NoOfRows(total))))/(RangeMax (top(total (CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100,1,NoOfRows(total)))-RangeMin (top(total (CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100,1,NoOfRows(total))))-1)*Sqrt(Fabs((2*((CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100-RangeMin (top(total (CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100,1,NoOfRows(total))))/(RangeMax (top(total (CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100,1,NoOfRows(total)))-RangeMin (top(total (CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100,1,NoOfRows(total))))-1))))/2, ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0))=(CurrentMonth-CompareTO)/$(vlob) *$(vlob2)*100

can you correct if i am doing anything wrong , I followed the default options in the colormix wizard

Peter_Cammaert
Partner - Champion III
Partner - Champion III

In the ColorMix wizard, disable "Auto Normalize" and especially disable "Enhanced colors". That makes your output simpler and more manageable.

First, you'll have to decide on expected min/max values.

Best,

Peter