Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
deepakqlikview_123
Specialist
Specialist

color as per values

Hi All,

PFA.

Below is requirement.

This is a percentile ranking in an ascending manner. The lowest value (in %) will appear at the top and the highest value (in %) will always at the bottome. For the color logic - the lowest value will always be in the darkest RED shade reducing to light red, then amber, then yellow, then light green and then dark green for the highest value. In short, the lowest value on the top will always be in dark red color and then it gets lighter and becomes green as the values increase.

Can you please suggest on this.

I have attached my sample application for this.

Thanks

11 Replies
marcus_sommer

Are you sure that you want to color the rows depending from their position? Then you could use color(rowno()) as expression and defined your colors within the color-tab from the object.

But if you want to color to the values you could use an if-loop like:

if(value < X, rgb(xyz), if(value < Z, rgb(a,b,d), ....

the same logic maybe more elegant solved with a pick(match()) approach.

I think the are further possibilities, maybe with colormix(). See also postings like this: Colors in charts.

- Marcus

Not applicable

Sort the expression in ascending order and then use the Color(Rowno())..

deepakqlikview_123
Specialist
Specialist
Author

Hi All,

Using rowno() is ok.But can you please suggest how shall i use this in colormix wizard as there is need to show different shades as shown in attachment.

Thanks

marcus_sommer

I would try for the first attempt the colormix2(x, red(), green(), yellow()) without the wizard. To generate the x-value depending on the row won't be easy and I'm not sure if you could get excactly such a color-shades over many table-rows as in a single object like a bar or a textbox-background.

Quite similar seems to be color-functions like colormaphue() or colormapjet().

- Marcus

deepakqlikview_123
Specialist
Specialist
Author

how to use Color(Rowno()).. in application i am not able to use it.

marcus_sommer

It will be applied as attribut-expression. Press by the expressions (dimensions is the same) the plus-sign and you get access to various attributs - see for this also the above mentioned blog Colors in charts.

- Marcus

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It looks to me like the colors in your example are fine as is. You just need to get the rows sorted in the order low to high, is that correct?

-Rob

Not applicable

thanks .. nice tip

deepakqlikview_123
Specialist
Specialist
Author

Hi Rob,

After sorting also i am not able to get desired output.

I have attached sample QVW and screenshot as per requirement for this please suggest.

Thanks