Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pie chart - calculated color only for one value

Hi community! 🙂

Please help me with expression for pie chart color. I have questionare with few questions and one pie chart to show them one by one using this expression to choose dimension (question):

=$(=subfield(GetFieldSelections([Question_number]),',',))

Each question has different number and type of possible answers, but all has one common - 'Others'.

For example I'm using this for pie popout: =$(=subfield(GetFieldSelections([Question_number]),',',))='Others'

And now I want to use something similar for set color of that 'Others', but not of the rest.

Somthing like this? if($(=subfield(GetFieldSelections([Question_number]),',',))='Others', RGB(255,0,0),Rand)

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Expression tab->Expand Expression-> Background color : Expression:

=If(YourDimension='Others', Red(),Color(100*Rand()))

View solution in original post

13 Replies
Not applicable
Author

Hi,

Can you please attach some sample.

-Shruti

Sokkorn
Master
Master

Hi Mir,


Did you try this yet: =If(WildMatch([Question_number],'*Other*'),RGB(255,0,0),Rand)


Regards,

Sokkorn

jagan
Luminary Alumni
Luminary Alumni

Hi,

Give this expression in Background expression

=If(WildMatch([Question_number],'*Others*'),RGB(255,0,0))


Hope this helps you.


Regards,

Jagan.

sujeetsingh
Master III
Master III

You can click the + sign on expression,and then in Background expression write the conditions of coloring

Not applicable
Author

WOW, I didn't expect so quick response, THANKS! 🙂

But saddly, when I use

=If(WildMatch([Question_number],'*Others*'),RGB(255,0,0)) solution or

=If(WildMatch([Question_number],'*Other*'),RGB(255,0,0),Rand) everything is black.

Maybe I could describe it better by picture (I probably shouldn't share data):

When I use this expression:

if($(=subfield(GetFieldSelections([Question_number]),',',))='Others', RGB(255,0,0),Rand)

'Others' (which is always same for all questions) should have always one color, but rest should have different colors (doesn't matter too much which color).

QV_color.png

Not applicable
Author

No answers? So it's not possible?

tresesco
MVP
MVP

How do you get this 'Others' ? Is it coming from a field or getting by using limit (dimension limit)?

Not applicable
Author

I have in questionaire 3-5 questions plus other where could be free text. In QV script I use IF stement to define these 3-5 questions and these answers, which doesn't match these predefined is set to 'Others' by ELSE statement.

tresesco
MVP
MVP

Expression tab->Expand Expression-> Background color : Expression:

=If(YourDimension='Others', Red(),Color(100*Rand()))