Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Background Color based on field value dynamically

Hi,

I would like to apply background color in a bar chart based on field values.

In the example attached, i have rgb values stored in a table for each product and i tried to apply those rgb values as background color of bars. I only have a good result when i perform a selection on a single product. When no selection is made QlikView doesn't seem to understand it.

Is there a way to achieve dynamic color based on those stored rgb values?

Thanks.

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

I tend to think you should store the actual r, g, and b values as separate fields rather than the full string including the rgb() function call

The formula to get the background color would then be


=rgb(r,g,b)


You can simulate this on your own app as follows (the formula parses the "Couleur" string to find the r, g and b componants).


=rgb(textbetween(Couleur,'(',','),textbetween(Couleur,',',','),textbetween(Couleur,',',')') )


Hilaire

View solution in original post

3 Replies
Not applicable
Author

Since the variable shows what is selected, you need something more in the line of an if-statement or another formula (use the ASCII-code for each character for instance to calculate a colour).

See sample attached.

Not applicable
Author

Hi,

I tend to think you should store the actual r, g, and b values as separate fields rather than the full string including the rgb() function call

The formula to get the background color would then be


=rgb(r,g,b)


You can simulate this on your own app as follows (the formula parses the "Couleur" string to find the r, g and b componants).


=rgb(textbetween(Couleur,'(',','),textbetween(Couleur,',',','),textbetween(Couleur,',',')') )


Hilaire

Not applicable
Author

Ok. That's indeed perfectly working with separate fields R, G and B.

Thank you!