Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dpduran
Contributor III
Contributor III

Bar chart background color based on value not working as expected

Hi all

for some reason when I try to apply a dynamic background color on a bar chart based on a field it simply doesn't work. I can set it up without problems without conditions, but when I try to do it with an if expression it just doesn't change it. It's like condition is not evaluated at all...


See screenshots below:

Bar chart (kind of a gant) with already Status selection to 'Closed' value. Also see my chart properties with colour set to red() for Status='Closed' and not happening at all. (if I put red() in background color it all becomes red without problems)

gannt chart.JPG

My Chart properties:

props.JPGbg color.JPG

My dimension is the ChangeID (CRQXXXXX) and my expression is duration of this given CRQ (EndTimestamp - StartTimestamp) in hours.
This CRQs have different Status (Closed, Started, etc... ) and I would love to change background colour based on it for each bar. (if status is closed, then bar is red, and so on).

If I use an expression like:

=if (Status='Closed', red(), green())  as Background color for expression all bars become green.

BTW I've already seen lots of examples from QV community and found nothing that worked for me. I'm using QV11.

Any Ideas? Any help would be much appreciated.


Thanks!
Diego.


PS. Also was wondering if it's possible to get bold values on axis based on any other field kind of if status is cancelled the CRQXXX on the axis becomes bold. ¿?

1 Solution

Accepted Solutions
fred_s
Partner - Creator III
Partner - Creator III

Hi Diego,

First, to solve your problem it would be great for us to have an example file.

Second, I see you've got an expression 'Status'.

Is this Status(=Closed) your expression or is Status a field name?

If it's a field name, you should consider renaming your label for the expression "Status".

Grtz,

Fred..

View solution in original post

3 Replies
fred_s
Partner - Creator III
Partner - Creator III

Hi Diego,

First, to solve your problem it would be great for us to have an example file.

Second, I see you've got an expression 'Status'.

Is this Status(=Closed) your expression or is Status a field name?

If it's a field name, you should consider renaming your label for the expression "Status".

Grtz,

Fred..

dpduran
Contributor III
Contributor III
Author

You know, when you spend so much time trying to do something and you get stuck over and over again trying to solve it.... you pass things like that.

I just changed the Expression label and the condition started being evaluated flawlessly.

I needed a fresh pair of eyes to see this.


Thanks for the quick response Fred.

fred_s
Partner - Creator III
Partner - Creator III

Anytime 😉