Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
charlotte_qvw
Partner - Creator
Partner - Creator

set rgb colour in script

Does anyone know if it's possible to set a colour in the qv script e.g., if a field='xyz', rgb (255,255,255)? Many thanks, Charlotte

7 Replies
Not applicable

Yes this is possible

RGB(255,255.0) for example

Greetz,

Dirk

charlotte_qvw
Partner - Creator
Partner - Creator
Author

Ok, but how can i put that round a field I'm loading in the script, eg

Load

if(Fieldx = 'Blank', rgb(255,255,255), rgb(0,0,0))

what i would like is if Fieldx = Blank to load it in white colour, otherwise to load the field in balck colour. I know that I can do this in the chart properties, text format for my dimension, but it doesn't work when there are no values for fieldx when it's = Blank. So I would like to do it in the script.

thanks

Not applicable

Why should you load a color in a script.

Maybe just put the value in the field. for example

fieldvalue1 = "255"

fieldvalue 2 = "255"

fieldvalue3 = "0"

and when you want to use them, RGB(Fieldvalue1,Fieldvalue2,Fieldvalue3)

Is that a sollution for you?

Greetz,

Dirk

Not applicable

Hi,

Did you ever find a way to define color in the script?

M.

nathanfurby
Specialist
Specialist

I'm not sure why you'd want to do this in the script when you can do it in the chart but see the attachment for a couple of examples.

Suppose it makes sense to create a variable that stores colour - would save you having to type out e.g. RGB(255,255,0) and remember the numbers all the time.

Not applicable

thanks for your reply

the reason I want to define a color in the script is because I need to use it in many charts.

In your way- everytime you add the Item as a Dim into a chart you must go and set its background settings

I want, for example, all positive values to show in font color green in all charts all over the gui.

nathanfurby
Specialist
Specialist

I don't think that is possible