Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
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,


2 Replies
Valued Contributor II

Need Help: How to use ColorMix2 function?

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

Need Help: How to use ColorMix2 function?

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!!!