- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
vertical line and annotation
I watched an on-air video and tried to come up with a Control chart including the vertical lines and comments (annotations). I got the lines but the comments are all messed up. I tried number of things but no success. Can you please see the attached file, code and let me know what the issue is?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: vertical line and annotation
I used your script. There are 2 main problems. JMP Control Chart uses sequence for the X-axis and TestDate is used to define Labels. So the x position of your label should be Row() - 1, same as the vertical line. I commented out Right Justified and used minus 0.75 for the label to be just to the right of the vertical line. Remove the comment on Right Justified and make it Row() - 1 for the labels to appear to teh left of the vertical line.
The second error is the y position. Your multiplying factor of 1.2*Col Maximum(:Avg) is > 1500. I added a dummy value, you might want to consider Col Max(:Avg) +0.10 * Col Std Dev(:Avg).
So your problems were x and y pos. This is an easy method to add comments using column information. However, this is only as log as the table is open.
Say that you journal the resulting graph, close the data table and control chart report and make any update like changing the line width of the control limits. both the lines and the comments disappear. Or if you save teh journal and send to another or open it in a new session, again the labels and lines are gone.
In order to maintain those lines and text, the values, not references to the data table must be used. I will add a second script that uses values and references. But this should show what went wrong with your script.
Control Chart(
Sample Label( :TestDate ),
Group Size( 1 ),
KSigma( 3 ),
Chart Col( :Avg, Individual Measurement ),
SendToReport(
Dispatch(
{"Individual Measurement of Avg"},
"IR Chart of IM",
FrameBox,
{Add Graphics Script( 2, Description( "Script" ), Empty() ),
Add Graphics Script(
3,
Description( "Script" ),
For Each Row(
If( Is Missing( :comment ) == 0,
V Line( Row() - 1 )
)
);
For Each Row(
If( Is Missing( :comment ) == 0,
Text(
//Right Justified,
{Row()-0.75, Col Maximum( :Avg )+ 1.005},
:Comment
)
)
);
), Grid Line Order( 5 ), Reference Line Order( 6 )}
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: vertical line and annotation
@Sebnem ,
There are multiple methods to create the script (expression) that has the embedded values for the vertical line and the text, not references to rows and columns,
JSL functions for expressions [Substitute(), NameExpr(), EvalExpr(), Expr() ] and JSL character functions that convert text to JSL expressions [ Concat(), ConcatTo(), Eval Insert() and Parse] are good to learn.
cc= Control Chart(
Sample Label( :TestDate ),
Group Size( 1 ),
KSigma( 3 ),
Chart Col( :Avg, Individual Measurement )
);
rcc = report(cc);
scrp = Expr(Add Graphics Script(3,
Description( "PM Labels" )));
//get y placement = axis max - 0.5* axis inc
ypos = (rcc[AxisBox(1)]<< Get Max) - 0.5* (rcc[AxisBox(1)] << Get Inc);
txtcmd = "";
For Each Row(
If( Is Missing( :comment ) == 0,
txtcmd ||= EvalInsert("\[
V Line( ^Row() -1^ );
Text(
//Right Justified,
{ ^Row() - .75^, ^ypos^},
"^:comment(Row())^");]\")
)//end if
); //end for each row
show (txtcmd ); //see log
InsertInto(scrp, Parse(txtcmd));
show (scrp ); //see log
txtxp = Substitute(Expr(rcc[FrameBox(1)] << cmd), Expr(cmd), NameExpr(scrp));
Show(NameExpr(txtxp));
Eval(txtxp);
Note, instead of using For Each Row() , a idx= dt << get rows where ( !Is Missing( :comment ) ) could be used to find the smaller list of rows with comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content