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

How to get the graph builder to dispatch a variable scale for the Y variable depending on the data

Hi All, 

 

I have been searching this topic throughout the community discussions but I had not luck so far. 

 

How to get the graph builder to dispatch a variable scale for the Y variable depending on the data range?  

 

Using the BigClass data example If I had more than one graph to plot I would use the following script:

dt= Open ("Big Class.JMP");

win = New window("Graphs", lub = Lineup Box (Ncol(2)));

Sexs = (Associative Array(Column (dt, "sex"))<<Get keys);

For (i = 1, i<= N items (Sexs), i++,

lub<< Append( Graph Builder(
	Variables( X( :weight ), Y( :height ), Wrap( :sex, N View Levels( 1 ) ) ),
	Elements( Points( X, Y, Legend( 7 ) ), Smoother( X, Y, Legend( 9 ) ) ),
	Local Data Filter(
	Close Outline( 1 ),
	Add Filter(
	columns( :Sex ),
	Where( :Sex == Sexs[i] ),
	Display( :Sex, Size( 224, 126 ), List Display )) ))));

 This code works for me. Also, the Y scale adjusts automatically which is great. However, if I would like to keep some characteristics costumized like lets say I want to have a Y minimum of 55 as an example but I would like to leave JMP to select the Y maximum according to the data range. How do I do that in this case?

 

In my situation is different, I would like the Y minimum to be always zero since I have a curve with all the values starting in zero but for some reason JMP sets the variables axis settings starting on negative numbers regardless. Nevertheless, even if I would like the values to be shown on a specific Y minimum for all the graphs I am not able to then have the Y Max to change automatically according to the range of data or until the actual Y maximum. 

Using the script above and doing this manually I would have the resulting script line when setting a Y minmum only as 55 :

SendToReport(Dispatch({},"height",ScaleBox,{Min( 55 ),  Inc( 5 ), Minor Ticks( 1 )}));

You will see that the resulting two graphs will have the same Y maximum regardless and set as below 70 even though one of the graphs has data until 70. 

 

Does anyone know how to do write a script that would allow the Y max to change accroding to the data range or set the Max dependent on the Local filter already defined?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to get the graph builder to dispatch a variable scale for the Y variable depending on the da

It appears as if the max value is stuck for both charts.  However, here is a work around that permits the charts to run independently.

dt2 = Open( "$SAMPLE_DATA\Big Class.JMP" );

win = New Window( "Graphs", lub = Lineup Box( N Col( 2 ) ) );

Sexs = (Associative Array( Column( dt2, "sex" ) ) << Get keys);

For( i = 1, i <= N Items( Sexs ), i++,
	dt2 << select where( :sex == sexs[i] );
	dt = dt2 << subset( invisible, selected rows( 1 ), selected columns( 0 ) );
	lub << append(
		gb = dt << Graph Builder(
			Variables( X( :weight ), Y( :height ), Wrap( :sex, N View Levels( 1 ) ) ),
			Elements( Points( X, Y, Legend( 7 ) ), Smoother( X, Y, Legend( 9 ) ) ),
			Local Data Filter(
				Close Outline( 1 ),
				Add Filter(
					columns( :Sex ),
					Where( :Sex == Sexs[i] ),
					Display( :Sex, Size( 224, 126 ), List Display )
				)
			)
		);
		Report( gb )[AxisBox( 2 )] << Min( 0 );
	)
	
	;
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to get the graph builder to dispatch a variable scale for the Y variable depending on the da

It appears as if the max value is stuck for both charts.  However, here is a work around that permits the charts to run independently.

dt2 = Open( "$SAMPLE_DATA\Big Class.JMP" );

win = New Window( "Graphs", lub = Lineup Box( N Col( 2 ) ) );

Sexs = (Associative Array( Column( dt2, "sex" ) ) << Get keys);

For( i = 1, i <= N Items( Sexs ), i++,
	dt2 << select where( :sex == sexs[i] );
	dt = dt2 << subset( invisible, selected rows( 1 ), selected columns( 0 ) );
	lub << append(
		gb = dt << Graph Builder(
			Variables( X( :weight ), Y( :height ), Wrap( :sex, N View Levels( 1 ) ) ),
			Elements( Points( X, Y, Legend( 7 ) ), Smoother( X, Y, Legend( 9 ) ) ),
			Local Data Filter(
				Close Outline( 1 ),
				Add Filter(
					columns( :Sex ),
					Where( :Sex == Sexs[i] ),
					Display( :Sex, Size( 224, 126 ), List Display )
				)
			)
		);
		Report( gb )[AxisBox( 2 )] << Min( 0 );
	)
	
	;
);
Jim
ivomdb
Level III

Re: How to get the graph builder to dispatch a variable scale for the Y variable depending on the da

Thanks so much Jim.