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

Maintain colors: what options are possible?

I have several objects (dimensions) that I want to give a fixed color. For every dimension the costs are calculated. Some items are available in multiple dimensions (i.e. 'desktop'). Possible solutions I've seen require that you always specify the dimension per item; are there other solutions?

I've tried:

load * inline [

Main IT object,X,Y,Z

Desktop, 255,255,155

Servers & storage, 255,155,255

];

AND

if([Main IT object]='Desktop',RGB(255,255,255),

if([Main IT object]='Servers & storage',RGB(255,155,255)))

2014-04-18 18_08_15-Map1 - Excel.png

1 Solution

Accepted Solutions
its_anandrjs

Update please check

I explain with an example look at the sample load with use of RGB( )  in the background table and use this table for dimension color.

//Add below tables with its RGB values

Backgroundcolor:

load * inline [

Main IT object,RED,GREEN,BLUE

Desktop, 255,255,155

Servers & storage, 255,155,255

];

Datasource:

load * inline [

Main IT object,Val

Desktop, 125900

Servers & storage, 154872

];

And in chart

Dimension :- [Main IT object]

and in the background color option just write =RGB(RED,GREEN,BLUE)

See the attached snapshot some thing like that

backcolor.png

View solution in original post

8 Replies
swuehl
MVP
MVP

If your inline table is linked to your dimension, you should be able to just use a background color attribute expression like

=RGB(X,Y,Z)

Gysbert_Wassenaar

Have you read this blog post: Colors in charts


talk is cheap, supply exceeds demand
its_anandrjs

Update please check

I explain with an example look at the sample load with use of RGB( )  in the background table and use this table for dimension color.

//Add below tables with its RGB values

Backgroundcolor:

load * inline [

Main IT object,RED,GREEN,BLUE

Desktop, 255,255,155

Servers & storage, 255,155,255

];

Datasource:

load * inline [

Main IT object,Val

Desktop, 125900

Servers & storage, 154872

];

And in chart

Dimension :- [Main IT object]

and in the background color option just write =RGB(RED,GREEN,BLUE)

See the attached snapshot some thing like that

backcolor.png

Not applicable
Author

Am I 'obliged' to use the definition of a dimension? I want to give the object (i.e. 'hardware - on multiple places in the database/model') everywhere in the QV Dashboard the same color; for that I don't need any reference to a dimension (at least that has my preference).

its_anandrjs

For that apply map the background color in the fact table then you are reflect the color in every places.

its_anandrjs

Some thing like the below code you have to load

//Mapping Table

Backcolor:

Mapping

LOAD [Main IT object],  RGB(RED,GREEN,BLUE) as BackColorId

FROM

[Backcolor.xlsx]

(ooxml, embedded labels, table is Backcolor);

LOAD

[Main IT object],

ApplyMap('Backcolor',[Main IT object]) as BackcolorRef,

Val

FROM

[Backcolor.xlsx]

(ooxml, embedded labels, table is Source);

You have to do main changes in the mapping table only

Not applicable
Author

I prefer this option: copy text from a notepad to the QV script. What I have now:

Backgroundcolor:

load * inline [

Main IT object,RED,GREEN,BLUE

Desktop, 255,255,155

Servers & storage, 255,155,255

];

load * inline [

ICT-component,RED,GREEN,BLUE

Hardware, 255,255,155

Software, 255,155,255

Personeel, 146, 179, 194

];

The first part works fine, only when i add the second part (ICT-component) I get an error: "In the database structure, one or more loops encountered". Wrong use of inline load? I assume I have to create for every dimension aan inline load?!

Probably I have to accept to use the name of the dimension.

swuehl
MVP
MVP

You are linking the two separate inline tables (not concatenated by default) by RED, GREEN and BLUE fields, and I assume you are also using the fields [Main IT object] and [ICT-component] in a common table as key to your dimension color tables. This will create the loop.

This should work:

load [Main IT object], RGB(RED, GREEN, BLUE) as [Main IT object Color] inline [

Main IT object,RED,GREEN,BLUE

Desktop, 255,255,155

Servers & storage, 255,155,255

];

load ICT-component, RGB(RED, GREEN, BLUE) as [ICT-component Color] inline [

ICT-component,RED,GREEN,BLUE

Hardware, 255,255,155

Software, 255,155,255

Personeel, 146, 179, 194

];

Then use the ... Color fields in your background expression.