cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
JanneI
Level III

How to reset zoom on graph once changed by local data filter?

Dear Experts,

 

I am aware that one can reset the zoom applied by the magnifier (on graph builder) by double clicking or keeping Alt-key pressed (having the magnifier enabled). However, this functionality does not work if any changes to graph is done by using local data filter when being zoomed in state. Zoom in and zoom out (Ctrl key pressed) still works but I would like to have "zoom reset" back to original state.

 

Perhaps this is fixed in upcoming JMP versions. Meanwhile, I could have a button box on my application. Any ideas how to do this? I made some trials with following syntax but I could not find working combination

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

New Window("Big Class Graph",
	V List Box(
		bn = Button Box( "Reset zoom", 
			Report(gb)[GraphBuilderBox(1)] << SendToReport(
				Dispatch(
					{},
					"height",
					ScaleBox,
					{Min( 50 ), Max( 75 ), Inc( 5 ), Minor Ticks( 1 )}
				),
				Dispatch(
					{},
					"weight",
					ScaleBox,
					{Min( 60 ), Max( 180 ), Inc( 10 ), Minor Ticks( 1 )}
				)
			)
		),
		
		gb = dt << Graph Builder(
			Show Control Panel( 0 ),
			Variables( X( :height ), Y( :weight ) ),
			Elements( Points( X, Y, Legend( 1 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"height",
					ScaleBox,
					{Min( 50 ), Max( 75 ), Inc( 5 ), Minor Ticks( 1 )}
				),
				Dispatch(
					{},
					"weight",
					ScaleBox,
					{Min( 60 ), Max( 180 ), Inc( 10 ), Minor Ticks( 1 )}
				)
			)	
		);	
	)
);

 

I am running JMP 16.

 

Thanks,

Janne

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JanneI
Level III

Re: How to reset zoom on graph once changed by local data filter?

Hi All

 

Thanks for the suggestion to use Revert axis. At least following is working for me

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

New Window("Big Class Graph",
	V List Box(
		bn = Button Box( "Reset zoom", 
			rgp = gb << report;
			axisbox_x = rgp[axis box( 1 )];
			axisbox_y = rgp[axis box( 2 )];
			axisbox_x << Revert Axis;
			axisbox_y << Revert Axis;
		),
		
		gb = dt << Graph Builder(
			Show Control Panel( 0 ),
			Variables( X( :height ), Y( :weight ) ),
			Elements( Points( X, Y, Legend( 1 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"height",
					ScaleBox,
					{Min( 50 ), Max( 75 ), Inc( 5 ), Minor Ticks( 1 )}
				),
				Dispatch(
					{},
					"weight",
					ScaleBox,
					{Min( 60 ), Max( 180 ), Inc( 10 ), Minor Ticks( 1 )}
				)
			)	
		);	
	)
);

View solution in original post

3 REPLIES 3
pauldeen
Level VI

Re: How to reset zoom on graph once changed by local data filter?

You can revert the axis (also after filtering). Do it once for the X axis and once for the Y axis. You could also program this under your button but it is not that much faster.

pauldeen_0-1651843611655.png

 

pmroz
Super User

Re: How to reset zoom on graph once changed by local data filter?

Not quite the same thing, but I select "Lock Scales" so that any filtering doesn't change the axis scales.

dt = open("$sample_data\Travel Costs.jmp");

gb = dt << Graph Builder(
	Show Control Panel( 0 ),
	Lock Scales( 1 ),   // "Freeze" the axes
	Variables( X( :Days Advance Purchase ), Y( :Net Cost ) ),
	Elements( Points( X, Y, Legend( 24 ) ), Smoother( X, Y, Legend( 25 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :Booking Day of Week ),
			Display( :Booking Day of Week, N Items( 5 ) )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"Days Advance Purchase",
			ScaleBox,
			{Format( "Fixed Dec", 12, 0 ), Min( -1.48748767778993 ), Max( 130 ),
			Inc( 20 ), Minor Ticks( 1 ), Label Row( Show Major Grid( 1 ) )}
		),
		Dispatch(
			{},
			"Net Cost",
			ScaleBox,
			{Format( "Currency", "USD", 12, 0 ), Min( 0 ), Max( 6656.45852 ),
			Inc( 1000 ), Minor Ticks( 1 ), Label Row( Show Major Grid( 1 ) )}
		)
	)
);
JanneI
Level III

Re: How to reset zoom on graph once changed by local data filter?

Hi All

 

Thanks for the suggestion to use Revert axis. At least following is working for me

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

New Window("Big Class Graph",
	V List Box(
		bn = Button Box( "Reset zoom", 
			rgp = gb << report;
			axisbox_x = rgp[axis box( 1 )];
			axisbox_y = rgp[axis box( 2 )];
			axisbox_x << Revert Axis;
			axisbox_y << Revert Axis;
		),
		
		gb = dt << Graph Builder(
			Show Control Panel( 0 ),
			Variables( X( :height ), Y( :weight ) ),
			Elements( Points( X, Y, Legend( 1 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"height",
					ScaleBox,
					{Min( 50 ), Max( 75 ), Inc( 5 ), Minor Ticks( 1 )}
				),
				Dispatch(
					{},
					"weight",
					ScaleBox,
					{Min( 60 ), Max( 180 ), Inc( 10 ), Minor Ticks( 1 )}
				)
			)	
		);	
	)
);