Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Gysbert_Wassenaar

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

View solution in original post

9 Replies
Gysbert_Wassenaar

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
Author

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
Author

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

Gysbert_Wassenaar

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
Author

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

Could you please apply this to the above example?

Gysbert_Wassenaar

=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
Author

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

Gysbert_Wassenaar

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
Author

Yep that was the key for it to work.

Perfect. Thanks a lot Mr