Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
in my bar chart i have state wise data based on sum of sales now my requirement is that
when user select specific any state in the bar chart the selected bar has to be changed in shaded color and remaining state has to be reamin the same the color
example if user select TN that bar has to be in shaded or different color , and remaining bar has to be in same blue color
how to achieve this
date:
State | sales |
KA | 100 |
TN | 200 |
KL | 300 |
MH | 400 |
DL | 500 |
GJ | 600 |
qv
dimension as State
expresion as sum(sales)
It depends on your final requirement. If it is as simple as stated where everything should be shown but selected states shaded, then I think the set analysis approach I showed is simplest.
If your requirement becomes more complex such as shading only selections made in the chart, or showing a subset of states, then Or's Alternate State approach will give you more power and flexibility.
-Rob
There's probably newer, better, and cleaner ways to do this, but I'm including an example I made for this sort of functionality back in 2011, using alternate states. Hopefully someone else can chime in with a cleaner approach.
I don't think alternate states are necessary, just set analysis. See attached. Ignore the State= selection in the chart expression and then use a background color expression like:
if(GetSelectedCount(State)>0 and State=State
, LightGray(), color(1))
Also see
Qlikview Cookbook: Focus not Filter http://qlikviewcookbook.com/recipes/download-info/focus-not-filter/
-Rob
That does sound like a better, cleaner approach (though it does seem to have a downside - you will always see all the states, and you can't narrow down the list if you're just interested in some). That said, I much prefer this to what I did seven years ago. Good to know.
Yes, if you want to show a subset your alt states solution is an excellent approach.
-Rob
Hi shoham or ROB which is better to implement?
hi shoham
can you pls explain your expression plsease
It depends on your final requirement. If it is as simple as stated where everything should be shown but selected states shaded, then I think the set analysis approach I showed is simplest.
If your requirement becomes more complex such as shading only selections made in the chart, or showing a subset of states, then Or's Alternate State approach will give you more power and flexibility.
-Rob
thanks rob &shoham