Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
brunolelli87
Creator II
Creator II

Change the bar colour if the date is not selected

Hey guys,

The following bar chart shows the number of flights per airline per day:

brunolelli87_0-1618502346203.png

And, I'm using the set analysis expression {<MY_DATE_FIELD=>}, in order to let the user to select a spcific date without changing the dimension. In this case, if the user select 08/04/21 for example, this is what he sees. Otherwise he would just see the bar corresponding to day 08/04/21.

brunolelli87_1-1618502473013.png

Which is really very nice, because the selected date is now in evidence.

My question is:
How can I change the colors of the NON SELECTED DATES? I would like to have the same color of the selected DATE but with a transparency. 

Thanks

1 Solution

Accepted Solutions
tresesco
MVP
MVP

🙂

If(DASI=DASI, RGB(RRRR, GGGG, BBBB),Only({1}ARGB(70,RRRR, GGGG, BBBB))) 

View solution in original post

11 Replies
Kasey001
Contributor
Contributor

Screen shot attached for reference. Please advise. We are using QV 11 SR2 vidmate. (also tried in SR7).

eddie_wagt
Partner
Partner

Maybe like this. Make use of a layers. Two charts on top of each other. See examples in attached qvw

Or make use of the background hack with this code:

if(MY_DATE_FIELD = MY_DATE_FIELD
, ”
, rgb(247,247,247)
)

 

brunolelli87
Creator II
Creator II
Author

Hello Mr. Eddie, how are you?

Thanks for your kindly response, but I've already tried this solution and it did not worked.

To tell you the truth I'm already using an IF expression to color the bars per company (NCIA), as you can see below:

 

=if(NCIA='AZU',RGB(14,43,88),
if(NCIA='GLO',RGB(255,112,32),
if(NCIA='VVC',rgb(255,219,0),
...
if(NCIA='SRC',rgb(38,73,110),
if(NCIA='TGY',rgb(0,35,93),
if(NCIA='LAN' or NCIA='LCO',rgb(230,51,88),
))))))

 

 This expression is working perfectly when no date is selected. If one or more dates are selected the code is still coloring the bars corresponding to the selected dates, which is good! But my problem is with the NON SELECTED DATES.

Adding another IF statement and using getfieldselections I can repaint all bars with another color, but jsut with one color. I can not recolor each company (NCIA) individually, like:

 

=if(GetFieldSelections(DASI)<>DASI, red(),
if(NCIA='AZU',RGB(14,43,88),
if(NCIA='GLO',RGB(255,112,32),
if(NCIA='VVC',rgb(255,219,0),
...
if(NCIA='SRC',rgb(38,73,110),
if(NCIA='TGY',rgb(0,35,93),
if(NCIA='SID',rgb(47,57,117),
if(NCIA='MWM',rgb(147,200,70),
if(NCIA='JAT',rgb(158,32,45),
if(NCIA='WAY',rgb(103,51,205),
if(NCIA='AZN' or NCIA='AZP',rgb(0,166,81),
if(NCIA='AVA' or NCIA='TPA',rgb(2219,19,25),
if(NCIA='LAN' or NCIA='LCO',rgb(230,51,88),
)))))))

 

 

So, this is the output:

brunolelli87_0-1618579511111.png

But in this case I can not distinguish the companies (NCIA), and if I try to add some more conditions it just don't work, as you can see below:

 

=if(GetFieldSelections(DASI)<>DASI, if(NCIA='AZU',aRGB(100, 14,43,88), rgb(14,43,88)))

 

brunolelli87_1-1618579744005.png

 

The dimensions I'm using are: DASI (a data field) and NCIA (the airline name).

 

brunolelli87
Creator II
Creator II
Author

Hello guys, 
I'm still trying to solve this issue...

Now I created a Load inline statement and gave the R, G and B color for each company, and defined my bar chart 's background color as rgb(R, G, B). It's working for the selected bar, but those non selected bars are black now... 

Look at that:

brunolelli87_0-1618801338591.png

How can I set the same color (as can be seen on selected date) for those non selected dates (black ones), but with an alpha of 100? 

Thanks

tresesco
MVP
MVP

Could you share your app with sample data to work on?

brunolelli87
Creator II
Creator II
Author

Hello Tresesco, how are you?

 

Yes, of course... please find attached my sample file.
But unfurtunately, I'm using QlikView Personal Edition, so I'm not able to open any file from you...

 

Would you mind helping me writing your steps?
Thanks

tresesco
MVP
MVP

Are you looking for something like:

tresesco_0-1618809178298.png

?

brunolelli87
Creator II
Creator II
Author

Yep! Exactly

brunolelli87
Creator II
Creator II
Author

You took less than 15 minutes to do it.
I've been trying all day!!!

How can I do that?