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: 
carolin01
Luminary Alumni
Luminary Alumni

Dynamical coloring of bar chart

Hi,

I´ve a bar chart where I first had two expressions:

Bild 1.jpg

Expression in Gray:

=Num(Sum({$<LastMonthDayMarker = {'>=1'}, BacklogMarkerThis = {'1'} , OrderPhase_Desc = {'HISBACKLOG'} >} NettAmount$(vCurrency)),$(vInteger))

Expression in Blue:

=Num(Sum({$<FYear = {'$(=vFYToday)'} , OrderPhase_Desc = {'Revenue'} >} NettAmount$(vCurrency)), ''),$(vInteger))

Now what I actually want is a conditional background formatting of the currently blue bar. The gray bar is actually a part of it. I tried them to just overlap and I couldn´t find how. Now I just try to give that blue chart two colors. Gray for the first section of the bar until it is as high as the gray one and for the rest blue.

My expression that I tried up to now is:

if( (Sum({$<LastMonthDayMarker = {'>=1'}, BacklogMarkerThis = {'1'}, OrderPhase_Desc = {'HISBACKLOG'} >} NettAmount$(vCurrency))) ={'>=1'}, rgb(0,94,187), rgb(89,89,89))

I think the expression doesn´t express that the color of the bar should be divided. Right now it only says if it higher than 1, then make it blue otherwise gray. What do I need to write?

Many thanks in advance!

1 Solution

Accepted Solutions
sunny_talwar

Can you try using a stacked bar chart with these expressions:

Expression in Gray (Stays the same)

=Num(Sum({$<LastMonthDayMarker = {'>=1'}, BacklogMarkerThis = {'1'} , OrderPhase_Desc = {'HISBACKLOG'} >} NettAmount$(vCurrency)),$(vInteger))

Expression in Blue (Blue - Gray)

=Num(Sum({$<FYear = {'$(=vFYToday)'} , OrderPhase_Desc = {'Revenue'} >} NettAmount$(vCurrency)) - Sum({$<LastMonthDayMarker = {'>=1'}, BacklogMarkerThis = {'1'} , OrderPhase_Desc = {'HISBACKLOG'} >} NettAmount$(vCurrency)),$(vInteger))

Gray bar as first expression

Blue - Gray as second expression

View solution in original post

8 Replies
migueldelval
Specialist
Specialist

Hi Caroline,

I think that you can´t use two colurs for one expression. Maybe you can use two Expressions and use diferents colurs and group it.

But I´m going to look for information about it.

Regards

Miguel dle Valle

marcus_sommer

Maybe an approach like this: Re: Highlighting particular week or range of time in stack bar chart or 2 dimension line chart could be helpful. Whereby it's rather an ugly job to fiddle this to an acceptable view.

- Marcus

carolin01
Luminary Alumni
Luminary Alumni
Author

Hi Miguel,

ok, thank you! It would also work if they could just overlap. I also coulnd´t find how to do this... I check with a combo chart now, maybe this gives me other options.

Best regards

Carolin

sunny_talwar

Can you try using a stacked bar chart with these expressions:

Expression in Gray (Stays the same)

=Num(Sum({$<LastMonthDayMarker = {'>=1'}, BacklogMarkerThis = {'1'} , OrderPhase_Desc = {'HISBACKLOG'} >} NettAmount$(vCurrency)),$(vInteger))

Expression in Blue (Blue - Gray)

=Num(Sum({$<FYear = {'$(=vFYToday)'} , OrderPhase_Desc = {'Revenue'} >} NettAmount$(vCurrency)) - Sum({$<LastMonthDayMarker = {'>=1'}, BacklogMarkerThis = {'1'} , OrderPhase_Desc = {'HISBACKLOG'} >} NettAmount$(vCurrency)),$(vInteger))

Gray bar as first expression

Blue - Gray as second expression

Not applicable

Hi Carolin

You can try the "Bar Offset" property of the expression. See my example with a third bar where the offset is the expression of the first bar.

Best regards,

Marcello

carolin01
Luminary Alumni
Luminary Alumni
Author

I didn´t try this one but I think this could have worked as well for me.

carolin01
Luminary Alumni
Luminary Alumni
Author

This was correct. I use it in this way now. I think I had concerns because I didn´t want to make it too complex but at the end it´s only important for the user that it is working well.

carolin01
Luminary Alumni
Luminary Alumni
Author

This was the right track. Thank you 🙂