<?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: Can I save each page of a graph(from graph builder) into one separate image file? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682380#M86795</link>
    <description>&lt;P&gt;Good question. Here's the JSL that can crawl through the display tree to gather the pieces. The journal tree changed between 17 and 18 and might change again. You could probably do the 17 variation on the graphbuilder directly, but I found it easier to work with the journal, especially with the JMP 18 Early Adopter version.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
g = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 528, 2956 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ), Page( :age ) ),
	Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
);

// make a journal just for this task, the vanilla journal might be in use.
tempWindow = New Window( "temp", &amp;lt;&amp;lt;Type( "journal" ) );
g &amp;lt;&amp;lt; journal;

// place to save, be careful with delete directory!!!!!!
dir = "$temp/" || "junk/"; // keep the trailing / to join a file name
Delete Directory( dir ); // be careful here! this is really just for testing...
Create Directory( dir );

If( JMP Version() &amp;gt;= "18", // easier in 18, the journal groups the pictures
	// moving the graphs to a journal window is the key; the elements are not
	// grouped by pages in a usable displaybox tree in graphbuilder, but they
	// are when graphbuilder sends them to a journal.
	// now use xpath to extract the chunks you want. In this case, using the
	// journal's showproperties, we discover there is a lineup box whose children
	// are what is needed. Get those children as a list...
	graphList = tempwindow &amp;lt;&amp;lt; XPath( "//OutlineBox[text()='Graph Builder']//LineUpBox/ListBox" );
// save the pics; dig out a name for each one
	For Each( {graph}, graphList, 
	// grab a name and keep the non-special characters for a disk file name
		label = Regex( graph[LabelBox( 1 )] &amp;lt;&amp;lt; gettext, "[^A-Za-z0-9]+", "_", GLOBALREPLACE );
	// create the individual picture using the label for a filename
		graph &amp;lt;&amp;lt; savepicture( dir || label || ".png", "png" );
	);

, // else harder in 17, find a way...
	// at least for this example we find pairs of listboxes, without a listbox wrapper as in 18
	labList = tempwindow &amp;lt;&amp;lt; XPath( "//OutlineBox[text()='Graph Builder']//BorderBox//LabelBox" );
	For Each( {lab}, lablist,
		label = Regex( lab &amp;lt;&amp;lt; gettext, "[^A-Za-z0-9]+", "_", GLOBALREPLACE );
		parent = lab &amp;lt;&amp;lt; parent; // use the journal's property sheet to see what is needed
		spacer = parent &amp;lt;&amp;lt; sib;
		graph = spacer &amp;lt;&amp;lt; sib;
		combine = V List Box( parent, graph );
		combine &amp;lt;&amp;lt; savepicture( dir || label || ".png", "png" );
	);
);


// just for fun, see what happened
fileList = Files In Directory( dir );

For Each( {file}, fileList, Open( dir || file ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 29 Sep 2023 15:44:04 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2023-09-29T15:44:04Z</dc:date>
    <item>
      <title>Can I save each page of a graph(from graph builder) into one separate image file?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/228484#M45329</link>
      <description>&lt;P&gt;I generated lots of pages from one graph. This is from graph builder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I like to save each page as one image file. Is this possible in JMP?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Dave&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 17:08:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/228484#M45329</guid>
      <dc:creator>davidmingyin</dc:creator>
      <dc:date>2019-10-08T17:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can I save each page of a graph(from graph builder) into one separate image file?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/228614#M45351</link>
      <description>&lt;P&gt;Yes, this is possible. If you want each graph builder chart saved as an image, it can be scripted for each graph builder chart (or collection of graph builder pages) respectively as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;gb &amp;lt;&amp;lt; Journal();&lt;BR /&gt;current journal() &amp;lt;&amp;lt; Save Picture ("\\ImageSaveLocation\ImageName.PNG");&lt;BR /&gt;current journal() &amp;lt;&amp;lt; Close Window;&lt;/P&gt;&lt;P&gt;gb2 &amp;lt;&amp;lt; Journal();&lt;BR /&gt;current journal() &amp;lt;&amp;lt; Save Picture ("\\ImageSaveLocation\ImageName2.PNG");&lt;BR /&gt;current journal() &amp;lt;&amp;lt; Close Window;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2019 15:10:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/228614#M45351</guid>
      <dc:creator>DMD</dc:creator>
      <dc:date>2019-10-09T15:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can I save each page of a graph(from graph builder) into one separate image file?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682219#M86785</link>
      <description>&lt;P&gt;Maybe I don't understand your answer correctly &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16299"&gt;@DMD&lt;/a&gt;&amp;nbsp;. Let's say I have a graph builder gb which consists of several pages. Then&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;gb &amp;lt;&amp;lt; Journal();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;current journal() &amp;lt;&amp;lt; Save Picture ("\\ImageSaveLocation\ImageName.PNG");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;current journal() &amp;lt;&amp;lt; Close Window;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;saves ONE image with all pages in it. But I want (and this is how I understood&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16286"&gt;@davidmingyin&lt;/a&gt;&amp;nbsp;) several images with each page with its own image.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I would be really happy if someone can help. Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 09:59:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682219#M86785</guid>
      <dc:creator>Anja_W</dc:creator>
      <dc:date>2023-09-29T09:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I save each page of a graph(from graph builder) into one separate image file?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682295#M86789</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16286"&gt;@davidmingyin&lt;/a&gt;&amp;nbsp;-&lt;/P&gt;
&lt;P&gt;One way to do this without any scripting is to Export the report as a Powerpoint (File &amp;gt; Export...). To do this in Graph Builder, place a column in the "Page" drop zone. In other analysis platforms, assign a variable to the "By" column role.&lt;/P&gt;
&lt;P&gt;When you Export as a Powerpoint, each individual graph will be exported as an image in a separate slide.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 12:48:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682295#M86789</guid>
      <dc:creator>scott_allen</dc:creator>
      <dc:date>2023-09-29T12:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Can I save each page of a graph(from graph builder) into one separate image file?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682380#M86795</link>
      <description>&lt;P&gt;Good question. Here's the JSL that can crawl through the display tree to gather the pieces. The journal tree changed between 17 and 18 and might change again. You could probably do the 17 variation on the graphbuilder directly, but I found it easier to work with the journal, especially with the JMP 18 Early Adopter version.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
g = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 528, 2956 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ), Page( :age ) ),
	Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
);

// make a journal just for this task, the vanilla journal might be in use.
tempWindow = New Window( "temp", &amp;lt;&amp;lt;Type( "journal" ) );
g &amp;lt;&amp;lt; journal;

// place to save, be careful with delete directory!!!!!!
dir = "$temp/" || "junk/"; // keep the trailing / to join a file name
Delete Directory( dir ); // be careful here! this is really just for testing...
Create Directory( dir );

If( JMP Version() &amp;gt;= "18", // easier in 18, the journal groups the pictures
	// moving the graphs to a journal window is the key; the elements are not
	// grouped by pages in a usable displaybox tree in graphbuilder, but they
	// are when graphbuilder sends them to a journal.
	// now use xpath to extract the chunks you want. In this case, using the
	// journal's showproperties, we discover there is a lineup box whose children
	// are what is needed. Get those children as a list...
	graphList = tempwindow &amp;lt;&amp;lt; XPath( "//OutlineBox[text()='Graph Builder']//LineUpBox/ListBox" );
// save the pics; dig out a name for each one
	For Each( {graph}, graphList, 
	// grab a name and keep the non-special characters for a disk file name
		label = Regex( graph[LabelBox( 1 )] &amp;lt;&amp;lt; gettext, "[^A-Za-z0-9]+", "_", GLOBALREPLACE );
	// create the individual picture using the label for a filename
		graph &amp;lt;&amp;lt; savepicture( dir || label || ".png", "png" );
	);

, // else harder in 17, find a way...
	// at least for this example we find pairs of listboxes, without a listbox wrapper as in 18
	labList = tempwindow &amp;lt;&amp;lt; XPath( "//OutlineBox[text()='Graph Builder']//BorderBox//LabelBox" );
	For Each( {lab}, lablist,
		label = Regex( lab &amp;lt;&amp;lt; gettext, "[^A-Za-z0-9]+", "_", GLOBALREPLACE );
		parent = lab &amp;lt;&amp;lt; parent; // use the journal's property sheet to see what is needed
		spacer = parent &amp;lt;&amp;lt; sib;
		graph = spacer &amp;lt;&amp;lt; sib;
		combine = V List Box( parent, graph );
		combine &amp;lt;&amp;lt; savepicture( dir || label || ".png", "png" );
	);
);


// just for fun, see what happened
fileList = Files In Directory( dir );

For Each( {file}, fileList, Open( dir || file ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Sep 2023 15:44:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682380#M86795</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-09-29T15:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can I save each page of a graph(from graph builder) into one separate image file?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682391#M86797</link>
      <description>&lt;P&gt;Also, using by groups is about the same as the page option, and will make for easier solutions with xpath. To see the launcher that lets you use a by group in place of page, red-triangle-&amp;gt;redo-&amp;gt;relaunch&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Graph builder also has this traditional launcher dialog, mostly not needed." style="width: 624px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57101i640BDE321A01193F/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture2.png" alt="Graph builder also has this traditional launcher dialog, mostly not needed." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Graph builder also has this traditional launcher dialog, mostly not needed.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57099i94677860747E5132/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 15:59:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682391#M86797</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-09-29T15:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can I save each page of a graph(from graph builder) into one separate image file?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682407#M86798</link>
      <description>&lt;P&gt;Also the by group version works with a data table to hold the graphs&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="The left-side data table was captured by the command on the right." style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57102i7F080F13934381B8/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture.png" alt="The left-side data table was captured by the command on the right." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;The left-side data table was captured by the command on the right.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 16:35:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-I-save-each-page-of-a-graph-from-graph-builder-into-one/m-p/682407#M86798</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-09-29T16:35:55Z</dc:date>
    </item>
  </channel>
</rss>

