Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted

Colors broken in bar charts with drill-down group?

I'm having this "issue" with color consistency in bar charts whenever a drill-down dimension is used. See the example in attachment.

The bar charts in the example have a group as dimension (no issues there) and two expressions that should output color-consistent results, meaning that Plan-values should always be color1 and Actuals should be color2. This works nicely in bar charts where you enable "Persistent colors" and in which either Cyclic groups or plain fields are used as dimensions. See the top chart.

However, as soon as you insert a Drill-down group as dimension, odd things start happening. Two quick cases:

  • Select Q1-14 in the top chart. Chart "Persistent colors" in the container shows actuals in a plan color..
  • Select Q4-12 in the top chart: Chart "No consistent colors" in the container shows actuals in the Totals color..

It has something to do with missing data for the first expression causing the second expression to misbehave. But only in a chart with a drill down group. The chart at the top (Cyclic gorup) is consistently correct.

Any logic that I'm unfamiliar with? Thanks.

Peter

1 Solution

Accepted Solutions
Not applicable

Re: Colors broken in bar charts with drill-down group?

You may also modify your expression to avoid nulls:

if(IsNull(Sum(RevPlan)/Sum(VolPlan)),0,Sum(RevPlan)/Sum(VolPlan))

You may do this also adding new expression hidden (by unchecking Bar) or (if you know that your values are >0, you may use:

rangemax(Sum(RevPlan)/Sum(VolPlan),0)

regards

D

6 Replies

Re: Colors broken in bar charts with drill-down group?

I guess this must be a bug or something?

Employee
Employee

Re: Colors broken in bar charts with drill-down group?

This has nothing to do with the Dimension used, the difference is that in the top chart you will get 0 for the "missing" expression, whereas in the lower you will get NULL.

The setting "Persistent colors" i think only relates to colors associated with field values, and not for when colors are determined by expressions.

If you want your colors to be persistent on expressions you can set the color using the  "Background Color" sub-expression.

Not applicable

Re: Colors broken in bar charts with drill-down group?

You may also modify your expression to avoid nulls:

if(IsNull(Sum(RevPlan)/Sum(VolPlan)),0,Sum(RevPlan)/Sum(VolPlan))

You may do this also adding new expression hidden (by unchecking Bar) or (if you know that your values are >0, you may use:

rangemax(Sum(RevPlan)/Sum(VolPlan),0)

regards

D

Re: Colors broken in bar charts with drill-down group?

Ok; thanks. Now I know why it doesn't work as expected.

I'm still wondering why it works like it does however... Using the Totals-color instead is pretty random, no? In addition to that, if it's true that the Persistent colors checkmark applies only to dimension values, then why are single dimension/double expression charts using different colors at all? Some QV code is already taking care of this situation, so why doesn't it apply the Persistent Colors setting as well when there is only one dimension?

Best solution would be to disable the checkmark (grayed) whenever it doesn't apply or causes random results.

Re: Colors broken in bar charts with drill-down group?

We already fixed it using IsNull(). Forgot to mention this, sorry.

Anyway, I don't like the Background color expression solution to work around this behavior because it forces developers to pile expression upon expression in every chart that deviates from the default layout. And UI objects quickly become difficult to manage/maintain/understand/document in any "advanced" document. Even with expressions-in-variables.

Not applicable

Re: Re: Colors broken in bar charts with drill-down group?

Looks like expression list is a kind of dimension.