<?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 Re: How to pass Y variable in Graph Builder from a List in JSL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683066#M86859</link>
    <description>&lt;P&gt;You could generate symbols var and gb for the expressions&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Var= Expr(variables(x(:height)))
gb =Expr(Graph Builder())&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;And then use &lt;FONT face="courier new,courier"&gt;InsertInto&lt;/FONT&gt; in a &lt;FONT face="courier new,courier"&gt;For&lt;/FONT&gt;&amp;nbsp;loop to fill var with the Ys , then insert &lt;FONT face="courier new,courier"&gt;NameExpr(var)&lt;/FONT&gt; into &lt;FONT face="courier new,courier"&gt;gb&lt;/FONT&gt; and then use another &lt;FONT face="courier new,courier"&gt;For&lt;/FONT&gt; loop to add the Elements expressions.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2023 06:53:06 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2023-10-04T06:53:06Z</dc:date>
    <item>
      <title>How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683040#M86857</link>
      <description>&lt;P&gt;The example script below does what I need for a fixed small number of parameters which I want to plot on the Y-axis.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to automate this for a list which is supplied to Y from above?&lt;/P&gt;&lt;P&gt;(The X variable/column remains fixed but the number of elements going to Y can change and is supplied from a another script)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here (1);
Clear Log ();
dt = open("$sample_data\Big Class.jmp");
y_values = {"name", "age", "sex", "weight"};
Graph Builder(
    Show Control Panel( 0 ),
    Variables( X( :height), 
    Y( column(dt, y_values[1]) ), 
    Y( column(dt, y_values[2]) ),
    Y( column(dt, y_values[3]) ),
    Y( column(dt, y_values[4]) ) 
    ),
    Elements( Position( 1, 1 ), Points( X, Y, Legend( 1 ) ) ),
	Elements( Position( 1, 2 ), Points( X, Y, Legend( 2 ) ) ),
	Elements( Position( 1, 3 ), Points( X, Y, Legend( 3 ) ) ),
	Elements( Position( 1, 4 ), Points( X, Y, Legend( 4 ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also, how does one handle the Elements () in this case.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 14:47:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683040#M86857</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-10-02T14:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683066#M86859</link>
      <description>&lt;P&gt;You could generate symbols var and gb for the expressions&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Var= Expr(variables(x(:height)))
gb =Expr(Graph Builder())&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;And then use &lt;FONT face="courier new,courier"&gt;InsertInto&lt;/FONT&gt; in a &lt;FONT face="courier new,courier"&gt;For&lt;/FONT&gt;&amp;nbsp;loop to fill var with the Ys , then insert &lt;FONT face="courier new,courier"&gt;NameExpr(var)&lt;/FONT&gt; into &lt;FONT face="courier new,courier"&gt;gb&lt;/FONT&gt; and then use another &lt;FONT face="courier new,courier"&gt;For&lt;/FONT&gt; loop to add the Elements expressions.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 06:53:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683066#M86859</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-04T06:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683067#M86860</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;Thanks, I am afraid I need some more hand holding as I have never used Expr () and Insert NameExpr () functions previously. It would be useful if you could provide an example with the example script I added in my OP.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 15:25:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683067#M86860</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-10-02T15:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683071#M86861</link>
      <description>&lt;P&gt;This isn't only option of building this but can give some ideas. Also search scripting index for Variable and Element for GraphBuilderbox&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$sample_data\Big Class.jmp");

y_values = {"name", "age", "sex", "weight"};

variables_expr = Expr(Variables(X(:height)));

For Each({y_col}, y_values,
	temp_expr = Expr(Y());
	Insert Into(temp_expr, Name Expr(AsColumn(dt, y_col)));
	Insert Into(variables_expr, Name Expr(temp_expr));
);


gb_expr = Expr(Graph Builder(
	Show Control Panel(0)
));

Insert Into(gb_expr, Name Expr(variables_expr));

For Each({y_col, idx}, y_values,
	Eval(EvalExpr(
		Insert Into(gb_expr,
			Name Expr(Elements(Position(1, Expr(idx)), Points(X, Y, Legend(Expr(idx)))))
		)
	));
);

Show(Name Expr(gb_expr));
Eval(gb_expr);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;One example using Add Variable()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$sample_data\Big Class.jmp");

y_values = {"name", "age", "sex", "weight"};

variables_expr = Expr(Variables(X(:height)));

gb = dt &amp;lt;&amp;lt; Graph Builder(
	// Ignore Platform Preferences(1),
	Show control Panel(0),
	Variables(X(:height))
);

gb &amp;lt;&amp;lt; inval;

For Each({y_col, idx}, y_values,
	Eval(EvalExpr(
		gb &amp;lt;&amp;lt; Add Variable({Expr(Name Expr(As Column(dt, y_col))), Role("Y")})
	));

// if you just want points, you shouldn't need this, but smoother idx is 2 instead of 1
/*	gb &amp;lt;&amp;lt; Remove Element(1, idx, 1); 
	Eval(EvalExpr(
		gb &amp;lt;&amp;lt; Add Element(1, Expr(idx), {Type("Points"), X, Y, Legend(Expr(idx))})
	));
*/
);

gb &amp;lt;&amp;lt; Update window;
gb &amp;lt;&amp;lt; Remove Element(1, N Items(y_values), 2);  // 1 or 2 for smoother idx, depending on how GB is built&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Oct 2023 15:47:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683071#M86861</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-02T15:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683356#M86881</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;Thanks. This works for me, but I cannot change the default Chart title. How to do this via JSL?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 12:03:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683356#M86881</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-10-03T12:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683411#M86885</link>
      <description>&lt;P&gt;Depends on what you define as title.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
	Variables(X(:height), Y(:weight)),
	Elements(Points(X, Y), Smoother(X, Y))
);

gb &amp;lt;&amp;lt; Title("Test");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And if you consider it to be the text edit box above graph builder, change it manually and then modify the script created by JMP.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	SendToReport(Dispatch({}, "graph title", TextEditBox, {Set Text("asdsad")}))
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and you can get even more information if you have JMP17 and use properties&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1696344778375.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57181iAE3C00F2EE6D5326/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1696344778375.png" alt="jthi_0-1696344778375.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Report(gb)[TextEditBox(1)] &amp;lt;&amp;lt; Set Text("12313213");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;might work depending on your report&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 14:54:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683411#M86885</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-03T14:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683421#M86888</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;Thanks. For the straightforward case you show, I know how to put the chart title (as you show), but how to do this for the case below?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$sample_data\Big Class.jmp");

y_values = {"name", "age", "sex", "weight"};

variables_expr = Expr(Variables(X(:height)));

For Each({y_col}, y_values,
	temp_expr = Expr(Y());
	Insert Into(temp_expr, Name Expr(AsColumn(dt, y_col)));
	Insert Into(variables_expr, Name Expr(temp_expr));
);


gb_expr = Expr(Graph Builder(
	Show Control Panel(0)
));

Insert Into(gb_expr, Name Expr(variables_expr));

For Each({y_col, idx}, y_values,
	Eval(EvalExpr(
		Insert Into(gb_expr,
			Name Expr(Elements(Position(1, Expr(idx)), Points(X, Y, Legend(Expr(idx)))))
		)
	));
);

Show(Name Expr(gb_expr));
Eval(gb_expr);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Oct 2023 15:12:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683421#M86888</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-10-03T15:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683480#M86896</link>
      <description>&lt;P&gt;Get reference to the graph builder and both of those ideas should work&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 16:26:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683480#M86896</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-03T16:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683483#M86897</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;Thanks but do not see Get Reference () in Scripting Index (I am on JMP 16.2.0). Do you mean get the window name of the graph builder window?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 16:50:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683483#M86897</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-10-03T16:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683487#M86901</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Current Report()[TextEditBox( 1 )] &amp;lt;&amp;lt; set text( "NewTitle" );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This works for me.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 16:54:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683487#M86901</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-10-03T16:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass Y variable in Graph Builder from a List in JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683488#M86902</link>
      <description>&lt;P&gt;I would suggest getting the reference when you evaluate the expression which creates the graph. I think&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;gb = Eval(gb_expr);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should work. Also it might be a good idea to make sure that Graph Builder is created using dt if there is possibility that multiple tables are open. Though I'm not sure what would be the easiest syntax to do it in this case without testing&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 17:15:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-Y-variable-in-Graph-Builder-from-a-List-in-JSL/m-p/683488#M86902</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-03T17:15:24Z</dc:date>
    </item>
  </channel>
</rss>

