Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color Expressions not working in QV9?

Hi all,

I'm trying to set a color expression for a scatter chart. Basically, I would like all those balls that indicate a value > 400 to be a different color.

error loading image

I've changed all the colors to a calculated value, but it's not taking. Does anybody have any suggestions what I'm doing wrong?

error loading image

error loading image

error loading image

Thanks!

Oliver

1 Solution

Accepted Solutions
kji
Employee
Employee

Everything you set on the colors tab isevaluated once for the whole chart, so can not be used to set color of individual datapoints, the Background color you can set for expressions is evaluated for each datapoint, however i dont believe this is implemented for scatterchart mostly because each datapoint drives from more than one expression so could be ambigous which color to use.

View solution in original post

11 Replies
Anonymous
Not applicable
Author

Oliver, I think that sum(Price) is evaluated over all selected data here, and always >400 because of that. Try to us aggr() on the chart dimension, whatever it is, and possibly on week. Can't tell for sure without seeing dimensions and expressions, and the data model.

kji
Employee
Employee

Everything you set on the colors tab isevaluated once for the whole chart, so can not be used to set color of individual datapoints, the Background color you can set for expressions is evaluated for each datapoint, however i dont believe this is implemented for scatterchart mostly because each datapoint drives from more than one expression so could be ambigous which color to use.

johnw
Champion III
Champion III

You could always overlay two charts, one for the points <= 400, one for the points > 400, but it's not really ideal - you can only mouse over and click on the top chart, and you have dual maintenance. Hopefully there's a better answer.

Not applicable
Author

EDIT: Sorry, I was thinking Grid Chart. It doesn't look like it works on a scatter (except for in the legend).

I think you should be able to use the Background Color expression on the Expressions tab. Set the background color to the color expression you used above.

I just did a test and used:

if(Sum(Sales) > 50, RGB(255, 0, 0))


If the value is greater than 50, it is red, if not, it goes to the default color (from the Colors tab). If you use your expression, it would completely ignore the Color tab.

Not applicable
Author

Thanks for your input! It looks like Johan may (unfortunately) correct - I've tried using aggr(). It worked in a regular pivot table, but when I change the chart to scatter, it doesn't. Looks like I'm SOL! This would be a really cool feature to implement, though.

Cheers,

Oliver

johnw
Champion III
Champion III

OK, I think I have it, though I DO agree that QlikView should be able to do this by merely setting the color expression.

Add a calculated second dimension like aggr(if(sum(Price)>400,'Price > 400','Price <= 400'),FirstDimension). As long as you have prices both over and less than 400, it will use the first color in the chart for > 400, and the second for <= 400. See attached.

Not applicable
Author

Thanks, John - I'll try that! Like you, I couldn't let this go and went with your earlier suggestion, i.e. overlaying two graphs. Not bad, either, though a little hard to edit.

Cheers,

Oliver

Not applicable
Author

John,
I tried out your document, and something odd happens - after I refresh the document, the colors revert to their default multitude, and the dimension label changes as well. Do you think this has to do with me using version 9.0?

Thanks again for putting your time into this!

Oliver

johnw
Champion III
Champion III

I was able to duplicate the problem in 8.5 by hitting refresh a bunch of times. What it looks like to me is that if ALL of the data points have the same value for our calculated dimension, then similar to drill down groups, it will simply ignore that dimension. I don't know if that will or will not be a problem in your real application, but it's definitely a potential problem when they start making selections. While I don't know, it sounds like the sort of default behavior that we wouldn't be able to fix.

(Edit: Verified same behavior in 9.0)