BookmarkSubscribeRSS Feed
mpl34

Community Trekker

Joined:

Feb 16, 2016

Suppressing Textbox in Chart with Conditions

Hi all,

I am new to jsl and scripting in general, but I am trying to create variability charts based off of conditions of one column.

When I use where under the settings it generates a text box above the plot that matches the entire string within where (and repeats for each chart that is made). Is there any way to suppress this? It is causing display problems when the condition is lengthy and multiple plots are appended.

e.g.:

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt<<variability chart(Y(:Weight),X(:Age),Where(:Sex=="M"));

10991_pastedImage_1.png

Going through the interface does not show this issue but the script seems similar:

10992_pastedImage_2.png

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Suppressing Textbox in Chart with Conditions

Here is the method I use to get rid of the Where Clause.

I suspect there may be a way to reference it from the report output of the variability platform, but since it actually is displayed before the platforms output, I have been successful in wrapping a New Window around the output, with an imbedded "Empty" outline box, and then referencing it from there.

 

Names Default To Here( 1 );

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

   

// Formalize the display into a New Window with an empty

// outline box to allow the referencing of the Where text box

// that preceeds the display of the variability chart

New Window( "Display",

       ob = Outline Box( "", dt << variability chart( Y( :Weight ), X( :Age ), Where( :Sex == "M" ) ) )

);

// Delete the text box that has the Where clause in it

ob[Text Box( 1 )] << delete;

 

Jim
9 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Suppressing Textbox in Chart with Conditions

Here is the method I use to get rid of the Where Clause.

I suspect there may be a way to reference it from the report output of the variability platform, but since it actually is displayed before the platforms output, I have been successful in wrapping a New Window around the output, with an imbedded "Empty" outline box, and then referencing it from there.

 

Names Default To Here( 1 );

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

   

// Formalize the display into a New Window with an empty

// outline box to allow the referencing of the Where text box

// that preceeds the display of the variability chart

New Window( "Display",

       ob = Outline Box( "", dt << variability chart( Y( :Weight ), X( :Age ), Where( :Sex == "M" ) ) )

);

// Delete the text box that has the Where clause in it

ob[Text Box( 1 )] << delete;

 

Jim
mpl34

Community Trekker

Joined:

Feb 16, 2016

Re: Suppressing Textbox in Chart with Conditions

Thanks! This works for me.

dt = Open("$SAMPLE_DATA/Big Class.jmp");

summarize(lev = by(:sex, :age));

k=associative array(lev[1])<<get keys;

nk = nitems(k);

New Window("Var by Sex and Age", main = V List Box());

For(i=1,i<=nk,i++,

  loc1 = loc(lev[1],k);

  vcwin = H List Box();

  For(j=1,j<=nrows(loc1),j++,

  ob=OutlineBox("",dt<<variability chart(Y(:Weight),:X(:Height),Where(:sex==lev[1][loc1] & :age == num(lev[2][loc1])),Std Dev Chart(0)));

  ob[TextBox(1)]<<delete;

  vcwin<<append(ob);

  );

  main<<append(vcwin);

);

Wendy_Murphrey

Joined:

Jun 23, 2011

Re: Suppressing Textbox in Chart with Conditions

An alternative to deleting the TextBox is to simply hide it.  Hiding works fine for the case Jim mentioned, but it may not be ideal for all situations.

ob[Text Box( 1 )] << Hide(1);

Wendy

Wendy
ian_jmp

Staff

Joined:

Jun 23, 2011

Re: Suppressing Textbox in Chart with Conditions

I would caution against removing the levels of the 'By' group variable since, stating the obvious, without them it's not clear which 'subset' each chart relates to.

But, if I understand correctly, you want to make the labels in the outline nodes shorter. If you feel you have to do this you can try this way:

NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Variability chart with 'By' group

vc = dt << variability chart(Y(:Weight),X(:Age),By(:sex));

// Report layer

vcRep = vc << report;

// Get the levels of the 'By' group

levels = AssociativeArray(Column(dt, "sex") << getValues) << getKeys;

// Update (shorten) outline node titles on the report

for(g=1, g<=NItems(vcRep), g++,

vcRep[g][OutlineBox(1)] << setTitle(Char(levels[g]));

);

To understand how it works, take a look at 'Help > Scripting Guide' or 'Help > Scripting Index'.

I'm just curious as to what the 'display problems' are that result from leaving things alone, though

mpl34

Community Trekker

Joined:

Feb 16, 2016

Re: Suppressing Textbox in Chart with Conditions

Thanks for the reply. The extra text was causing issues when in H List Box. Text would be displayed to the side resulting in lots of extra dead space. Plus was the generic text, not evaluated.

11005_pastedImage_0.png

ian_jmp

Staff

Joined:

Jun 23, 2011

Re: Suppressing Textbox in Chart with Conditions

Many thanks Mark - Now I get it.

hardner

Community Trekker

Joined:

Nov 13, 2012

Re: Suppressing Textbox in Chart with Conditions

Just want to say that I too find myself stripping off this Where textbox often - for both the reason you show and that I think this small print clause isn't that great as a label, it can easily get lost visually..

Agree with Ian that info can be useful or even essential but when I'm constructing a custom report using JSL anyway I will normally talk to the redundant outline box headings and modify them to supply this info much more prominently and without the annoying layout issues of the textboxes.  So where you have those big bold labels saying  "Variability Gauge" and "Variability Chart for weight" I would modify those to add SEX=M or whatever there where it's more visible.

Also I often have a lot of plots, varying number depending on the data, etc. so I sometimes use this crude method to strip all the Where textboxes ...

for(i=1000,i>0,i--,

  try(if(contains(nw[textbox(i)]<<gettext,"Where(:"),nw[textbox(i)]<<delete));

  );

ajeong

Community Member

Joined:

Feb 17, 2016

Re: Suppressing Textbox in Chart with Conditions

I was wondering the same thing. Thank you

wlancaster1

Community Trekker

Joined:

Apr 21, 2016

Re: Suppressing Textbox in Chart with Conditions

Frustratingly, this is still an issue. 

 

 

Also frustrating, is that most documentation / solutions for this issue don't cover a wide range of situations, or they brute force it by iterating through the tree structure.

 

 

JMP has xpath capabilities, which is also not well documented. I suppose that this is because xpath is a standard syntax that JMP doesn't have ownership of, and so they do not feel the need to provide any documentation to users who may be unfamiliar.

 

 

Here is the one line of code that I use to get rid of these pesky text boxes, in basically any situation they crop up. You do need to put a wrapper around whatever report contains the offending text box, if there isn't one already. 

 

 

To borrow txnelson's naming of said outline box wrapper:

 

(ob << xpath("//TextBox[contains(text(),'Where(')]")) << delete;

If desired, similar xpath scripting can be used to grab the actual text of the box, perhaps perform some processing to make the information more clear, and then insert it into the title of another outline box or fit group - which would be the desired functionality of saving a report to a script in the first place! 

 

For more reading on xpath in JMP, I highly suggest reading this report [PDF] posted a while back by another JMP user. The PDF outlines the syntax of xpath as it relates to jmp, with helpful examples.