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

different colors on two dimension "values"

Hi,

i have a bar chart where i've got two dimensions on the x-axis. the user can use two values for one dimension and i want those dimensions values to be in different colors. i.e. a blue bar for usa, a red bar for germany.

is this achieavable? not that usa and germany are only examples of what the user can choose, there are about 400 values to choose from.

thanks in advance!

//A.

1 Solution

Accepted Solutions
whiteline
Master II
Master II

ok, and what do you want.

all countrys to have the same color agains the years ?

Use this as an expression for Background color for your expression

=Color(FieldIndex('F2', F2))

View solution in original post

11 Replies
Anonymous
Not applicable
Author

yup in expression window tab ..

click on + sign and add expression in background color , as follows

if (getfeildselection(field)='usa',rgb(0,0,255),rgb(255,0,0))

hope it helps

whiteline
Master II
Master II

Expand your expression and use something like this for Background Color:

=if(Dimension1='$(UserValule1)', lightred(), null())

null() will get the default color.

giakoum
Partner - Master II
Partner - Master II

You can use Background color in expression to do that and specify a specific color for each important dismension :

if(country='USA', rgb(255,0,0), etc etc

however if you need to specify a specific color for all 400, then I would do it in the database, or in watever your source is and define it then in the background color expression.

Maybe choosing only the important ones, is a more wise solution.

kji
Employee
Employee

If you just want them to have different colors, and are not specific colors for each value, you can enable "Multicolored" on the colors tab. ("Persistent Colors" might also be a good option so that you always get the same color for each country).

Anonymous
Not applicable
Author

@whiteline i don't get the "uservalue1" thing. If my dimensions is country what would the text UserValue1 be replaced by?

Just to be clear the two dimesion values are in the same field. the secound dimension has nothing to do with the colors.

whiteline
Master II
Master II

to borgannika,

I thought that the value of the dimension that you want to colorize is stored in a variable, since you said that the user can select it. if no you can just type 'use' or somethin.

I doubt that I'm missing something in your case.

I think if you submit some screenshoots it makes all clear.

Anonymous
Not applicable
Author

here's an example. note, again, that the countries will not be static but can change into whatever country,

giakoum
Partner - Master II
Partner - Master II

Dimension =1 is your problem preventing the multicolored option. remove it and it should work.

See attached. What was it for in the first place?

whiteline
Master II
Master II

ok, and what do you want.

all countrys to have the same color agains the years ?

Use this as an expression for Background color for your expression

=Color(FieldIndex('F2', F2))