Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
manoranjan_d
Specialist
Specialist

Chart Color Change

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:

Statesales
KA100
TN200
KL300
MH400
DL500
GJ600

qv

dimension as State

expresion as sum(sales)

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

View solution in original post

8 Replies
Or
MVP
MVP

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.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

http://masterssummit.com

http://qlikviewcookbook.com

http://www.easyqlik.com

Or
MVP
MVP

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.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes, if you want to show a subset your alt states solution is an excellent approach.

-Rob

manoranjan_d
Specialist
Specialist
Author

Hi shoham or ROB which is better to implement?

manoranjan_d
Specialist
Specialist
Author

hi shoham

can you pls explain your expression plsease

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

manoranjan_d
Specialist
Specialist
Author

thanks rob &shoham