Subscribe Bookmark RSS Feed

Suppressing Textbox in Chart with Conditions

mpl34

Community Trekker

Joined:

Feb 16, 2016

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
Solution

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
8 REPLIES
Solution

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

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

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

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

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

Many thanks Mark - Now I get it.

hardner

Community Trekker

Joined:

Nov 13, 2012

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

I was wondering the same thing. Thank you