Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
yanivvl0
Creator III
Creator III

How do I set same colors for the same codes all over the model ?

hi , in my qv model i have classes , and for each there is a unique code .

by selection - its possible that the relevant code will be :

10,98,111,112,320 ..   or 10,11,34,320,441,501 ..    or 11,12,13,111,112,113,333,444 ..

the thing is that i need to set same colors for the same codes all over the model - at all tabs , all objects  ,

so the first code - no matter the value is - will be green, the socond will be red , the third blue ,  and so on ....

( according to the colors - Data Apearance palate  )

How can I do this in the simplest way?    THANS.

Labels (3)
1 Solution

Accepted Solutions
rubenmarin

Maybe with:

 LOAD ...

  Autonumber(code) as ColorNumber

...

And set color as: Color(ColorNumber)

Another option that can work: in object properties ->Color tab, check the box for 'Persistent colors'

View solution in original post

7 Replies
rubenmarin

Hi, can you try with?:

Color(FieldIndex('FieldName',FieldName))

Maybe it doesn't work's as expected with repeated values in the same field and you need to add a "RowNo() as ColorValue" in script, and use this field to assign different colors to repeated values.

yanivvl0
Creator III
Creator III
Author

hi , and thanks ,  it works  partially  ,

the case is more than that  ,  WHY ?

1 - Because in the chart i have the codes dimension AND another month dimension .

2 - Because  there are many code values , and the color exprasion give an outcome bigger than 18 - while in the chart color palate there isaonly 18 ..

i think those 2 reasons spoils our goal. please see the attach file , THANKS!!

rubenmarin

Hi, there are 20 colors: 19th is 'Others' and 20th is 'Totals'. When you reach color 21 it starts again, so Color(21)=Color(1).

 

I don't know why it's painting a yellow bar, can you confirm that color configuration in the 2nd chart is the same than in the first?

yanivvl0
Creator III
Creator III
Author

I confirm, the colors belong to both graphs.

is there a way to give running number to the relevant CODES ?   it can help

rubenmarin

Maybe with:

 LOAD ...

  Autonumber(code) as ColorNumber

...

And set color as: Color(ColorNumber)

Another option that can work: in object properties ->Color tab, check the box for 'Persistent colors'

yanivvl0
Creator III
Creator III
Author

hi , it is a good solution!! THANKS!!

I tried to accept as solution - but i get this massage :

The page you are trying to access was not found. Please check your URL for typos and try again.

do you know who can help me  - cant find the manager email ..

 

Brett_Bleess
Former Employee
Former Employee

I will mark the other comment as correct solution, but I wanted to throw out one more Design Blog post that may be of some further help too, it is along the lines of the other post, but may give you some further clarity on things!

https://community.qlik.com/t5/Qlik-Design-Blog/Colors-in-charts/ba-p/1475280

Cheers,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.