Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

stacked bar chart - define colours

Hi,

Does anyone know how to define colours for each segment of a stacked bar chart?

Thanks,

D

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: stacked bar chart - define colours

Sorry, forgot to mention that for the stacked bars you'll have to change the background color for the expression, not the dimension. You can use the same pick/match expression though


talk is cheap, supply exceeds demand
9 Replies
MVP & Luminary
MVP & Luminary

Re: stacked bar chart - define colours

If you expand the plus of a dimension (Used Dimension) or expression you'll see an option Background color. You can change the definition and add an expression to select a color. Green() will select green, Red() red, rgb(1F,1F,1F) a grey.


talk is cheap, supply exceeds demand
Not applicable

Re: stacked bar chart - define colours

I found the option you mentioned but I don't know where to type the expression as "settings for Selected Dimention" are greyed out (not active).

Not applicable

Re: stacked bar chart - define colours

Would it have to be IF statement defining colours for each segment of the dimension?

e.g. =if(Medium='Referral Traffic',RGB(139,14,215),if(Medium='Direct Traffic',RGB(13,145,21)))

where Medium is the Dimension with two segments: Direct Traffic and Referral Traffic

MVP & Luminary
MVP & Luminary

Re: stacked bar chart - define colours

If you have only two values, one if statement will do:

=if(Medium='Referral Traffic',RGB(139,14,215),RGB(13,145,21))

If you have more values then the pick and match functions can be used.

If you have a LOT of values add a field in the table that holds the color values.

There's also a color(n) function that returns a predefined color for n between 0 and 255


talk is cheap, supply exceeds demand
Not applicable

Re: stacked bar chart - define colours

I have four segments so I need to use Pick and Match functions I guess.

Could you please apply this to the above example?

MVP & Luminary
MVP & Luminary

Re: stacked bar chart - define colours

=pick(match(Medium, 'Referral Traffic', 'Direct Traffic', ...etc), RGB(139,14,215), RGB(13, 145, 21), ...etc)


talk is cheap, supply exceeds demand
Not applicable

Re: stacked bar chart - define colours

for some reasons it doesn't do anything when I apply the statement

at least I know how to use pick and match functions ;-)

Thanks

MVP & Luminary
MVP & Luminary

Re: stacked bar chart - define colours

Sorry, forgot to mention that for the stacked bars you'll have to change the background color for the expression, not the dimension. You can use the same pick/match expression though


talk is cheap, supply exceeds demand
Not applicable

Re: stacked bar chart - define colours

Yep that was the key for it to work.

Perfect. Thanks a lot Mr

Community Browser