Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change the colour of axis based on expression values?

Hi,

I have a below expression in bar chart which shows the Fail percentage and 'No Failures' on X axis. How can I change the colour of X axis so that I want if there is Fail percentage the colour should be in red. If there are 'No Failures' the colour should be in green.

can anyone suggest me please?

Expression:

IF(Count({<[Result ]={'Fail'}>}Distinct [ID])/(Count({<[ Result ]={'Pass'}>} Distinct ([ID]))+

Count({<[ Result ]={'Fail'}>} Distinct ([ID])))=0,'No Failures',

Count({<[ Result ]={'Fail'}>}Distinct [ID])/(Count({<[ Result ]={'Pass'}>} Distinct ([ID]))+

Count({<[ Result ]={'Fail'}>} Distinct ([ID]))))

EDIT: I know to change the colour in Text Colour(). But I need the expression.

1 Solution

Accepted Solutions
Not applicable
Author

In expression, background color you can write the expression like:

if(Result='Fail',Red(),Green());

Hope this is what you want..!

View solution in original post

6 Replies
nizamsha
Specialist II
Specialist II

could u post some qvw

Not applicable
Author

In expression, background color you can write the expression like:

if(Result='Fail',Red(),Green());

Hope this is what you want..!

Not applicable
Author

Thanks. Perfect.

Not applicable
Author

In graph->properties->Expression tab

expand the '+'symbol

then choose background color

try the following expr in this

IF(if(Count({<[Result ]={'Fail'}>}Distinct [ID])/(Count({<[ Result ]={'Pass'}>} Distinct ([ID]))+

Count({<[ Result ]={'Fail'}>} Distinct ([ID])))=0,'No Failures',

Count({<[ Result ]={'Fail'}>}Distinct [ID])/(Count({<[ Result ]={'Pass'}>} Distinct ([ID]))+

Count({<[ Result ]={'Fail'}>} Distinct ([ID]))))='No Failures',green(),rgb(255,0,0))

hope it will work....

Not applicable
Author

Found more exact expression

If([Result]>'Fail', Green(),Red())

nizamsha
Specialist II
Specialist II

how many dimension u r having if u have only one dimension eg status and one expression eg count (distint ID)

check multicolor in color tab  so for eg if u have 4 status then  u will have four bars in 4 color

or write in background

if(Result='Fail',red(),green()