cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
tbidwell
Level III

Using get picture seems to act differently with Graph Builder than with a Dashboard

big class summary.jpgI am creating images from Graph Builder and a Dashboard using the "get picture" function in JSL and inserting the images into an expression column in a table.  Everything works as expected when doing this from Graph Builder.  But when I use the "get picture" function from a Dashboard, my expression column doesn't include an image but instead a script that looks like: "{New Image(Char to Blob(....)}".

 

If I use JSL to strip off the opening bracket (i.e. "{" ) and the closing bracket (i.e., "}" ), then use JSL that looks like: eval(parse( "New Image..." )), then everything works and I get my dashboard as an image in the expression column.  Any ideas what is happening or what I should do differently?  BTW, I am using JMP 17.1.

 

I generated an example using the Big Class sample dataset.  The summary table with the expression column has a graphing script that allows you to hover over the points to see the graphs.

Names Default To Here( 1 );

dt = Open( "$sample_data/big class.jmp" );

//create a graph to save as a picture
gb = dt << Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Grid Color( "White" ),
	Level Spacing Color( "White" ),
	Graph Spacing( 5 ),
	Spacing Borders( 1 ),
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
);
rgb = gb << report;
gbpic = rgb << get picture;
rgb << close window;

//create a dashboard
dash = JMP App(
	Set Name( "Dashboard" ),
	Set Description( "Description" ),
	Auto Launch( 1 ),
	Snap To Grid( 1 ),
	Show Grid( 1 ),
	Show Properties( 0 ),
	Show Sources( 1 ),
	Group By Category( 0 ),
	Dashboard Mode( 1 ),
	Parameters,
	Tables( DataTable1 = dt ),
	Script( JSL Quote() ),
	Allocate(
		Module1 = Plan(
			PreAllocate,
			Script(JSL Quote(
					OnModuleLoad({},);
					thisModuleInstance << Create Objects;
					Try(TabPage3 << Set Scriptable Object(thisApplication));
				)			),
			Allocate(
				TabPage3 = Tab Page Box();
				Splitter1 = H Splitter Box();
				TabPage1 = Tab Page Box();
				Scroll1 = Scroll Box();
				Report1 = Platform(
					DataTable1,
					Distribution(
						Stack( 1 ),
						Continuous Distribution( Column( :height ), Horizontal Layout( 1 ), Vertical( 0 ), Customize Summary Statistics( Sum( 1 ) ) ),
						Continuous Distribution( Column( :weight ), Horizontal Layout( 1 ), Vertical( 0 ), Customize Summary Statistics( Sum( 1 ) ) )
					)
				);
				TabPage2 = Tab Page Box();
				Scroll2 = Scroll Box();
				Report2 = Platform(
					DataTable1,
					Graph Builder(
						Size( 607, 535 ),
						Show Control Panel( 0 ),
						Fit to Window,
						Grid Color( "White" ),
						Level Spacing Color( "White" ),
						Graph Spacing( 5 ),
						Spacing Borders( 1 ),
						Variables( X( :height ), Y( :weight ) ),
						Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) )
					)
				);
			),
			Organize(
				Reparent( Scroll2( Report2 ) );
				Reparent( TabPage2( Scroll2 ) );
				Reparent( Splitter1( TabPage2 ) );
				Reparent( Scroll1( Report1 ) );
				Reparent( TabPage1( Scroll1 ) );
				Reparent( Splitter1( TabPage1 ) );
				Reparent( TabPage3( Splitter1 ) );
				Relocate( TabPage3( 0, 0 ) );
			),
			Initialize(
				TabPage3 << Background Color( "None" ), TabPage3 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				TabPage3 << Enabled( 1 ), TabPage3 << Horizontal Alignment( "Default" ),
				TabPage3 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				TabPage3 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), TabPage3 << Text Color( "None" ), TabPage3 << UI Only( 0 ),
				TabPage3 << Vertical Alignment( "Default" ), TabPage3 << Visibility( "Visible" ), TabPage3 << Set Min Size( 262, 128 ),
				TabPage3 << Set Max Size( 30000, 30000 ), TabPage3 << Set Stretch( {"Neutral", "Neutral"} ), TabPage3 << Title( "Dashboard" ),
				TabPage3 << Tip( "" ), TabPage3 << Icon( "" ), TabPage3 << Closeable( 0 ), TabPage3 << Moveable( 0 ),
				TabPage3 << Set Base Font( "Text" ), TabPage3 << Set Font Scale( 1 ), Splitter1 << Background Color( "None" ),
				Splitter1 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Splitter1 << Enabled( 1 ),
				Splitter1 << Horizontal Alignment( "Default" ), Splitter1 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				Splitter1 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Splitter1 << Text Color( "None" ), Splitter1 << UI Only( 0 ),
				Splitter1 << Vertical Alignment( "Default" ), Splitter1 << Visibility( "Visible" ), Splitter1 << Dockable( 1 ),
				Splitter1 << Set Width( 1487 ), Splitter1 << Set Height( 607 ), Splitter1 << Set Sizes( {0.532345013477089, 0.467654986522911} ),
				Splitter1 << Set Min Size( 262, 102 ), Splitter1 << Set Max Size( 60003, 30000 ), Splitter1 << Set Stretch( {"Window", "Window"} ),
				Splitter1 << set horizontal( 1 ), TabPage1 << Background Color( "None" ),
				TabPage1 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), TabPage1 << Enabled( 1 ),
				TabPage1 << Horizontal Alignment( "Default" ), TabPage1 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				TabPage1 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), TabPage1 << Text Color( "None" ), TabPage1 << UI Only( 0 ),
				TabPage1 << Vertical Alignment( "Default" ), TabPage1 << Visibility( "Visible" ), TabPage1 << Set Min Size( 72, 62 ),
				TabPage1 << Set Max Size( 30000, 30000 ), TabPage1 << Set Stretch( {"Neutral", "Neutral"} ), TabPage1 << Title( "Distributions" ),
				TabPage1 << Tip( "" ), TabPage1 << Icon( "Distrib" ), TabPage1 << Closeable( 1 ), TabPage1 << Moveable( 1 ),
				TabPage1 << Set Base Font( "Text" ), TabPage1 << Set Font Scale( 1 ), Scroll1 << Background Color( "None" ),
				Scroll1 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Scroll1 << Enabled( 1 ),
				Scroll1 << Horizontal Alignment( "Default" ), Scroll1 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				Scroll1 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Scroll1 << Text Color( "None" ), Scroll1 << UI Only( 0 ),
				Scroll1 << User Resizable( {1, 1} ), Scroll1 << Vertical Alignment( "Default" ), Scroll1 << Visibility( "Visible" ),
				Scroll1 << Set Min Size( 72, 36 ), Scroll1 << Set Max Size( 30000, 30000 ), Scroll1 << Set Stretch( {"Window", "Window"} ),
				Scroll1 << Width( 790 ), Scroll1 << Height( 581 ), Scroll1 << Set Auto Scrollable( 1 ), Scroll1 << Set Scrollers( 1, 1 ),
				Scroll1 << Set Show Empty( 0 ), Scroll1 << Set Clip Printing( 0 ), Report1 << Background Color( "None" ),
				Report1 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Report1 << Enabled( 1 ),
				Report1 << Horizontal Alignment( "Default" ), Report1 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				Report1 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Report1 << Text Color( "None" ), Report1 << UI Only( 0 ),
				Report1 << Vertical Alignment( "Default" ), Report1 << Visibility( "Visible" ), Report1 << Set Min Size( 707, 498 ),
				Report1 << Set Max Size( 707, 498 ), Report1 << Set Stretch( {"Neutral", "Neutral"} ), Report1 << set horizontal( 0 ),
				TabPage2 << Background Color( "None" ), TabPage2 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				TabPage2 << Enabled( 1 ), TabPage2 << Horizontal Alignment( "Default" ),
				TabPage2 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				TabPage2 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), TabPage2 << Text Color( "None" ), TabPage2 << UI Only( 0 ),
				TabPage2 << Vertical Alignment( "Default" ), TabPage2 << Visibility( "Visible" ), TabPage2 << Set Min Size( 187, 102 ),
				TabPage2 << Set Max Size( 30000, 30000 ), TabPage2 << Set Stretch( {"Neutral", "Neutral"} ), TabPage2 << Title( "Graph Builder" ),
				TabPage2 << Tip( "" ), TabPage2 << Icon( "Trellis" ), TabPage2 << Closeable( 1 ), TabPage2 << Moveable( 1 ),
				TabPage2 << Set Base Font( "Text" ), TabPage2 << Set Font Scale( 1 ), Scroll2 << Background Color( "None" ),
				Scroll2 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Scroll2 << Enabled( 1 ),
				Scroll2 << Horizontal Alignment( "Default" ), Scroll2 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				Scroll2 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Scroll2 << Text Color( "None" ), Scroll2 << UI Only( 0 ),
				Scroll2 << User Resizable( {1, 1} ), Scroll2 << Vertical Alignment( "Default" ), Scroll2 << Visibility( "Visible" ),
				Scroll2 << Set Min Size( 187, 76 ), Scroll2 << Set Max Size( 30087, 30001 ), Scroll2 << Set Stretch( {"Window", "Window"} ),
				Scroll2 << Width( 694 ), Scroll2 << Height( 581 ), Scroll2 << Set Auto Scrollable( 1 ), Scroll2 << Set Scrollers( 0, 0 ),
				Scroll2 << Set Show Empty( 0 ), Scroll2 << Set Clip Printing( 0 ), Report2 << Background Color( "None" ),
				Report2 << Border( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Report2 << Enabled( 1 ),
				Report2 << Horizontal Alignment( "Default" ), Report2 << Margin( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ),
				Report2 << Padding( {Left( 0 ), Top( 0 ), Right( 0 ), Bottom( 0 )} ), Report2 << Text Color( "None" ), Report2 << UI Only( 0 ),
				Report2 << Vertical Alignment( "Default" ), Report2 << Visibility( "Visible" ), Report2 << Set Min Size( 187, 76 ),
				Report2 << Set Max Size( 30087, 30001 ), Report2 << Set Stretch( {"Neutral", "Neutral"} ), Report2 << set horizontal( 0 )
			)
		)
	),
	Initialize(
		Module1 << Auto Launch( 1 );
		Module1 << Set Module Type( "Report" );
		Module1 << Set Window Title( "^TABLENAME - ^APPNAME" );
	)
) << Run;
rdash = dash << get windows;
dashpic = rdash << get picture;
rdash << close window;
Close( dt, nosave );

//create a table for the pictures
dt2 = New Table( "big class summary" );
dt2 << New Column( "ID", numeric, "nominal", formula( Row() ) );
dt2 << New Column( "pic", expression );
dt2 << add rows( 3 );
dt2 << set label columns( :pic );
dt2 << new table script(
	"graph",
	Graph Builder(
		Size( 495, 450 ),
		Show Control Panel( 0 ),
		Grid Color( "White" ),
		Level Spacing Color( "White" ),
		Graph Spacing( 5 ),
		Spacing Borders( 1 ),
		Variables( X( :ID ) ),
		Elements( Points( X, Legend( 4 ) ) )
	)
);
//add pictures
dt2:pic[1] = gbpic;
dt2:pic[2] = dashpic;

//remove {}'s from the dashboard script
	//remove initial open bracket, {
	dashpic1 = Munger( Char( dashpic ), 1, "{", "" );
	//remove last closing bracket, }
	dashpic2 = Munger( Char( dashpic1 ), 1, "}", "" );

//add picture to row 3
dt2:pic[3] = Eval( Parse( dashpic2 ) );
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Using get picture seems to act differently with Graph Builder than with a Dashboard

When you run this JSL on the dashboard:

rdash = dash << get windows;

The return value is always a list of windows, even if there is only one (which there usually is for the Dashboard case, but JMP Applications can have more).  When you send the <<GetPicture message to a list, you will get back a list of responses, but if you send it only to the first item in the list, you will get back a picture:

dashpic = rdash[1] << get picture;

View solution in original post

2 REPLIES 2

Re: Using get picture seems to act differently with Graph Builder than with a Dashboard

When you run this JSL on the dashboard:

rdash = dash << get windows;

The return value is always a list of windows, even if there is only one (which there usually is for the Dashboard case, but JMP Applications can have more).  When you send the <<GetPicture message to a list, you will get back a list of responses, but if you send it only to the first item in the list, you will get back a picture:

dashpic = rdash[1] << get picture;
tbidwell
Level III

Re: Using get picture seems to act differently with Graph Builder than with a Dashboard

Thank you @danschikore.   

 

That makes perfect sense.

Recommended Articles