Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
max_potass
Creator
Creator

Dynamic RGB Code

Hi everyone,

I want to create a dynamic Bacground color in a chart. I thought following would work:

RGB(Floor((1-(KAM/Max(All KAM)))*255),Floor((KAM/Max(All KAM))*255),0)

KAM is an integer.

I also checked, if the single expression work. They do. So I get RGB(0,255,0). But if I use it in the chart, I get an Error:

"Drawing of Chart failed internally"

Is what I am trying to do even possible, or do I have a mistake?

Best Regards

Max

1 Solution

Accepted Solutions
max_potass
Creator
Creator
Author

Well, I just did the file and it works there. I have the exact same field names and Expressions.

But I found the problem.

I had to define a color for the other Expression in the chart. I have no Idea why... But that fixed it.

Thanks.

View solution in original post

5 Replies
YoussefBelloum
Champion
Champion

EDITED

Hi,

did you take a look at the values you get with this: (1-(KAM/Max(All KAM)))*255


maybe you go out of the range of 3 digits and exceed 255

max_potass
Creator
Creator
Author

No, sadly all values are between 0 and 255 and are floored, so no decimals.

YoussefBelloum
Champion
Champion

would you be able to share sample app ?

you can try to put your expression into a variable

max_potass
Creator
Creator
Author

Well, I just did the file and it works there. I have the exact same field names and Expressions.

But I found the problem.

I had to define a color for the other Expression in the chart. I have no Idea why... But that fixed it.

Thanks.

YoussefBelloum
Champion
Champion

cool, problem resolved then