Few questions from Teams chat
Question1:
is there an Xpath command which corresponds to
Dispatch( {}, "X title", TextEditBox,
Answer1:
Easiest way to check is to use << Get XML and check if you can find "X title" from there. You can't (those "display elements" could be same as helpKey attribute but they just haven't been added to everything).
But you can build complicated XPath to get the axis text edit boxes (I think first is always X-axis).
GraphBuilderAxisBox <GraphBuilderComponentBox leftOffset="47" topOffset="435" width="478" height="19">
<GraphBuilderTitleBox width="478" height="19">
<TextEditBox leftOffset="223" topOffset="0" width="31" height="19">My X</TextEditBox>
</GraphBuilderTitleBox>
</GraphBuilderComponentBox>
<GraphBuilderComponentBox leftOffset="47" topOffset="408" width="478" height="27">
<GraphBuilderAxisBox width="478" height="27">
<AxisBox width="478" height="27" charID="1000"/>
</GraphBuilderAxisBox>
</GraphBuilderComponentBox>
You can base your XPath on finding GraphBuilderComponentBox + GraphBuilderAxisBox and preceding GraphBuilderComponentBox + GraphBuilderTitleBox
//GraphBuilderComponentBox[GraphBuilderAxisBox]/preceding-sibling::GraphBuilderComponentBox[1]/GraphBuilderTitleBox/TextEditBox
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(525, 454),
Show Control Panel(0),
Variables(X(:weight), Y(:height)),
Elements(Points(X, Y, Legend(3))),
SendToReport(
Dispatch({}, "X title", TextEditBox, {Set Text("My X")}),
Dispatch({}, "Y title", TextEditBox, {Set Text("My Y")})
)
);
nw = New Window("gbscript", << type("Script"), << Language("XML"),
Report(gb) << Get XML;
);
axis_title_tebs = Report(gb) << XPath("//GraphBuilderComponentBox[GraphBuilderAxisBox]/preceding-sibling::GraphBuilderComponentBox[1]/GraphBuilderTitleBox/TextEditBox");
axis_title_tebs[1] << Set Text("XXXXX");
axis_title_tebs[2] << Set Text("YYYYY");
Write();
Question 2:
This question is more related to Graph Builder though, not directly related to Scripts. Could you please show how to highlight or identify a sample in the Graph? And how to add a label to only one of the samples, and additionally to some specific samples.
Answer 2:
Different types of data (and JMP versions) can require different types of labeling techniques. In worst case you might have to script it but usually this isn't necessary.
I will go with the assumption of JMP18 and simple data. I have graph like this and I wish to label and color the highlighted point
Just by labeling that row and adding color row state it will get highlighted like this
This add-in was also mentioned Column Quick Swapper - easily change multiple Y and X-axis columns in Graph Builder
-Jarmo