Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

Previous and Next button for 2 bar charts

Hi guys,

just wan to know whether it is possible or not.

I have 2 bar charts to show.. side by side. i cant use the srcollling and limit to certain value shown, because if i do so, i have to scroll the left barr then scroll th right bar as well.

i am thinking, can i create Next or Previous button , and set it to show 5 data each time, previous or next. but when i click on the button, both bar charts to should be affected as well.

anyone there???

Rgds

Jim

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

For the expression I used, yes, but the idea can be extended. There's probably a simpler approach, but...

Data:
LOAD
chr(ord('A')-1+ceil(rand()*25)) as Dim
,ceil(rand()*10) as Val1
,ceil(rand()*100) as Val2
AUTOGENERATE 100
;
Show:
LOAD recno() as Rank
AUTOGENERATE fieldvaluecount('Dim')
;

Use Rank as the slider. Use this for your charts' dimension:

=aggr(if(1 + count(total distinct Dim) - rank(Dim)<=max(Rank) and 1 + count(total distinct Dim) - rank(Dim)>=min(Rank),Dim),Dim)

View solution in original post

12 Replies
shraddha_g
Partner - Master III
Partner - Master III

use same button variable in both charts

lakshmikandh
Specialist II
Specialist II

Hi, you can sort it by measure expression and set it to show top 10 fixed number and check option to show others

When you click on others then it will show next top 10 , etc .

jim_chan
Specialist
Specialist
Author

No.. point here is. if by doing so, 1st - of course it will show top 10, but.. when i want to look at the next 10, i will have to scroll bar chart 1 , adn then scroll bar chart 2.

client is looking for a button, where when click on Next, both chart will scroll to the Next 10.

jim_chan
Specialist
Specialist
Author

but how to write that variable for that button? if i want the next button to show next 5.

johnw
Champion III
Champion III

This isn't strictly what you asked for, but I feel meets the same sort of requirement. It uses a slider on the dimension with a fixed range. So it's making actual selections rather than scrolling through the selections. But if you really don't want it making selections, but only scrolling what was selected, I'm sure that's doable too. I'm thinking about how I might approach it.

Capture.PNG

johnw
Champion III
Champion III

Here's a possible solution that looks virtually the same as the previous, but doesn't change your actual selections. It shows 5 at a time of whatever you've actually selected.

Capture.PNG

jim_chan
Specialist
Specialist
Author

Hi John,

Ok. i will use the slider. i want to use the field for example "Country" in my slider.

but in order for it to work, do i need to change the "country" to number format??? I dont know how.

the DIM that you showed was in number format.

Rgds

Jim

johnw
Champion III
Champion III

For the expression I used, yes, but the idea can be extended. There's probably a simpler approach, but...

Data:
LOAD
chr(ord('A')-1+ceil(rand()*25)) as Dim
,ceil(rand()*10) as Val1
,ceil(rand()*100) as Val2
AUTOGENERATE 100
;
Show:
LOAD recno() as Rank
AUTOGENERATE fieldvaluecount('Dim')
;

Use Rank as the slider. Use this for your charts' dimension:

=aggr(if(1 + count(total distinct Dim) - rank(Dim)<=max(Rank) and 1 + count(total distinct Dim) - rank(Dim)>=min(Rank),Dim),Dim)

jim_chan
Specialist
Specialist
Author

if i already have a field "Country" in my data loading.

load

Country,

recno() as Rank


Is it like this will do??


Rgds


Jim