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

Need Help: How to use ColorMix2 function?

Dear all,

I've been trying to put gradient colors on bar chart thourhg the Color Wizard: Not by using the color setting on the color tab.

According to help, it seems to be possible to do it with ColorMix2() function: it says "colormix2(x, red(), green()) returns colors in a gradient from red to green, via brown." * x is a real number between -1 and 1.

However, i never succeeded. If I put "colormix2(0, red(), green())," it always returns brown with no gradient.

Has anyone succeeded in using this function? Or is this a bug?

Thanks for your kind help,

OGA

2 Replies
Or
MVP
MVP

ColorMix2()'s first argument - the one you hard-coded as 0 - decides the level of gradient. As long as you use 0 there, you will always get brown. You need to replace the 0 with the actual values you want to color-code by. For example, if you have a percentage value between 0 and 100%, and 100% is good, you might use:

ColorMix2((myValue*2)-1,red(),green()) --> If your value is 100%, the first section will return 1. If it is 50%, it will return 0. If it is 0%, it will return -1.

Alternatively, you could try the ColorMix wizard, available from the Expression Editor's 'File' menu.

Not applicable
Author

Hi, Or Shoham

Thanks for the comments.

So, basically, the idea of ColorMix2() function is that the function returns a gradient color to several bars. If I have 10 bars in a bar chart, it would be gradient from the top var to the bottom bar. Yet, I cannot be a gradient in ONE bar? Am I right?

Thank you for your help!!!