Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why does the legend expression colors disappear when writing code in Background Color?

I'm new to qlikview and have a problem with legend for my charts.

As soon as I write statement in the background color for an expression, the legend color for that particular expression disappears (even if the statement is commented). But as soon as I remove all text in the Background Color definition, the color shows in the legend.

I can't figure out why? I'm not sure if this is sufficient information in order to understand the whole problem, let me know if that's the case.  Please see screenshots.

Regards

Thomas

5 Replies
swuehl
MVP
MVP

Could you post a small sample QVW that demonstrates your issue?

Not applicable
Author

Hi swuehl,

Basically the problem is that I use three expressions that I use as stacked. I also want to filter these expression so the chart shows one expression at a time, but in order to keep the same colors that I want when these expressions are stacked, i need to hard code these colors in the Background color for each expression otherwise the Bars will have different colors when filtered.

So when I write my code in the background color for each expression, the legend color disappears for the expressions in the stacked view.

I have provided new screenshots in hope for better understanding of my problem. If this still not is understandable, I wil try to make a smaller QVW sample. Thanks!

EmptyDef.jpg

When code IS written, legend color disappears.

CodeInDef.jpg

FilteredExpression.jpg

Image above illustrates how the correct color green is shown in the legend since the Bars also has the same color.

Regards

Thomas

swuehl
MVP
MVP

I small sample QVW will definitely help.

I think the problem is that the legend colors are evaluated once per chart, in a global context, similar to a text box expression or the expression for your expression header. I assume the background color expression won't render to an unambiguous, distinct value in this context.

jaygarcia
Contributor III
Contributor III

Hi Thomas,

Did you find a solution for this?

Not applicable
Author

I also ran into this problem, but found a solution (with help from the post of swuehl ). The "if" statement in the background color expression must have a value for the "else" condition (third argument in het "if" function). This color will be applied to the legend.