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.
gb = Graph Box(
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.
|
•
|
<<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:
biv = dt << Bivariate(
{"Linear Fit"},
{"Linear Fit"},
•
|
The fourth argument is the argument to send to this outline box. In this case, the message is Close(0), in other words, open the node.
|
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.
biv = dt << Bivariate( Y( weight ), X( height ) );
rbiv = biv << Report;
rbiv << Journal Window;
rbiv << Save Journal(
biv = dt << Bivariate(
Save Journal( "test.jrn" );
To update a numeric column in a display box table, use the Set Values message.
To add the thousands separator in a numeric column, use the Set Format message.
New Window( "Example",
To update a string column in a display box table, use the Set Values message.
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.
tb = Text Box(
You can add bullet points using the Bullet Point( 1 ) message.
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.
biv = dt << Bivariate(
rbiv = biv << Report;
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:
meanHt = Mean( Height ),
minHt = Min( Height ),
maxHt = Max( Height )
tb = Table Box(
Wait( 2 );
Wait( 1 );
Wait( 2 );
Wait( 1 );