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

Repeat first 4 colors in bar chart

Hello

I have a small problem with defining the colors of a bar chart which contains bars per quarter. I've created the following chart by defining colors 1 to 18 manually:

quarter colours 1.PNG.png

this contains 16 quarters and after a year the coloring scheme is repeated. But I want to add the option to expand the dates so when the chart exceeds 18 quarters the coloring scheme does no longer match. see example:

quarter colours 2.PNG.png

bars 'apr-jun 2009' and 'jan-mrt 2009' do not fit the scheme because they are colors 1 and 2 of the colors properties.

does anyone have an idea how to fix this easily (without having to add an extensive expression to the dimension)?

your help is much appreciated.

regards,

Peter

1 Solution

Accepted Solutions
Not applicable

Or I think an if statement in the background color of your expression along the lines of this should work...

if(wildmatch(YourDateField ,'okt-dec 20*'), rgb(???,???,???),
     if(wildmatch(YourDateField , 'jul-sep 20*'), rgb(???,???,???),

          if(wildmatch(YourDateField , 'apr-jun 20*'), rgb(???,???,???),

               rgb(???,???,???))))

...obviously replacing the field with your dimension field and using the appropriate RGB values.

View solution in original post

3 Replies
Not applicable

Might make more sense to create a corresponding quarter number and assign background color directly in expression.

For example:

Quarter          QuarterNum

jan-mrt 2009     1

apr-jun 2009     2

jul-sep 2009     3

okt-dec 2009     4

jan-mrt 2010     1

...                    ... 

And in expression background color: pick(QuarterNum, colorblue1, colorblue2, colorblue3, colorblue4)

Not applicable

Or I think an if statement in the background color of your expression along the lines of this should work...

if(wildmatch(YourDateField ,'okt-dec 20*'), rgb(???,???,???),
     if(wildmatch(YourDateField , 'jul-sep 20*'), rgb(???,???,???),

          if(wildmatch(YourDateField , 'apr-jun 20*'), rgb(???,???,???),

               rgb(???,???,???))))

...obviously replacing the field with your dimension field and using the appropriate RGB values.

pepe2209
Creator
Creator
Author

Ok thanks to both!

I'll see what works best for my application.