cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
RonSwanson
Level I

OneWay

My script has a list of Y values to plot. I have dialog box to select the "X" and "By" columns for the OneWay plot. I then want to format the axis settings, but it names the plots "Oneway Analysis of Y1" followed with the X axis column, for instance "By Wafer", and then the By value, for instance "Lot=1234".... in total it would be "Oneway Analysis of Y1 By Wafer Lot=1234"

Is there a way to get that into the Dispatch clause so I can automate the axis formatting?

 

	list_y = { "Y1", "Y2" };
	dlg = Column Dialog( x = ColList( "X", Max Col( 1 ) ));
	if(dlg["Button"] == 1,
	xCol = dlg["x"];);
	dlg = Column Dialog( by = ColList( "By", Max Col( 7 ) ));
	if(dlg["Button"] == 1,
	byCol = dlg["by"]);
	OneWay(	Y( Eval( list_y ) ), X( Eval( xCol ) ),	By( Eval( byCol ) ),
	SendToReport(
	Dispatch({"Oneway Analysis of Y1"},"1",ScaleBox,{Scale( "Log" ),Format( "Scientific", 12 ),Inc( 1 ),Minor Ticks( 8 ),Show Minor Grid( 1 ),Show Major Grid ( 1 )}),
	Dispatch({"Oneway Analysis of Y2"},"1",ScaleBox,{Scale( "Log" ),Format( "Scientific", 12 ),Inc( 1 ),Minor Ticks( 8 ),Show Minor Grid( 1 ),Show Major Grid ( 1 )})
	));
4 REPLIES 4
cwillden
Super User (Alumni)

Re: OneWay

Use xpath to select all the Oneway objects, and then send the Dispatch message to all of them at once.  I don't have your data, but it worked magnificently on the Big Class data in the sample data library, even if you have a By variable.  This *should* work directly:

list_y = {"Y1", "Y2"};
dlg = Column Dialog( x = ColList( "X", Max Col( 1 ) ) );
If( dlg["Button"] == 1,
	xCol = dlg["x"]
);
dlg = Column Dialog( by = ColList( "By", Max Col( 7 ) ) );
If( dlg["Button"] == 1,
	byCol = dlg["by"]
);

//Name the oneway analysis object 'tmp'
tmp = OneWay( Y( Eval( list_y ) ), X( Eval( xCol ) ), By( Eval( byCol ) ) );

//get the window containing the one-way analysis
win = tmp << report;

//Select all the oneway objects and alter all the y-axes
(win << xpath( "//OutlineBox[@helpKey='Oneway Report']" )) << Dispatch(
	{},
	"1",
	ScaleBox,
	{Scale( "Log" ), Format( "Scientific", 12 ), Inc( 1 ), Minor Ticks( 8 ), Show Minor Grid( 1 ), Show Major Grid( 1 )}
);

Here's another example with Big Class:

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

win = (dt << Oneway( Y( {:height, :weight} ), X( :age ), By(:Sex) )) << Report;

(win << xpath( "//OutlineBox[@helpKey='Oneway Report']" )) << Dispatch(
	{},
	"1",
	ScaleBox,
	{Scale( "Log" ), Format( "Scientific", 12 ), Inc( 1 ), Minor Ticks( 8 ), Show Minor Grid( 1 ), Show Major Grid( 1 )}
);
-- Cameron Willden
RonSwanson
Level I

Re: OneWay

Thanks! This is some really cool functionality I was not aware of.

In my code, I have anywhere from 20-40 columns to plot in the y list, and they have different y axis format needs. Your solution is perfect for updating all the same format, can the below methodolgy lend itself to specific formatting of individual plots? 

cwillden
Super User (Alumni)

Re: OneWay

You could use xpath to also examine the title of outline box to determine which response is being plotted and then conditionally set the axis settings for the corresponding response. This gets pretty hairy with 20-40 potential responses.
-- Cameron Willden

Re: OneWay

You might find it easier to apply the formatting as part of the column properties in the data table, if you don't mind all plots (and the data table) using the same format for each column.