@Sebnem,
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 )}
)
)
);