<?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 What script code do I need to automatically add a background image to a graph box? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45058#M25747</link>
    <description>&lt;P&gt;What script code do I need to automatically add a background image to a graph box?&lt;BR /&gt;&lt;BR /&gt;Here's a sample of a simple script I use to create a graph box:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Map",
	Graph Box(
		Frame Size(600, 600),
		X Scale(0, 1252),
		Y Scale(0, 1252),
		Pen Color("white"),
		Line( {10, 10}, {10, 1200} );
		Line( {600, 10}, {600, 1200} );
		Line( {1200, 10}, {1200, 1200} );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After I run the above script I can drag and drop a jpg image into the background and manipulate it (rotate, change size, change transparency, etc.).&lt;BR /&gt;&lt;BR /&gt;What code do I need to automate adding the jpg image background as part of the script?&lt;/P&gt;</description>
    <pubDate>Sat, 23 Sep 2017 00:04:40 GMT</pubDate>
    <dc:creator>mcudzinovic</dc:creator>
    <dc:date>2017-09-23T00:04:40Z</dc:date>
    <item>
      <title>What script code do I need to automatically add a background image to a graph box?</title>
      <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45058#M25747</link>
      <description>&lt;P&gt;What script code do I need to automatically add a background image to a graph box?&lt;BR /&gt;&lt;BR /&gt;Here's a sample of a simple script I use to create a graph box:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Map",
	Graph Box(
		Frame Size(600, 600),
		X Scale(0, 1252),
		Y Scale(0, 1252),
		Pen Color("white"),
		Line( {10, 10}, {10, 1200} );
		Line( {600, 10}, {600, 1200} );
		Line( {1200, 10}, {1200, 1200} );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After I run the above script I can drag and drop a jpg image into the background and manipulate it (rotate, change size, change transparency, etc.).&lt;BR /&gt;&lt;BR /&gt;What code do I need to automate adding the jpg image background as part of the script?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2017 00:04:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45058#M25747</guid>
      <dc:creator>mcudzinovic</dc:creator>
      <dc:date>2017-09-23T00:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: What script code do I need to automatically add a background image to a graph box?</title>
      <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45059#M25748</link>
      <description>&lt;P&gt;What you will need to do is to paste the background image into the Frame Box() of your Graph Box(). &amp;nbsp;Below is the example taken directly from the Scripting Index illustrating how to do this&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Help==&amp;gt;Scripting Index==&amp;gt;FrameBox==&amp;gt;Paste Background Image&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Animals.jmp" );
op = Overlay Plot(
	X( :subject ),
	Y( :miles ),
	Separate Axes( 1 )
);
opr1 = op &amp;lt;&amp;lt; report;
opr2 = opr1 &amp;lt;&amp;lt; Clone Box;
opr1 &amp;lt;&amp;lt; append( opr2 );
fb1 = opr1[Frame Box( 1 )];
fb1 &amp;lt;&amp;lt; Add Image(
	Open(
		Convert File Path(
			"$SAMPLE_IMAGES/black rhino footprint.jpg"
		)
	),
	Transparency( 0.9 ),
	Rotate( 90 ),
	Bounds(
		Left( 0.135416666666667 ),
		Right( 3.26041666666667 ),
		Top( 11.8333333333333 ),
		Bottom( -1 )
	),
	SetSize( {300, 210} )
);
fb1 &amp;lt;&amp;lt; Copy Picture;
fb2 = opr2[Frame Box( 1 )];
fb2 &amp;lt;&amp;lt; Paste Background Image;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Sep 2017 00:42:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45059#M25748</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-09-23T00:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: What script code do I need to automatically add a background image to a graph box?</title>
      <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45060#M25749</link>
      <description>&lt;P&gt;You might get some ideas from&amp;nbsp;&lt;A href="https://community.jmp.com/t5/Uncharted/Sunshine-Map/ba-p/21004" target="_self"&gt;this post&lt;/A&gt;&amp;nbsp;about how the frame's segment layering can be controlled to move your picture in front of or behind your data. It is possible to have a map, data points, and images, and get them in the order you need.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2017 00:56:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45060#M25749</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2017-09-23T00:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: What script code do I need to automatically add a background image to a graph box?</title>
      <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45672#M26088</link>
      <description>&lt;P&gt;xnelson,&lt;BR /&gt;&lt;BR /&gt;I cannot figure out how to use your suggestion. Looking in my Help ==&amp;gt; Scripting Index I could not find your referenced "Help==&amp;gt;Scripting Index==&amp;gt;FrameBox==&amp;gt;Paste Background Image". I tried the following script made from my sample script and trying to apply your suggestion:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Here's my original script:
win = New Window( "Map",
	Graph Box(
		Frame Size(600, 600),
		X Scale(0, 1252),
		Y Scale(0, 1252),
		Pen Color("white"),
		Line( {10, 10}, {10, 1200} );
		Line( {600, 10}, {600, 1200} );
		Line( {1200, 10}, {1200, 1200} );
	)
);

// And here's what I added based on your suggestion:
opr1 = win &amp;lt;&amp;lt; report;
fb1 = opr1[Frame Box( 1 )];
fb1 &amp;lt;&amp;lt; Add Image(
	Open(
		Convert File Path(
			"$SAMPLE_IMAGES/black rhino footprint.jpg"
		)
	),
	Transparency( 0.9 ),
	Rotate( 90 ),
	Bounds(
		Left( 0.135416666666667 ),
		Right( 3.26041666666667 ),
		Top( 11.8333333333333 ),
		Bottom( -1 )
	),
	SetSize( {300, 210} )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I run the script I get an error message saying:&lt;BR /&gt;"The display box 'EvalContextBox' does not recognize the message 'report'; perhaps you mean one of these:&amp;nbsp; &amp;lt;&amp;lt;Set Report Title &amp;lt;&amp;lt;Reshow &amp;lt;&amp;lt;set horizontal &amp;lt;&amp;lt;get horizontal &amp;lt;&amp;lt;Parent &amp;lt;&amp;lt;Prepend &amp;lt;&amp;lt;Get RTF &amp;lt;&amp;lt;Save RTF &amp;lt;&amp;lt;Get Web Support &amp;lt;&amp;lt;Border &amp;lt;&amp;lt;Set Property &amp;lt;&amp;lt;Get Property &amp;lt;&amp;lt;Get Property List &amp;lt;&amp;lt;Get Properties &amp;lt;&amp;lt;Set Property &amp;lt;&amp;lt;Get Property &amp;lt;&amp;lt;Get Property List &amp;lt;&amp;lt;Get Properties."&lt;BR /&gt;&lt;BR /&gt;I looked through the Scripting Index and found a reference to "report", but with syntax "y= Report( platform object)". So I tried replacing the line "opr1 = win &amp;lt;&amp;lt; report;" with "opr1 = Report(win)". That got rid of the first error message, but now I get an error message "Send Expects Scriptable Object in access or evaluation of 'Send' , fb1 &amp;lt;&amp;lt;&amp;nbsp; /*###*/Add Image(".&lt;BR /&gt;&lt;BR /&gt;I thought maybe I need to refer to the Graph Box itself instead of the New Window, so I tried the script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Map",
	gb= Graph Box(
		Frame Size(600, 600),
		X Scale(0, 1252),
		Y Scale(0, 1252),
		Pen Color("white"),
		Line( {10, 10}, {10, 1200} );
		Line( {600, 10}, {600, 1200} );
		Line( {1200, 10}, {1200, 1200} );
	)
);

opr1 = Report( gb );
fb1 = opr1[Frame Box( 1 )];
fb1 &amp;lt;&amp;lt; Add Image(
	Open(
		Convert File Path(
			"$SAMPLE_IMAGES/black rhino footprint.jpg"
		)
	),
	Transparency( 0.9 ),
	Rotate( 90 ),
	Bounds(
		Left( 0.135416666666667 ),
		Right( 3.26041666666667 ),
		Top( 11.8333333333333 ),
		Bottom( -1 )
	),
	SetSize( {300, 210} )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(Note I tried the syntax "opr1 = gb &amp;lt;&amp;lt; report" first, but it gave me the original "report" error.) I still have a "Send Expects Scriptable Object in access or evaluation of 'Send' , fb1 &amp;lt;&amp;lt;&amp;nbsp; /*###*/Add Image(" error.&lt;BR /&gt;&lt;BR /&gt;What am I doing wrong?&lt;BR /&gt;&lt;BR /&gt;Also, is there a way to embed the image into the script? Multiple people will be running the script so a specific reference to an image location will not scale easily. For example, instead of using "Open" when I Add Image, can I use "Set Blob( Char To Blob())"?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 16:14:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45672#M26088</guid>
      <dc:creator>mcudzinovic</dc:creator>
      <dc:date>2017-10-09T16:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: What script code do I need to automatically add a background image to a graph box?</title>
      <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45682#M26091</link>
      <description>&lt;P&gt;You are really close. The main issue, as you suspect, is the report message. The report message is sent to a platform to get the display box tree. The GraphBox &lt;EM&gt;&lt;STRONG&gt;is&lt;/STRONG&gt;&lt;/EM&gt; a displaybox tree, not a platform. There are also some minor tweaks to the positioning parameters (and I played with some other parameters too.) The top,left and bottom,right positions are specified in the same coordinates as the axes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Map",
	gb=Graph Box(
		Frame Size(600, 600),
		X Scale(0, 1252),
		Y Scale(0, 1252),
		Pen Color("red"),
		Line( {10, 10}, {10, 1200} );
		Line( {600, 10}, {600, 1200} );
		Line( {1200, 10}, {1200, 1200} );
	)
);



fb1 = gb[Frame Box( 1 )];
fb1 &amp;lt;&amp;lt; add Image(
	Open(
		Convert File Path(
			"$SAMPLE_IMAGES/black rhino footprint.jpg"
		)
	),
	Transparency( 0.5 ),
	Rotate( 45 ),
	Bounds(
		Top( 800 ),Left( 100 ),
		Bottom( 100 ),Right( 800 )
	),
	//SetSize( {300, 210} )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="background picture positioned and rotated" style="width: 668px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/7923i2ACF8E6C73CC2D36/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="background picture positioned and rotated" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;background picture positioned and rotated&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 16:59:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45682#M26091</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2017-10-09T16:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: What script code do I need to automatically add a background image to a graph box?</title>
      <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45688#M26094</link>
      <description>&lt;P&gt;Here is an image of the reference to Paste Background Image&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paste background.PNG" style="width: 900px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/7925i3638324BFE13469D/image-size/large?v=v2&amp;amp;px=999" role="button" title="paste background.PNG" alt="paste background.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 17:28:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45688#M26094</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-10-09T17:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: What script code do I need to automatically add a background image to a graph box?</title>
      <link>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45697#M26096</link>
      <description>Thanks for the image. I am able to find it now! I was accidentally searching under "Functions" instead of "All Categories."</description>
      <pubDate>Mon, 09 Oct 2017 21:35:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-script-code-do-I-need-to-automatically-add-a-background/m-p/45697#M26096</guid>
      <dc:creator>mcudzinovic</dc:creator>
      <dc:date>2017-10-09T21:35:47Z</dc:date>
    </item>
  </channel>
</rss>

