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: 
DSDD
Contributor III
Contributor III

How to define manual colors to bar chart coloring?

Dear Community,

i have the following bar chart with dimension as date and a grouping field with 7 categories.

DSDD_1-1604616232576.png

What i want is to change default color of the categories.

I have colors in hex or rgb

hex: #8C510A,#D8B365,#F6E8C3,#F5F5F5,#C7EAE5,#5AB4AC,#01665E
RGB: (140,81,10),(216,179,101),(246,232,195),(245,245,245),(199,234,229),(90,180,172),(1,102,94)
 
but i have not found a solution how to exchange the default coloring with my own colors.
 
Is there a code-saving way to achieve this goal, whithout endles if-else-condition?
Defining a variable?
How does the code look like?
Labels (5)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Define kat_pos as a Master Dimension.   In the Master Dimension edit dialog on the Value colors tab, you can assign a specific color for each value of kat_pos.

https://help.qlik.com/en-US/sense/September2020/Subsystems/Hub/Content/Sense_Hub/Colors/assigning-co...

2020-11-05_16-41-44.png

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Define kat_pos as a Master Dimension.   In the Master Dimension edit dialog on the Value colors tab, you can assign a specific color for each value of kat_pos.

https://help.qlik.com/en-US/sense/September2020/Subsystems/Hub/Content/Sense_Hub/Colors/assigning-co...

2020-11-05_16-41-44.png

DSDD
Contributor III
Contributor III
Author

Thank you very much for that surprinsingly easy solution.

Do you have a suggestion, if its possible to code the color assignment? Assuming i have two arrays, one for the category names and one for the hex-colors? Goal is to code an assignment for several categorical fields

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes it easy to use code for the assignment. Load a table with your dimension and a ColorField.  In chart measure, use "Color by Expression" with an expression of:

=ColorField

-Rob

 

DSDD
Contributor III
Contributor III
Author

i created a table

DSDD_0-1604686256723.png

and adding this

DSDD_1-1604686417694.png

in the 'Colors and Legends' Section keeps the bars grey.

Do i have to check/uncheck anything else?

How does Sense know that this is hexcode?