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

Fixing colors to values in a Bar Chart

Is it possible to fix colors to the values in a Bar Chart?

My chart shows the RAG Status count across a selection of projects. The RAG status dimension is sorted as so:

if (RAG='On Target',1,if (RAG='Marginal',2,if (RAG='Moderate',3,if (RAG='Significant',4,if (RAG='Critical',5,if (RAG='Not Found',6,if (RAG='Not Reported',7,8)))))))

And the Colors palette is arranged in matching order.

All works fine if I have one or more values for each RAG count. However, if a count is zero the color is assigned to the next value in line, when what I want is the color skipped too.

This is visible in the example below where there are no 'Critical' projects, so Red() is used for the bar that shows the count of projects where the RAG is 'Not Found', when I want it to be skipped.

RAGstatusCount.jpg

10 Replies
sunny_talwar

What is the expression for color?

Anonymous
Not applicable
Author

Color Properties.jpg

Not sure I'm answering your question properly, but here's a clip from the Chart Properties: Colors tab. The radio button options for each color are 'Solid Color' and Calculated, with the calculated script simply being Green(), Yellow(), etc.

Is that what you're asking?

sunny_talwar

Instead of setting the colors from the colors tab, may be use background color to set the color using if statement.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You may also try the persistent colors option. If that doesn't work in this case, then set the background color expression where you can specify the RGB value or the color(n) function to select from the pallette. You can use the same expression for both sorting and color:

Sort expression:

Match(RAG,'On Target',Marginal',Moderate','Significant','Critical','Not Found','Not Reported')

Background Color:

Color(Match(RAG,'On Target',Marginal',Moderate','Significant','Critical','Not Found','Not Reported'))


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

sergio0592
Specialist III
Specialist III

Hi, you can create and load a table of color.

In my exemple below, I have three colors and i use JudgColor field in the background color expression. It's very useful for maintainability when you have to change colors, it avoid to change in each object.

JudgmentsColors:

LOAD *

,rgb(R,G,B) as JudgColor

INLINE [

Judgments,R,G,B

critical,255,28,28

major,  255,255,45

minor,0,128,255

];

Anonymous
Not applicable
Author

I tried this but it appears that the settings in the Colors tab take precedence over the settings in the background color setting.

sunny_talwar

I don't think this is true. Would you be able to share a sample to show this?

Anonymous
Not applicable
Author

As a rookie you've introduced me to some new commands, so thanks for that. However, it appears the settings in the Colors tab take precedence over what I set in the Background Colors expression of the Dimension. So it didn't work. 😞

Anonymous
Not applicable
Author

Jean-Baptiste - loading a JudgmentsColors table and creating a JudgColor expression expanded by knowledge of what I can do with QlikView. However, nothing I have done seems to override the settings in the Colors tab, so I'm still at square one.