该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


Use the display reference to send messages to the display elements using the Send or << operator. For example, if out2 is a reference to an outline node, you can ask the node to close itself if it is open:
Close() toggles an outline node back and forth between closed and open states, just like selecting items in the red triangle menu. You can include a Boolean argument (1 or 0) for “close or leave closed” or “open or leave open.”
You can send messages to display boxes using the send (<<) operator. The operator makes it clear when the script is evaluating child arguments and optional arguments. It also helps make it clearer which argument is an option and which is a script to run inside the graph.
win = New Window( "Messages",
gb = Graph Box(
Frame Size( 400, 400 ),
X Scale( 0, 25 ),
Y Scale( 0, 25 )
gb << Background Color( "red" );
When you stack (or nest) messages, each message is evaluated left to right.
The following expression sends message1 to box, then message2 to box, then message3 to box. Note that any of the messages can change box before the next message is sent.
The following expression sends message1 to box and gets the result. Message2 is sent to that result, and message3 is sent to the result of message2.
The result of message3 is assigned to the variable x.
win = New Window( "Messages", gb = Graph Box() );
sz = gb << Background Color( "red" )
<<Save Picture( "$DOCUMENTS/red.png", "png" )
<<Background Color( "white" )
<<Get Size();
The Send To Report() and Dispatch() functions provide a way for JMP to record display box modifications inside an analysis script in a self-contained way. For example, arguments within the two functions open and close outline nodes, resize graphics frames, or customize the colors in a graphics frame. You can also specify the arguments in separate JSL statements.
Send To Report() contains a list of options that change the display tree.
Dispatch() contains four arguments that change the display tree:
For example, open Big Class.jmp and run the attached Bivariate script. This generates a report with a fitted line. Open the Lack of Fit outline node, and close the Analysis of Variance outline node. Select Save Script > To Script Window. The following script appears in the script editor window:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate(
{"Linear Fit"},
"Lack Of Fit",
{Close( 0 )} ),
{"Linear Fit"},
"Analysis of Variance",
{Close( 1 )}
The Send To Report() function contains two Dispatch() functions that customize the default report.
The best way to deal with Send to Report() and Dispatch() is to first create a customized report interactively. Save the report as a script and then examine the script that JMP generates. Remember: the best JSL writer is JMP itself.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate( Y( weight ), X( height ) );
rbiv << Journal Window;
rbiv << Save Journal(
"$DOCUMENTS/test.jrn"
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate(
( ( Report( biv[1] ) << Parent ) << Parent ) <<
Save Journal( "test.jrn" );
win = New Window( "Numeric Column",
num = Number Col Box( "Values", [9, 10, 11] )
num << Set Values( [1, 2, 3] );
New Window( "Example",
ncb = Number Col Box( "Random Numbers",
{Random Uniform(), Random Uniform() * 10,
Random Uniform() * 100, Random Uniform() * 1000,
Random Uniform() * 10000}
ncb << Set Format(10,3, "Fixed Dec", "Use thousands separator");
win = New Window( "String Column",
str = String Col Box( "Values", {"a", "b", "c"} )
str << Set Values( {"A", "B", "C"} );
Generally, JMP automatically wraps text within Text Box(). However, the default wrap point can be overridden with a Set Wrap (n) message. The following script wraps the text at 200 pixels.
win = New Window( "Set Wrap",
tb = Text Box(
"Place your cursor over a data point for more information."
tb << Set Wrap( 200 );
You can add bullet points using the Bullet Point( 1 ) message.
win = New Window( "Bullet List",
text1 = Text Box( "Place your cursor over a data point for more information." ),
text2 = Text Box( "Circle your cursor over a statistic for more information." )
text1 << Bullet Point( 1 );
text2 << Bullet Point( 1 );
Sending the Bullet Point( 1 ) message to a text box places a bullet in front of the text and indents subsequent lines within that text box.
You can also send the Bullet Point( 1 ) message inline as shown in the following example:
text1 = Text Box( "Place your cursor over a data point for more information." ), << Bullet Point( 1 ) ),
You can use Select, Reshow, and Deselect to blink the selection highlight on a display box. As previously described, you can string together several << clauses to send an object several messages in a row. The results read left to right; for example, here Select is done first, then Reshow, then Deselect, then the other Reshow.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate(
out2 = rbiv[Outline Box( "? Mean" )];
out2 << Close( 0 ); // open the outline box
scbx = rbiv[String Col Box( 1 )];
Wait( .25 ); // wait .25 seconds
For( i = 0, i < 20, i++,
scbx << Select << Reshow << Deselect << Reshow
Headings are shaded and have column borders by default. To turn them off, use the Set Shade Headings ( 0 ) message and the Set Heading Column Borders ( 0 ) message. The following example shows the effect of turning shading and borders off:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
meanHt = Mean( Height ),
minHt = Min( Height ),
maxHt = Max( Height )
win = New Window( "Summary Results",
tb = Table Box(
Number Col Box( "Mean", meanHt ),
Number Col Box( "Min", minHt ),
Number Col Box( "Max", maxHt )
Wait( 2 );
tb << Set Shade Headings( 0 );
Wait( 1 );
tb << Set Heading Column Borders( 0 );
Wait( 2 );
tb << Set Shade Headings( 1 );
Wait( 1 );