<?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 can I script a moving Y variable for the graph builder ? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72260#M35576</link>
    <description>&lt;P&gt;Thanks, Jim. But I still ecounter error. I guess something may not right with my segmentation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/* Open a sample data table */
dt = Open( "C:\Users\1.jmp", invisible );

// Find the Y Columns
numericColNamesList = dt &amp;lt;&amp;lt; get column names( string, numeric );

For( i = N Items( numericColNamesList ), i &amp;gt;= 1, i--,
	If(
		Not(
			Is Missing( Num( Word( 1, numericColNamesList[i], ":" ) ) ) == 0 &amp;amp;
			Word( 2, numericColNamesList[i], ":" ) != ""
		),
		numericColNamesList = Remove( numericColNamesList, i, 1 )
	)
);

// Run the Variance Charts
// With dynamic Y columns and fixed X columns

Fo( i = 1, i &amp;lt;= N Items( numericColNamesList ), i++, 

	gb = dt &amp;lt;&amp;lt; Graph Builder(
	Invisible,
	Size( 752, 508 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables(
		X( :Month ),
		Y( Column ( numericColNamesList[i] ) ),
		Overlay( :Month )
	),
	Elements(
		Box Plot(
			X,
			Y,
			Legend( 15 ),
			Jitter( 0 ),
			Outliers( 0 ),
			Box Style( "Solid" )
		),
		Histogram( X, Y, Legend( 12 ) )
	));
		
	gb = LIST (gb[i]);
	
	If( i == 1,
		Report( gb ) &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
		Report( gb[i] &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
	));
	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Sep 2018 06:29:18 GMT</pubDate>
    <dc:creator>XiangCD_MP_User</dc:creator>
    <dc:date>2018-09-12T06:29:18Z</dc:date>
    <item>
      <title>How can I script a moving Y variable for the graph builder ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72146#M35555</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am doing a graph builder with a moving Y variables, the output of the graph will appear like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 963px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12373i630DB0BFDE38CE7D/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;But, I am struggling to script the Y axis in JSL.&amp;nbsp; How can I do so ?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items(  NamesList ), i++,

obj = Graph Builder(
	Size( 534, 464 ),
	Show Control Panel( 0 ),
	Variables(
		X( :TETEST_MONTH ),
		X( :TETEST_WEEK, Position( 1 ) ),
		Y( :Name ("Y")) , // how do I insert the moving Y variable here ?
	    Y( :Name ("Y")), // how do I insert the moving Y variable here ?
		Color( :TETEST_MONTH )
	),
	Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
	Elements(
		Position( 1, 2 ),
		Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
		Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
	),
	SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 11:20:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72146#M35555</guid>
      <dc:creator>XiangCD_MP_User</dc:creator>
      <dc:date>2018-09-11T11:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I script a moving Y variable for the graph builder ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72159#M35559</link>
      <description>&lt;P&gt;Assuming that "NamesList" contains the Y columns you want to use as your Y columns, then replace&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; :Names( "Y" )&lt;/P&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; as Column( NamesList[i] )&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 13:17:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72159#M35559</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-09-11T13:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I script a moving Y variable for the graph builder ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72238#M35574</link>
      <description>&lt;P&gt;Thanks Jim.&lt;/P&gt;&lt;P&gt;But I have not idea why this error kept prompting me during debugging.&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: 840px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12379i6CAB1CEE74CC698B/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;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items(  numericColNamesList ), i++,

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 900, 850 ),
	Show Control Panel( 0 ),
	Variables(
		X( :MONTH ),
		X( :WEEK, Position( 1 ) ),
		Y( Column( numericColNamesList[i])) ,
	    Y( Column( numericColNamesList[i])) ,
		Color( :MONTH )
	),
	Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
	Elements(
		Position( 1, 2 ),
		Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
		Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
	),
	SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));


	Report(gb[1])  &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx" );
For( i = 2, i &amp;lt;= N Items( numericColNamesList ), i++,
	 Report (gb[i] &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx", Append )
));

Open( "C:\Users\Ann Ann\1.pptx" );

//wait(0);

//obj &amp;lt;&amp;lt; close window();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 01:16:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72238#M35574</guid>
      <dc:creator>XiangCD_MP_User</dc:creator>
      <dc:date>2018-09-12T01:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I script a moving Y variable for the graph builder ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72239#M35575</link>
      <description>&lt;P&gt;You are using&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; gb = dt &amp;lt;&amp;lt; Graph Builder(.........&lt;/P&gt;
&lt;P&gt;for each execution of the Graph Builder Platform.&amp;nbsp; It is not a vector of values.&amp;nbsp; Each time you run the Graph Builder script, you are creating a new value for the variable "gb".&amp;nbsp;That is, the pointer to the last instance of Graph Builder is moved to point to the new instance of Graph Builder.&amp;nbsp; There is not a gb[1], gb[2], etc. the way you have the code setup.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to overcome this, is to move the Save Presentation area of code, inside the inititial For() loop.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way to solve this is in the initial For() Loop,&amp;nbsp; save the values of "gb" into a list after it's creation.&amp;nbsp; Then, point to the elements in the list in the second For() Loop, instead of gb[i] etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( numericColNamesList ), i++, 

	gb = dt &amp;lt;&amp;lt; Graph Builder(
		Size( 900, 850 ),
		Show Control Panel( 0 ),
		Variables(
			X( :MONTH ),
			X( :WEEK, Position( 1 ) ),
			Y( Column( numericColNamesList[i] ) ),
			Y( Column( numericColNamesList[i] ) ),
			Color( :MONTH )
		),
		Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
		Elements(
			Position( 1, 2 ),
			Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
			Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
		),
		SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
	);
	
	If( i == 1,
		Report( gb ) &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
		Report( gb[i] &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
	);
);


Open( "C:\Users\Ann Ann\1.pptx" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 01:37:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72239#M35575</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-09-12T01:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I script a moving Y variable for the graph builder ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72260#M35576</link>
      <description>&lt;P&gt;Thanks, Jim. But I still ecounter error. I guess something may not right with my segmentation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/* Open a sample data table */
dt = Open( "C:\Users\1.jmp", invisible );

// Find the Y Columns
numericColNamesList = dt &amp;lt;&amp;lt; get column names( string, numeric );

For( i = N Items( numericColNamesList ), i &amp;gt;= 1, i--,
	If(
		Not(
			Is Missing( Num( Word( 1, numericColNamesList[i], ":" ) ) ) == 0 &amp;amp;
			Word( 2, numericColNamesList[i], ":" ) != ""
		),
		numericColNamesList = Remove( numericColNamesList, i, 1 )
	)
);

// Run the Variance Charts
// With dynamic Y columns and fixed X columns

Fo( i = 1, i &amp;lt;= N Items( numericColNamesList ), i++, 

	gb = dt &amp;lt;&amp;lt; Graph Builder(
	Invisible,
	Size( 752, 508 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables(
		X( :Month ),
		Y( Column ( numericColNamesList[i] ) ),
		Overlay( :Month )
	),
	Elements(
		Box Plot(
			X,
			Y,
			Legend( 15 ),
			Jitter( 0 ),
			Outliers( 0 ),
			Box Style( "Solid" )
		),
		Histogram( X, Y, Legend( 12 ) )
	));
		
	gb = LIST (gb[i]);
	
	If( i == 1,
		Report( gb ) &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
		Report( gb[i] &amp;lt;&amp;lt; Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
	));
	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 06:29:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72260#M35576</guid>
      <dc:creator>XiangCD_MP_User</dc:creator>
      <dc:date>2018-09-12T06:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I script a moving Y variable for the graph builder ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72315#M35585</link>
      <description>&lt;P&gt;My error......get rid of all of the gb[i] references and change them to just gb. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 13:26:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72315#M35585</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-09-12T13:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I script a moving Y variable for the graph builder ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72346#M35598</link>
      <description>Thank you, Jim. It is working wonderfully now.</description>
      <pubDate>Wed, 12 Sep 2018 15:10:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-script-a-moving-Y-variable-for-the-graph-builder/m-p/72346#M35598</guid>
      <dc:creator>XiangCD_MP_User</dc:creator>
      <dc:date>2018-09-12T15:10:43Z</dc:date>
    </item>
  </channel>
</rss>

