<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to embed pre-made scripted graph into Application Builder module? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-embed-pre-made-scripted-graph-into-Application-Builder/m-p/474296#M71904</link>
    <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am scripting in Application Builder. In one of my modules, I have a Graph Box, with the intention of setting it to display a pre-made graph, but I am not having much luck. I was originally thinking that the easiest thing to do would just be to somehow embed my pre-made graph into the module window, so I have been trying to use the Graph Box as a placeholder, trying something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;graphBox &amp;lt;&amp;lt; Visibility("Collapse");
panelBox &amp;lt;&amp;lt; Append( /*graph*/ ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;...but this has not been working. Potentially the easiest way is actually to script the different graph items into the Graph Box individually? I am pretty new to JSL so I know that my approach/syntax must be wrong in some way, but I am not sure what would be the best/easiest way to do this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code to create the graph I want (thanks to helpful users on &lt;A href="https://community.jmp.com/t5/Discussions/How-to-script-all-X-and-Y-data-to-a-single-time-series-graph-in/m-p/472019#M71657" target="_blank" rel="noopener"&gt;another question that I posted&lt;/A&gt;) is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
datafile = Open( "Data.xlsx" );

x_col = Column(datafile, 1);
y_cols = (datafile &amp;lt;&amp;lt; Get Column Names())[2::N Cols(datafile)];

var_expr = EvalExpr(
	Variables(X(Expr(x_col))
));

var_line = Expr(Line(X));

For Each({col, idx}, y_cols,
	y_expr = Expr(Y(Position(1)));
	Insert Into(y_expr, NameExpr(col), 1);
	Insert Into(var_expr, Name Expr(y_expr));
	
	yline_expr = Parse("Y("||char(idx)||")");
	Insert Into(var_line, Name Expr(yline_expr));
);

graphbuild = Eval(Substitute(
	Expr(
		graphbuild = datafile &amp;lt;&amp;lt; Graph Builder(
			Size(838, 391),
			Show Control Panel(0),
			vvv,
			Elements(yyy)
		)
	),
	Expr(vvv), Name Expr(var_expr),
	Expr(yyy), Name Expr(var_line)
));


/*gb_image = graphbuild &amp;lt;&amp;lt; get picture;
graphbuild &amp;lt;&amp;lt; Close Window;
New window("time-series plot",
	gb_image
);*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I commented out the last part of this code, because I actually prefer the resulting graph with the control panel simply suppressed ("Show Control Panel(0)"), as opposed to "&amp;lt;&amp;lt; Get Picture", because this hides the Graph Builder functionalities for the user, but still allows for a dynamic graph (grabbable and moveable axes, etc.). If it is possible to embed the graph in this way, then that is my ideal route.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Estelle&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jun 2023 11:23:17 GMT</pubDate>
    <dc:creator>EstelleS</dc:creator>
    <dc:date>2023-06-11T11:23:17Z</dc:date>
    <item>
      <title>How to embed pre-made scripted graph into Application Builder module?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-embed-pre-made-scripted-graph-into-Application-Builder/m-p/474296#M71904</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am scripting in Application Builder. In one of my modules, I have a Graph Box, with the intention of setting it to display a pre-made graph, but I am not having much luck. I was originally thinking that the easiest thing to do would just be to somehow embed my pre-made graph into the module window, so I have been trying to use the Graph Box as a placeholder, trying something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;graphBox &amp;lt;&amp;lt; Visibility("Collapse");
panelBox &amp;lt;&amp;lt; Append( /*graph*/ ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;...but this has not been working. Potentially the easiest way is actually to script the different graph items into the Graph Box individually? I am pretty new to JSL so I know that my approach/syntax must be wrong in some way, but I am not sure what would be the best/easiest way to do this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code to create the graph I want (thanks to helpful users on &lt;A href="https://community.jmp.com/t5/Discussions/How-to-script-all-X-and-Y-data-to-a-single-time-series-graph-in/m-p/472019#M71657" target="_blank" rel="noopener"&gt;another question that I posted&lt;/A&gt;) is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
datafile = Open( "Data.xlsx" );

x_col = Column(datafile, 1);
y_cols = (datafile &amp;lt;&amp;lt; Get Column Names())[2::N Cols(datafile)];

var_expr = EvalExpr(
	Variables(X(Expr(x_col))
));

var_line = Expr(Line(X));

For Each({col, idx}, y_cols,
	y_expr = Expr(Y(Position(1)));
	Insert Into(y_expr, NameExpr(col), 1);
	Insert Into(var_expr, Name Expr(y_expr));
	
	yline_expr = Parse("Y("||char(idx)||")");
	Insert Into(var_line, Name Expr(yline_expr));
);

graphbuild = Eval(Substitute(
	Expr(
		graphbuild = datafile &amp;lt;&amp;lt; Graph Builder(
			Size(838, 391),
			Show Control Panel(0),
			vvv,
			Elements(yyy)
		)
	),
	Expr(vvv), Name Expr(var_expr),
	Expr(yyy), Name Expr(var_line)
));


/*gb_image = graphbuild &amp;lt;&amp;lt; get picture;
graphbuild &amp;lt;&amp;lt; Close Window;
New window("time-series plot",
	gb_image
);*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I commented out the last part of this code, because I actually prefer the resulting graph with the control panel simply suppressed ("Show Control Panel(0)"), as opposed to "&amp;lt;&amp;lt; Get Picture", because this hides the Graph Builder functionalities for the user, but still allows for a dynamic graph (grabbable and moveable axes, etc.). If it is possible to embed the graph in this way, then that is my ideal route.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Estelle&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:23:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-embed-pre-made-scripted-graph-into-Application-Builder/m-p/474296#M71904</guid>
      <dc:creator>EstelleS</dc:creator>
      <dc:date>2023-06-11T11:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to embed pre-made scripted graph into Application Builder module?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-embed-pre-made-scripted-graph-into-Application-Builder/m-p/475103#M71979</link>
      <description>&lt;P&gt;Hi Estelle - I'll give one solution that may be helpful for scripting reports whether you are within Application Builder or writing directly in JSL.&amp;nbsp; When you launch platforms without a containing window, the window is created for you.&amp;nbsp; A "live" platform can only have one report, so if you try to append a report to an existing window, a copy of the report is created.&amp;nbsp; This is slightly more interactive than creating a picture, but it is also not what you are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example script below, I show three ways to append content to an existing window, and the results have different levels of interactivity:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;In the first case, a live Graph Builder platform is embedded directly into an existing window.&amp;nbsp; The platform does not create another window, and no copying is done.&lt;/LI&gt;
&lt;LI&gt;In the second window, a copy of the report is added, which has less interactivity.&amp;nbsp; This is a copy of the report by itself, without a platform object.&amp;nbsp; It has no connection to the data table.&lt;/LI&gt;
&lt;LI&gt;In the third window I append an image of the Graph Builder, which has the least interactivity.&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Create an empty window first
New Window("Interactive Report",
	panel = Panel Box("Interactive Report")
);
Wait(2);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Append a Graph Builder to the existing window
// This report will be entirely interactive
// Axes can be changed, and points can be selected
panel &amp;lt;&amp;lt; Append(gb = dt &amp;lt;&amp;lt; Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
));

// We could try to create windows from existing platforms
// This will lose some interactivity
// Axes can change, but the selection is fixed
New Window("Report Copy",
	panel2 = Panel Box("Report Copy",
	)
);
Wait(2);
panel2 &amp;lt;&amp;lt; Append(Report(gb)); // creates a copy of the report


// Or we could take a picture of the report
// This is the least interactive result - nothing can change
New Window("Report Picture",
	panel3 = Panel Box("Report Picture",
	)
);
Wait(2);
panel3 &amp;lt;&amp;lt; Append(gb &amp;lt;&amp;lt; Get Picture);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Within a JMP Application, you should be able to use any of these approaches.&amp;nbsp; The first approach would let you append to any box that you have created in the app, just make sure that you run the Graph Builder script within the &amp;lt;&amp;lt;Append(..) message, so that it will embed into the window that you already have.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 01:43:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-embed-pre-made-scripted-graph-into-Application-Builder/m-p/475103#M71979</guid>
      <dc:creator>danschikore</dc:creator>
      <dc:date>2022-04-01T01:43:42Z</dc:date>
    </item>
  </channel>
</rss>

