<?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: Add Graphics Script H line with variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238723#M47171</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16830"&gt;@avner8943&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached is a script that uses a RowState Handler to change limits.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt = Open("$Sample_Data/Big Class.jmp");
dt &amp;lt;&amp;lt; sort(By(:sex, :age), Replace Table(1));
dt &amp;lt;&amp;lt; New Column( "Order", Numeric);
dt:Order &amp;lt;&amp;lt; Set Each Value( If( row()==1 | :sex != lag(:sex,1), 1, lag(:Order,1) +1)) ; 
dtsum = dt &amp;lt;&amp;lt; Summary( Group(:sex), Min(:height), mean(:height), Max(:height));

dtlims = dtsum &amp;lt;&amp;lt; Stack(
	columns(
		:Name( "Min(height)" ),
		:Name( "Mean(height)" ),
		:Name( "Max(height)" )
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Limits" )
);

Close(NoSave, dtsum);
f= Function({a}, {TR1, i},
	print(a, fb);
//	show(a, fb);
    for(i=1, i&amp;lt;=nitems(fb), i++,
    	Try( fb[i] &amp;lt;&amp;lt; Remove Graphics Script (1) )
    );
    TR1 = :Limits[dtlims &amp;lt;&amp;lt; get selected rows];
    Eval (EvalExpr( fb &amp;lt;&amp;lt; Add Graphics Script( H Line( Expr( TR1) ) ) ) );	
);


gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 528, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :Order ), Y( :height ), Group X(:sex) ),
	Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) )
);

fb = gb &amp;lt;&amp;lt; Xpath("//FrameBox");

rs = dtlims &amp;lt;&amp;lt;  Make RowState Handler(f );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Select one or multiple rows or clear all row selections and see the changes on all frameboxes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20681i8FE4BA4EAFDDA087/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This script was tested on JMP 14 &amp;amp; 15. Attached is slight modification of the script at line 26 so that the script works on JMP 13.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So there must be something else wrong with your script, because this works woth a RowState Handler script.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2019 05:34:54 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2019-12-17T05:34:54Z</dc:date>
    <item>
      <title>Add Graphics Script H line with variable</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238599#M47146</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I'm trying to add a horizontal line to graph builder object with variable, in this way its works&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-jsl"&gt;	x =  139.4;
	Show( x );   //x = 139.4;
	gbReport[Framebox( 1 )] &amp;lt;&amp;lt; addGraphicsScript(

		H Line( x )
	);
	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if I'm doing something like that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-jsl"&gt;TR1_row = dt_lims &amp;lt;&amp;lt; get selected rows;

TR1 = Column( dt_lims, "CL" )[TR1_row] ;

gbReport[Framebox( 1 )] &amp;lt;&amp;lt; addGraphicsScript(
	
		H Line(TR1 )
	);&amp;nbsp;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It's not working, any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 11:59:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238599#M47146</guid>
      <dc:creator>avner8943</dc:creator>
      <dc:date>2019-12-16T11:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Add Graphics Script H line with variable</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238610#M47147</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16830"&gt;@avner8943&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The syntax for H Line() is H Line(y),&amp;nbsp; H Line( x1, x2, y). Also, if you have a vector of values, try this script.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
v = [10, 50, 20];
New Window( "Example",
	Graph Box(
		Pen Size( 2 );
		H Line( v );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Produces this plot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 384px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20655iD29B87EA71D19E12/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Check if this script works for you.&amp;nbsp; If it doesn't, please specify which version of JMP and OS you are using.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 09:54:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238610#M47147</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-12-16T09:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add Graphics Script H line with variable</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238611#M47148</link>
      <description>This is working but how can I adjust this to my script that takes value from a specific cell in JMP table.</description>
      <pubDate>Mon, 16 Dec 2019 10:18:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238611#M47148</guid>
      <dc:creator>avner8943</dc:creator>
      <dc:date>2019-12-16T10:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add Graphics Script H line with variable</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238623#M47150</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16830"&gt;@avner8943&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a script that uses JMP sample data table Big Class and selectively uses only Males and adds 3 limits at once.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt = Open("$Sample_Data/Big Class.jmp");
dt &amp;lt;&amp;lt; sort(By(:sex, :age), Replace Table(1));
dt &amp;lt;&amp;lt; New Column( "Order", Numeric);
dt:Order &amp;lt;&amp;lt; Set Each Value( If( row()==1 | :sex != lag(:sex,1), 1, lag(:Order,1) +1)) ; 
dtsum = dt &amp;lt;&amp;lt; Summary( Group(:sex), Min(:height), mean(:height), Max(:height));

dtlims = dtsum &amp;lt;&amp;lt; Stack(
	columns(
		:Name( "Min(height)" ),
		:Name( "Mean(height)" ),
		:Name( "Max(height)" )
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Limits" )
);

Close(NoSave, dtsum);

TR1_row = dtlims &amp;lt;&amp;lt; get rows where( :sex =="M");

TR1 = column(dtlims, "Limits")[TR1_row];

gb = dt &amp;lt;&amp;lt; Graph Builder( where (:sex=="M"),
	Size( 528, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :Order ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) )
);

gbreport = report(gb);

gbreport[FrameBox(1)] &amp;lt;&amp;lt; Add Graphics Script( HLine( TR1 ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It produces this plot.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 625px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20656iC80F13268E69364A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what seems to be the issue, unless there are no selected rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good Luck!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 11:33:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238623#M47150</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-12-16T11:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add Graphics Script H line with variable</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238626#M47153</link>
      <description>&lt;P&gt;Maybe because I do it inside a function and call this function from&amp;nbsp;MakeRowStateHandler, when I try it outside the function it is working.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 12:10:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238626#M47153</guid>
      <dc:creator>avner8943</dc:creator>
      <dc:date>2019-12-16T12:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add Graphics Script H line with variable</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238723#M47171</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16830"&gt;@avner8943&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached is a script that uses a RowState Handler to change limits.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt = Open("$Sample_Data/Big Class.jmp");
dt &amp;lt;&amp;lt; sort(By(:sex, :age), Replace Table(1));
dt &amp;lt;&amp;lt; New Column( "Order", Numeric);
dt:Order &amp;lt;&amp;lt; Set Each Value( If( row()==1 | :sex != lag(:sex,1), 1, lag(:Order,1) +1)) ; 
dtsum = dt &amp;lt;&amp;lt; Summary( Group(:sex), Min(:height), mean(:height), Max(:height));

dtlims = dtsum &amp;lt;&amp;lt; Stack(
	columns(
		:Name( "Min(height)" ),
		:Name( "Mean(height)" ),
		:Name( "Max(height)" )
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Limits" )
);

Close(NoSave, dtsum);
f= Function({a}, {TR1, i},
	print(a, fb);
//	show(a, fb);
    for(i=1, i&amp;lt;=nitems(fb), i++,
    	Try( fb[i] &amp;lt;&amp;lt; Remove Graphics Script (1) )
    );
    TR1 = :Limits[dtlims &amp;lt;&amp;lt; get selected rows];
    Eval (EvalExpr( fb &amp;lt;&amp;lt; Add Graphics Script( H Line( Expr( TR1) ) ) ) );	
);


gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 528, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :Order ), Y( :height ), Group X(:sex) ),
	Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) )
);

fb = gb &amp;lt;&amp;lt; Xpath("//FrameBox");

rs = dtlims &amp;lt;&amp;lt;  Make RowState Handler(f );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Select one or multiple rows or clear all row selections and see the changes on all frameboxes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20681i8FE4BA4EAFDDA087/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This script was tested on JMP 14 &amp;amp; 15. Attached is slight modification of the script at line 26 so that the script works on JMP 13.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So there must be something else wrong with your script, because this works woth a RowState Handler script.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 05:34:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Graphics-Script-H-line-with-variable/m-p/238723#M47171</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-12-17T05:34:54Z</dc:date>
    </item>
  </channel>
</rss>

