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

Reset zoom?

Is there a shortcut to reset a plot to "all data points in view"?

Up to now I used a double-click with the magnifier tool - but now I realized that this just resets the zoom to "the original state" *) before zooming.


*)
if no special setting was applied before: the "original state" it's the same as my desired "all data points in view", like here :
https://community.jmp.com/t5/Discussions/zoom-out-in-graph-builder/m-p/327422/highlight/true#M57672  

 

On the other hand, let's assume that before zooming with the magnifier the user first adjusted the axes range manually by dragging the axes.
Then the plot doesn't show all points in "the original state"
...  and therefore, won't show them after "resetting".

Like in this example:
after double-clicking the zoom jump back to the state X>66 - just before the magnifier was used to zoom in.

2023-04-25_18-02-29.gif


Workarounds to get rid of the saved intermediate state:

- toggle on/off "lock scale" *) from the red triangle context menu.
- save the script to script window and remove the block with the axis settings, then run it.

The disadvantages of both methods:
- any additional settings like "log" scale are removed as well.

- they are slightly too long, i.e. interrupt "the flow"

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Reset zoom?

Does << Revert Scale work?

Restore the scale of the axis without altering other customizations

-Jarmo

View solution in original post

hogi
Level XI

Re: Reset zoom?

Nice trick from Jmp Support:

 

@laura_archer  wrote:

... set the axis type as a column property.  You can do this by right clicking on the column and choosing Column Properties -> Axis.  Using this property will have two effects.  The first is that the default plot will take the axis settings defined in the column property.  The other is that if the axis are changed, when we revert scale or revert axis it will return to the conditions that are defined in the column property.


 

The only difficulty is to change the scale to log - without triggering any additional changes which are then saved as well  

hogi_0-1682520605290.png

 

A workaround: JSL

Set Property("Axis",{ Scale( "Log" )})

 

View solution in original post

9 REPLIES 9
hogi
Level XI

Re: Reset zoom?

*) I wondered
what's the difference between locking scales via dragging the axis / zooming with the magnifier tool ... and via the "lock scale" setting.

or in other words:

If I lock the scales via dragging one of the axes - why is there no check mark at lock scales - the scales are locked, right?

 

But lock scales also locks the color gradient (@StarfruitBob)
... dragging an axis or zooming with the magnifier just locks the x and y scale.

 

and I guess there is no variant which also locks the Group By settings , (@vishwasanj )

 

Jackie_
Level VI

Re: Reset zoom?

Try this code:

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window( "",
	H List Box(
		Button Box( "Reset Zoom",
			Report( gb )[axis box( 2 )] << Revert Axis;
			Report( gb )[axis box( 1 )] << Revert Axis;, 
												
			<<SetIcon( "Refresh" ),
			<<setIconlocation( "left" ),
			<<setTip( "Reset Axis" )																			
		), 
		gb = dt << Bivariate( Y( :weight ), X( :height ), FitLine )
	)
);
hogi
Level XI

Re: Reset zoom?

thanks @Jackie_ , really nice.

 

A disadvantage of Revert Axis:
it removes all axis settings: log scale, grid lines, reference lines etc ...

 

Is there a functionality revert Range which just removes the min/max settings?

Unfortunately, 

Report( gb )[axis box( 2 )] << min(.) << max(.)

doesn't have an effect. How can I make it work?

jthi
Super User

Re: Reset zoom?

Does << Revert Scale work?

Restore the scale of the axis without altering other customizations

-Jarmo
hogi
Level XI

Re: Reset zoom?

indeed!
thanks.

jthi
Super User

Re: Reset zoom?

And something like this could be used to script it

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(Variables(X(:height), Y(:weight)), Elements(Points(X, Y), Smoother(X, Y)));
rep = Report(gb);
rep[AxisBox(1)] << Min(70) << Max(75);
rep[AxisBox(2)] << Min(70) << Max(75);


wait(1);
// window_ob = (Current Window()[OutlineBox(1)]);
window_ob = (Window("Big Class - Graph Builder")[OutlineBox(1)]);

// if we only care about Graph Builder
If(N Items(window_ob << XPath("//OutlineBox[@helpKey='Graph Builder']")) == 0,
	stop(); // most likely not graph builder
	// we could of course expand this tool bar to all axisboxes
);

owner_box = Report(window_ob << Get Scriptable Object());
axisboxes = (owner_box << XPath("//AxisBox"));
If(N Items(axisboxes) > 0,
	axisboxes << Revert Scale;
);

And if it is used as toolbar/shortcut, adding more error-handling might be a good idea

-Jarmo
hogi
Level XI

Re: Reset zoom?

Ouch, I just noticed that Revert Scale does a bit more than just resetting the range.

esp: it removes the log scale

 

This was the actual use case that my colleague had in mind when he asked for a solution:

How to reset the range, but keep the log setting.

jthi
Super User

Re: Reset zoom?

I would contact support and ask if type should revert when using Revert Scale (without altering other customizations isn't exactly clearand if they have good suggestions for your task. You could check the scale type and reset it after reverting.

-Jarmo
hogi
Level XI

Re: Reset zoom?

Nice trick from Jmp Support:

 

@laura_archer  wrote:

... set the axis type as a column property.  You can do this by right clicking on the column and choosing Column Properties -> Axis.  Using this property will have two effects.  The first is that the default plot will take the axis settings defined in the column property.  The other is that if the axis are changed, when we revert scale or revert axis it will return to the conditions that are defined in the column property.


 

The only difficulty is to change the scale to log - without triggering any additional changes which are then saved as well  

hogi_0-1682520605290.png

 

A workaround: JSL

Set Property("Axis",{ Scale( "Log" )})