BookmarkSubscribe
Choose Language Hide Translation Bar
samir
Community Trekker

How to update axis limits via Global Box

Hello,

I want to control the limites of the Y-axis of a graph via Global boxes (to allow the user to quickly change the limites without double-clicking on the axis properties...).

In the script attached, I create a window and a graph. Then I add 2 Global Boxes (Lim1 and Lim2) that I initialyze.

Once the graph is generated, I modify the values of Lim1 and Lim2 but the graph axis is not updated accordingly...I do not see what I am doing wrong.

Can someone help ?

Thanks.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to update axis limits via Global Box

I changed the format a bit, just because I wasn;'t sure what everything was doing.  However, below is an example of how I typically handle the item that you are questioning.  My bigger question, is isn;'t it actually simpler to just drag and move the axis setting simpler for your users, than actually typing in the min and max values?

Names Default To Here( 1 );

//DataPath = "C:\Program Files (x86)\SAS\JMP\11\Samples\Data\Variability Data\Wafer.jmp";
myTable = Open( "$SAMPLE_DATA\Variability Data\Wafer.jmp" );

Param = "Y";
Lim1 = 40;
Lim2 = 160;

FrameSize_X = 775;
FrameSize_Y = 200;

MyWindow = New Window( "Window Controls",
	gr = MyTable << Variability Chart(
		Y( :Name( "Y" ) ),
		X( :Operator, :Wafer ),
		Max Iter( 100 ),
		Std Dev Chart( 1 ),
		Show Range Bars( 0 ),
		Show Grand Median( 0 ),
		Std Dev Chart( 0 ),
		Points Jittered( 1 ),
		Show Box Plots( 1 ),
		Automatic Recalc( 1 ),
		SendToReport(
			Dispatch(
				{"Variability Chart for Y"},
				"2",
				ScaleBox,
				{Min( Lim1 ), Max( Lim2 ), Inc( Abs( Lim2 - Lim1 ) / 10 ), Minor Ticks( 0 ),
				Show Major Grid( 1 ), Show Minor Grid( 1 ), Inside Ticks( 1 )}
			),
			Dispatch( {"Variability Chart for Y"}, "Y", TextEditBox, {Set Text( Param )} ),
			Dispatch(
				{"Variability Chart for Y"},
				"Variability Chart",
				FrameBox,
				{Frame Size( FrameSize_X, FrameSize_Y ), ,
				Row Legend(
					Name( "Operator" ),
					Color( 1 ),
					Color Theme( "JMP Default" ),
					Marker( 0 ),
					Marker Theme( "" ),
					Continuous Scale( 0 ),
					Reverse Scale( 0 ),
					Excluded Rows( 0 )
				)}
			),
			Dispatch(
				{"Variability Chart for Y"},
				"Varability Std Chart",
				FrameBox,
				{Frame Size( FrameSize_X, FrameSize_Y )}
			)	
		
		)
			
	),
	Panel Box( "1/ Start...", 

		
		g3 = V List Box(
			H List Box(
				Text Box( "Lim 1" ),
				n1 = Number Edit Box(
					Lim1,
					5,
					<<SetFunction(
						Function( {this},
							Report( gr )[AxisBox( 1 )] << Min( n1 << get )
						)
					)
				)
			),
			H List Box( Text Box( "Lim 2" ), n2 = Number Edit Box( Lim2,5,
			<<SetFunction(
						Function( {this},
							Report( gr )[AxisBox( 1 )] << Max( n2 << get )
						)
					)
			 ) ), 
				
		)
	)
);
Jim
3 REPLIES 3
Jeff_Perkinson
Community Manager Community Manager

Re: How to update axis limits via Global Box

The issue is that the global variable is used to set the axes when the graph is created but the graph doesn't have any relation the global variable after that.

 

There are ways to create the interactivity you're looking for (and I'm sure someone here can provide a prototype) but please don't overlook the built-in interactivity of the axis of every graph in JMP. All you have to do is hover over the axis and the cursor will turn into a hand and you can click and drag to change the axis.

 

Apr-14-2017 17-22-19.gif

 

You'd do your users a great service by teaching them this. That way, they'll have control over every graph they see in JMP, not just the ones you create for them and give them handy text box controls for. 

-Jeff
txnelson
Super User

Re: How to update axis limits via Global Box

I changed the format a bit, just because I wasn;'t sure what everything was doing.  However, below is an example of how I typically handle the item that you are questioning.  My bigger question, is isn;'t it actually simpler to just drag and move the axis setting simpler for your users, than actually typing in the min and max values?

Names Default To Here( 1 );

//DataPath = "C:\Program Files (x86)\SAS\JMP\11\Samples\Data\Variability Data\Wafer.jmp";
myTable = Open( "$SAMPLE_DATA\Variability Data\Wafer.jmp" );

Param = "Y";
Lim1 = 40;
Lim2 = 160;

FrameSize_X = 775;
FrameSize_Y = 200;

MyWindow = New Window( "Window Controls",
	gr = MyTable << Variability Chart(
		Y( :Name( "Y" ) ),
		X( :Operator, :Wafer ),
		Max Iter( 100 ),
		Std Dev Chart( 1 ),
		Show Range Bars( 0 ),
		Show Grand Median( 0 ),
		Std Dev Chart( 0 ),
		Points Jittered( 1 ),
		Show Box Plots( 1 ),
		Automatic Recalc( 1 ),
		SendToReport(
			Dispatch(
				{"Variability Chart for Y"},
				"2",
				ScaleBox,
				{Min( Lim1 ), Max( Lim2 ), Inc( Abs( Lim2 - Lim1 ) / 10 ), Minor Ticks( 0 ),
				Show Major Grid( 1 ), Show Minor Grid( 1 ), Inside Ticks( 1 )}
			),
			Dispatch( {"Variability Chart for Y"}, "Y", TextEditBox, {Set Text( Param )} ),
			Dispatch(
				{"Variability Chart for Y"},
				"Variability Chart",
				FrameBox,
				{Frame Size( FrameSize_X, FrameSize_Y ), ,
				Row Legend(
					Name( "Operator" ),
					Color( 1 ),
					Color Theme( "JMP Default" ),
					Marker( 0 ),
					Marker Theme( "" ),
					Continuous Scale( 0 ),
					Reverse Scale( 0 ),
					Excluded Rows( 0 )
				)}
			),
			Dispatch(
				{"Variability Chart for Y"},
				"Varability Std Chart",
				FrameBox,
				{Frame Size( FrameSize_X, FrameSize_Y )}
			)	
		
		)
			
	),
	Panel Box( "1/ Start...", 

		
		g3 = V List Box(
			H List Box(
				Text Box( "Lim 1" ),
				n1 = Number Edit Box(
					Lim1,
					5,
					<<SetFunction(
						Function( {this},
							Report( gr )[AxisBox( 1 )] << Min( n1 << get )
						)
					)
				)
			),
			H List Box( Text Box( "Lim 2" ), n2 = Number Edit Box( Lim2,5,
			<<SetFunction(
						Function( {this},
							Report( gr )[AxisBox( 1 )] << Max( n2 << get )
						)
					)
			 ) ), 
				
		)
	)
);
Jim
samir
Community Trekker

Re: How to update axis limits via Global Box

Nelson, Jeff,

I understand your reasoning: using the interactive platform (drag, move,...) of the axes is very useful indeed...However for a couple of reasons, it is not helpful for me:

  1. Most of the graphs I will generate will contain outliers that will have a value much higher than the rest of the population. In this case, the intreactive solution is very time consuming and painfull...
  2. I intend to generate like 30 graphs in a single window: you can imagine that changing interactively the 30 graphs is not an option. having a box or couple of boxes to set all values is more time-efficient.

Anyway, I see the solution of Nelson is working fine. It looks a big complexe: I have to look in details what is done.

thanks a lot.

0 Kudos