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

Straigt Chart Coloring

Hello

My data look like this: (see table below). There are 4 stores, each selling different fruits. The "Buy" field indicates whether to buy that fruit from that store or not. I made a straight table to display how many items to buy/not buy from each store. I would like to color the straight table this way: Comparing it with my favorite fruit list:(Apple, Orange, Strawberry, Banana). For each store, if the one of my favorite fruit is brought there, color the cell Green, if not brought, color the cell Purple (see sample below)

Can someone help with the coloring?

Thanks

Yvonne

Capture.PNG

   

StoreItemBuy
AAppleY
APearY
AWatermelonN
BAppleN
BPineappleN
BOrangeY
BTomatoN
CPearY
CWatermelonN
CAppleN
CStrawberryN
DBananaN
DBlueberryY
DPear

N

1 Solution

Accepted Solutions
maxgro
MVP
MVP

chart

expression

     count({<Buy={Y}>} DISTINCT Item)

yes, background color

     if(count({<Buy={Y}, Item={Apple,Orange,Strawberry,Banana}>} DISTINCT Item)>0, Green())

script

fruits:

load * inline [

Store Item Buy

A Apple Y

A Pear Y

A Watermelon N

B Apple N

B Pineapple N

B Orange Y

B Tomato N

C Pear Y

C Watermelon N

C Apple N

C Strawberry N

D Banana N

D Blueberry Y

D Pear N

] (delimiter is spaces);

View solution in original post

3 Replies
maxgro
MVP
MVP

PFA

1.png

Anonymous
Not applicable
Author

HI Maxgro,

I'm still in the process of getting a QV license, so I can't open your QV file. I assume you added an expression to the background color ? Can you share the expression?

Thanks

Yvonne

maxgro
MVP
MVP

chart

expression

     count({<Buy={Y}>} DISTINCT Item)

yes, background color

     if(count({<Buy={Y}, Item={Apple,Orange,Strawberry,Banana}>} DISTINCT Item)>0, Green())

script

fruits:

load * inline [

Store Item Buy

A Apple Y

A Pear Y

A Watermelon N

B Apple N

B Pineapple N

B Orange Y

B Tomato N

C Pear Y

C Watermelon N

C Apple N

C Strawberry N

D Banana N

D Blueberry Y

D Pear N

] (delimiter is spaces);