cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
gzmorgan0
Super User (Alumni)

Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

 

 

GraphBuilder BoxPlot segments in JMP 14 and 15 appear to have a built-in hover label.

 

Interactively, the hover label can be pinned.

 

Embedded below is a picture of a pinned hover label and the associated saved script.

 

I am interested in accessing the BoxPlotSeg fences. I have not found JSL syntax to access the fence values. From the saved script, of an interactive session, it seems apparent that these fence values are inherent with the GraphBuilder. I know how to find/compute the fence values for an Outlier BoxPlot. However, if JMP has exposed the values via GraphBuilder or another method, I would like to know how to access the fence values.

 

 

image.png

Open( "$Sample_Data/Analgesics.jmp" ) <<
Graph Builder(
	Size( 528, 448 ),
	Show Control Panel( 0 ),
	Variables( X( :drug ), Y( :pain ) ),
	Elements( Points( X, Y, Legend( 5 ) ), Box Plot( X, Y, Legend( 6 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			Add Pin Annotation(
				Seg( Box Plot Seg( 2 ) ),
				Index( {1, 1} ),
				Index Row( {1, 1} ),
				UniqueID( 568563361 ),
				FoundPt( {321, 356} ),
				Origin( {1.14256198347107, 3.97321428571429} )
			)
		)
	)
);

Thank you!

2 ACCEPTED SOLUTIONS

Accepted Solutions
nascif_jmp
Level VI

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

Hi @SDF1,

Get Local Context was introduced in 15.1. Copy works, you can get the full text and parse it, though I realize it is not ideal (which is why I added Get Local Context later).

I saw the issue with the annotation not displaying as well. Fortunately it works as expected in 15.1.

See, I just gave you two reasons to upgrade your JMP installation!

 

 

View solution in original post

ian_jmp
Staff

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

@gzmorgan0 said 'I am interested in accessing the BoxPlotSeg fences'. I didn't know about 'GetLocalContext', but it seems to rely on annotations actually being present. But perhaps 'GetMoments' and 'GetQuantiles', both of which return a matrix, might help.

View solution in original post

6 REPLIES 6
nascif_jmp
Level VI

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

Hi there, @gzmorgan0,

 

Yes, it is possible. Some of these annotation messages were added very recently to help with our testing frameworks, I apologize if they have not been properly documented. I will make sure to look into that.

Please see the script below. It shows how to get the annotation (which in this case is a pinned hover label) content as both a single text paragraph (using Copy) and as data in the form of an associative array (using Get Local Context). As you can see, the hover label context data includes more than just the visible hover label entries and is heavily used by Graphlet Presets. I believe power users will be able to take advantage of them to create some really interesting, interactive JMP applications. For more information on what type of data is available, check:

https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/work-with-the-hover-label-execution-co...

 

 

Names Default to Here(1);
dt = Open( "$Sample_Data/Analgesics.jmp" );
gb = dt  << Graph Builder(
	Size( 528, 448 ),
	Show Control Panel( 0 ),
	Variables( X( :drug ), Y( :pain ) ),
	Elements( Points( X, Y, Legend( 5 ) ), Box Plot( X, Y, Legend( 6 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			Add Pin Annotation(
				Seg( Box Plot Seg( 2 ) ),
				Index( {1, 1} ),
				Index Row( {1, 1} ),
				UniqueID( 568563361 ),
				FoundPt( {321, 356} ),
				Origin( {1.14256198347107, 3.97321428571429} )
			)
		)
	)
);
frame = (gb << Report)[FrameBox(1)];
gpin = frame << Get Annotation();
pinText = gpin << Copy();
Show(pinText);
hlec = gpin << Get Local Context();
Show(hlec);

Log results:

pinText = "
Maximum, excluding outliers: 16.636
75%: 12.93
50%: 9.418
25%: 7.84
Minimum, excluding outliers: 3.838
drug: B
N: 7";
hlec = ["_25%" => 7.84, 
"_50%" => 9.418,
"_75%" => 12.93,
"_dataTable" => Data Table( "Analgesics" ),
"_displaySegName" => "BoxPlotSeg",
"_drillDepth" => 1,
"_drug" => "B",
"_filters" => {:pain, :drug},
"_firstRow" => -1,
"_groupings" => {:pain, :drug},
"_Maximum, excluding outliers" => 16.636,
"_measurements" => {},
"_Minimum, excluding outliers" => 3.838,
"_mode" => "Test",
"_N" => 7,
"_pain" => {7.84, 12.93},
"_summaryStatistic" => "",
"_underlyingRows" => 7,
"_where" => ":pain >= 7.84 & :pain < 12.93 & :drug == \!"B\!"",
"_whereExpr" => Expr( :pain >= 7.84 & :pain < 12.93 & :drug == "B" )];

 

SDF1
Super User

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

Hi @nascif_jmp,

 

  (Win 10 Enterprise, 64-bit, JMP Pro 15.0.0)

 

  I thought this was a really great question, and I tried doing some other things, but it didn't work out. I had tried running the script, doing a Save Script to Scripting Window, and then searching for the relevant information within the Scripting Window window. That was proving to be quite difficult, though.

 

  Anyway, thanks for your reply. I tried to run the script that you gave, and there are two strange things that happen:

  1. When I try to just run the script as is, the "Send To Report(Dispatch(...))" section of code doesn't actually append the Pin Annotation to the graph. I have to go back in manually and do it.
  2. After performing the above, when I try to run the line hlec = gpin << Get Local Context(); JMP gives this error in the log: Object 'gpin' does not recognize the message 'Get Local Context'; perhaps you mean one of these: <<Replace Text... <<Add Text... <<Text Color <<Revert Text <<Tag Line <<Launch graphlet <<Get Links. And returns null for hlec.

  Any ideas why either of those are not working correctly?

 

 My version of JMP also doesn't recognize the Get Local Context command when I search for it in the Scripting Index, perhaps that's why #2 won't work?

 

Thanks!,

DS

nascif_jmp
Level VI

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

Hi @SDF1,

Get Local Context was introduced in 15.1. Copy works, you can get the full text and parse it, though I realize it is not ideal (which is why I added Get Local Context later).

I saw the issue with the annotation not displaying as well. Fortunately it works as expected in 15.1.

See, I just gave you two reasons to upgrade your JMP installation!

 

 

SDF1
Super User

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

Hi @nascif_jmp,

 

  Yeah, I need to upgrade to 15.1 for other reasons as well: current version won't recognize all files in directories on shared network drives. Sometimes it sees 1 or 2 or 6 files out of the hundreds that are actually there. Apparently, it's a known issue with OneDrive as well. I've been told 15.1 fixes that.

 

  I've been waiting some time for our IT to roll it out, but with hundreds of users across the world using JMP, I imagine it might be taking them a bit of time.

 

Thanks!,

DS

ian_jmp
Staff

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

@gzmorgan0 said 'I am interested in accessing the BoxPlotSeg fences'. I didn't know about 'GetLocalContext', but it seems to rely on annotations actually being present. But perhaps 'GetMoments' and 'GetQuantiles', both of which return a matrix, might help.

gzmorgan0
Super User (Alumni)

Re: Is there a JSL Message to Access GraphBuilder BoxPlotSeg Labels

@ian_jmp is correct, my goal is to access the fences without the pinned message.

 

Yes, << Get Quantiles will help me compute the fence values, the max and min data values within the range of q50 +/- 1.5*(q75-q25). So it is not difficult to compute. I just wondered of there was a method to access them.

 

@SDF1 , I have not upgraded to 15.1 yet, and I saw the intermittent behavior of the dispatch working or being ignored. It would work as a script then it wouldn't. I would open a new session and it would work.  I'll have to upgrade to 15.1 to check if the same behavior persists. My guess is the ID number which seems strange is the issue. 

 

@nascif_jmp, thank you for the <<Get Local Context response. While it does not exactly match my request, it was informative and appears to be a useful function. I will mark your and Ian's response as a solution.

 

 

In case somone is following this post, I attached a script with one method to get the boxplot fences with JSL (multiple methods to get quantiles, etc.)

Names Default to Here(1);

dt = Open("$Sample_Data/Analgesics.jmp");

boxNodes = dt << Summary(
	Group( :drug ),
	Quantiles( 25, :pain ),
	Median( :pain ),
	Quantiles( 75, :pain ),
	Freq( "None" ),
	Weight( "None" ),
	statistics column name format( "stat" )
);

bmin = boxNodes << New Column("Lower Fence", numeric, continuous);
bmax = boxNodes << New Column("Upper Fence", numeric, continuous);
bq25 = column(boxNodes, "Quantiles25");
bq75 = column(boxNodes, "Quantiles75");
bq50 = column(boxNodes, "Median");
bidx = Column(boxNodes, "drug");

For(i=1, i<=nrow(boxNodes), i++,   
   ll = bq50[i] - 1.5*(bq75[i] - bq25[i]);  	
   ul = bq50[i] + 1.5*(bq75[i] - bq25[i]);  	
   idx = dt << get rows where( :drug == bidx[i] &   ll <= :pain <= ul );
   bmin[i] = min(dt:pain[idx]); 
   bmax[i] = max(dt:pain[idx]); 
);

It produces the table shown below. Note  data table Analgesics, column "pain" has a display format of 2 decimals; the fence values are the tables stored values.

image.png