Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

color gradient

Hello all,

is there an option to dye numerative data gradualy.

so that e.g. 100% are colored "red" and 1% is colored "green".

I would be thankful for any advice.

greetings

daniel

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Daniel,

if you have a field with values between 0 and 1 (0 to 100 %), e.g. called Dye%, your background color attribute (e.g. in expression tab, open the attributes by clicking on the + sign next to the expression) could look like this:

=RGB(255* Dye% ,255-255* Dye%,0)

This looks like to be equivalent to using the colormix1 function:

=ColorMix1(Dye%,LightGreen(),LightRed())

If you want to get blue in the middle of the range, it could look like

=RGB(255*Dye%,255-255*Dye%,256-2*fabs(127-255*Dye%))

or (this looks different, more pure blue):

=colormix2(Dye%*2-1,LightGreen(),lightred(),LightBlue() )

See also attached,

Stefan

View solution in original post

4 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

I don't know whether I understood correctly, please check the attached image if you are expecting the same download QVW file from the below URL

http://ap.demo.qlik.com/QvAJAXZfc/opendoc.htm?document=qvdocs/Sales%20Management.qvw&host=Demo11

Refer Products tab and Margin (Heat chart)

Gradient.PNG

Hope this helps you.

Regards,

Jagan.

swuehl
MVP
MVP

Daniel,

if you have a field with values between 0 and 1 (0 to 100 %), e.g. called Dye%, your background color attribute (e.g. in expression tab, open the attributes by clicking on the + sign next to the expression) could look like this:

=RGB(255* Dye% ,255-255* Dye%,0)

This looks like to be equivalent to using the colormix1 function:

=ColorMix1(Dye%,LightGreen(),LightRed())

If you want to get blue in the middle of the range, it could look like

=RGB(255*Dye%,255-255*Dye%,256-2*fabs(127-255*Dye%))

or (this looks different, more pure blue):

=colormix2(Dye%*2-1,LightGreen(),lightred(),LightBlue() )

See also attached,

Stefan

Not applicable
Author

hi stefan,

thanks for your explanation. it was very helpful,

the "rgb" formula works fine in the range from 0 to 1        !

but how should a formula be defined , that

a) works in a range  form  " 0 to 100 "

and

b) is it although possible to dye dimensions, that are containing e.g. total amount of turnover?

greetings

daniel

Anonymous
Not applicable
Author

Hi Jagah,

I was unable to find the qvw file at the mentioned URL. Could you help me with the same (or the expression) as i need it for conditional formatting in the same manner as shown by you in the picture above.