Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Changing the background color type in the Expression tab of a bar chart

Hi there, I hope that someone is able to assist me, thank you in advance...

I'm attempting to change the color of the bars in a bar chart when the values are negative, but I'm hoping that there's a way to change the type of color instead of it being a plain, solid color by default.

If I was using plain colors in my bar chart it would be easy, because in the Expressions tab I click on the "plus" symbol and select "Background Color", then type in "If(Net_Profit<0, LightRed())", and the graph behaves as it should. (The bars are blue for positive values and red for negative values).

Now the problem is that the plain colors don't look that nice (by plain colors I mean that in the "Colors" tab the color is set as a "Solid Color"). I would prefer to use "Two Color Gradient" glossy colors, with White as the other color and a vertical Gradient style. However, when I select this then my blue (positive) bars look great, but the red (negative) bars are still the plain, Solid Color type, which makes the graph look, well, hideous.
Is there any way to add the extra visual aspects to the negative bar, or would I need to just use plain, Solid Color bars in this case?

Thanks for your help!
Regards,
Philip

Labels (1)
1 Solution

Accepted Solutions
nathanfurby
Specialist
Specialist

I don't think this is possible. The best I think you could hope for would be to use a custom RGB value rather than Red() or Green() etc. as these colours do look terrible.

Only other thought - make two expressions using If statement; one for positive values and one for negative. The Expressions Legend will not look nice and may not work depending on what you want to do.

View solution in original post

2 Replies
nathanfurby
Specialist
Specialist

I don't think this is possible. The best I think you could hope for would be to use a custom RGB value rather than Red() or Green() etc. as these colours do look terrible.

Only other thought - make two expressions using If statement; one for positive values and one for negative. The Expressions Legend will not look nice and may not work depending on what you want to do.

Not applicable
Author

Thank you Nathan, I'll use the custom RGB value in this case...

It's just a small visual issue so it's not serious, I was hoping that there would be a solution though.
I received a message from another Forum member (Renaud Charlet) who suggested using the color function, color(2) would return the second color from the color pallette. Unfortunately that just takes the color and not the other formatting, so it did not solve the issue either...

Regards,
Philip