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: 
Not applicable

Custom Colors on Bar Chart

How can I set the color for the values in say a field called Product Group, e.g.Choclate = color Brown, Snacks = color Blue AND

set the color for each Product, in thier respective Product Group, e.g. Aero = color Red, , Crisps = color Green etc.

9 Replies
er_mohit
Master II
Master II

hiich

see the attached image

I set the color for the values in say a field called Product Group, e.g.Choclate = color Brown, Snacks = color Blue AND

set the color for each Product, in thier respective Product Group, e.g. Aero = color Red, , Crisps = color Green etc.

acc. to this

you put expression i.e

if(Product Group='Choclate',color(Brown()),

if(Product Group='Brown',color(Blue()),

if(Product Group='Aero',color(red()),

if(Product Group='Crisps',color(green())))))

hope it helps..

Not applicable
Author

Hi,

Thanks for the response.

Your code will for Chocolat will work fine, if(Product Group='Choclate',color(Brown()), but

e.g. Aero, Snickers etc are Products in a seperate field e.g called Products and each product needs a seperate

color.

Your code results in the Products having the color Brown, Aero inherits Brown instead of showing Red.

What I need to see is

Choclat (Product Group field) = Brown

  Aero    (Products field)        = Red

I'll also be using drill down in the Stacked Bar Chart.

Thanks

Not applicable
Author

Hi,

Thanks for the response.

Your code will for Chocolat will work fine, if(Product Group='Choclate',color(Brown()), but

e.g. Aero, Snickers etc are Products in a seperate field e.g called Products and each product needs a seperate

color.

Your code results in the Products having the color Brown, Aero inherits Brown instead of showing Red.

What I need to see is

Choclat (Product Group field) = Brown

  Aero    (Products field)        = Red

I'll also be using drill down in the Stacked Bar Chart.

Thanks

er_mohit
Master II
Master II

i m confused in it now you say clearly that product is separate field

so for in above code for aero try this

if(Product ='Aero',color(red()),

if(Product ='Crisps',color(green()))

hope it helps

Not applicable
Author

Sorry for the confusion.

All values in the Product field inherit the Color Brown from if(Product Group='Choclate',color(Brown())

Using  if(Product ='Aero',color(red()) is ibeing ignored,

Thanks

er_mohit
Master II
Master II

try this code.

alt(if(Product Group='Choclate',color(Brown()),

if(Product Group='Brown',color(Blue()),

if(Product ='Aero',color(red()),

if(Product ='Crisps',color(green()))))))

hope it helps

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi QlikQuest,

I am assuming I understand what you want to achieve!

What you can do is click on the chart > Properties > Expression > click the + sign beside dimension > click Background color > then to the right side click the ecllipse (...) and paste this expression into the EDIT EXPRESSION window

if(Product Group='Choclate',color(Brown()),

if(Product Group='Brown',color(Blue()),

if(Product Group='Aero',color(red()),

if(Product Group='Crisps',color(green())))))

Click OK & OK

Regards,

Gabriel

Not applicable
Author

Er,

I;m afraid that still doesn't work

All products, i.e. Aero are inheriting the Color Brown set by, if(Product Group='Choclate',color(Brown())

Thanks for sticking with it

Not applicable
Author

Gabriel,

Thanks for your suggestion.

However what I need to see is

Choclat (Product Group field) = Brown

  Aero    (Products field)        = Red

  Mars Bar  (Products field)        = Orange etc

Your code results in All products Aeroet in the Products field being colored Brown.