Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

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

Tags (2)
10 Replies

Re: Fixing colors to values in a Bar Chart

What is the expression for color?

Highlighted
Contributor II
Contributor II

Re: Fixing colors to values in a Bar Chart

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?

Highlighted

Re: Fixing colors to values in a Bar Chart

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

Highlighted
MVP & Luminary
MVP & Luminary

Re: Fixing colors to values in a Bar Chart

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

Highlighted
Specialist II
Specialist II

Re: Fixing colors to values in a Bar Chart

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

];

Highlighted
Contributor II
Contributor II

Re: Fixing colors to values in a Bar Chart

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

Highlighted

Re: Fixing colors to values in a Bar Chart

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

Highlighted
Contributor II
Contributor II

Re: Fixing colors to values in a Bar Chart

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. 😞

Highlighted
Contributor II
Contributor II

Re: Fixing colors to values in a Bar Chart

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.