cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Evan_Morris
Level IV

How to make graph Y-Axis axis scale with filter

Kind of a hard one to describe in the title. 

 

I have a heatmap that I move around through with a local data filter.  I would like for the y-axis to maintain a specific scale per heatmap box and for the graph to get longer or shorter based on how may entries on the y-axis exist.  So if it has 10 entries it's X long.  If it has 200 entries it's 20*X long.  

 

Basically I want to maintain readibility of the y-axis labels and the labels in the heatmap itself which link to a hoverlabel graphlet.  

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XI

Re: How to make graph Y-Axis axis scale with filter

You could trigger the size update by a Filter Change Handler.
The gb << Size message just has an effect, if you fist disable Fit to Window:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
	Size( 400, 400 ),
	Show Control Panel( 0 ),
	Set α Level( 0.01 ),
	Fit to Window( "Off" ),
	Summary Statistic( "Median" ),
	Graph Spacing( 4 ),
	Variables( X( :height ), Y( :weight ), Group Y( :age ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

df = gb << Local Data Filter(

	Add Filter( columns( :age ), Where( :age == {14, 15} ), Display( :age, N Items( 6 ) ) )
);
	
adjustSize = Function( {x},
	sizeY = N Items( Current Report()["Local Data Filter", ListBoxBox( 1 )] << get selected() ) * 200;
	gb << size( 400, sizeY );
);
	
fsh = df << Make Filter Change Handler( adjustSize );



 

View solution in original post

2 REPLIES 2
hogi
Level XI

Re: How to make graph Y-Axis axis scale with filter

You could trigger the size update by a Filter Change Handler.
The gb << Size message just has an effect, if you fist disable Fit to Window:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
	Size( 400, 400 ),
	Show Control Panel( 0 ),
	Set α Level( 0.01 ),
	Fit to Window( "Off" ),
	Summary Statistic( "Median" ),
	Graph Spacing( 4 ),
	Variables( X( :height ), Y( :weight ), Group Y( :age ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

df = gb << Local Data Filter(

	Add Filter( columns( :age ), Where( :age == {14, 15} ), Display( :age, N Items( 6 ) ) )
);
	
adjustSize = Function( {x},
	sizeY = N Items( Current Report()["Local Data Filter", ListBoxBox( 1 )] << get selected() ) * 200;
	gb << size( 400, sizeY );
);
	
fsh = df << Make Filter Change Handler( adjustSize );



 

Evan_Morris
Level IV

Re: How to make graph Y-Axis axis scale with filter

I was hoping for something native but yeah that seems like the best option if there isn't a native solution.  Thanks