<?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: Adding a picture as a background of a graph in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/383941#M63443</link>
    <description>Hi,&lt;BR /&gt;The issue is that the variable "n" is a string, not an image even after calling the New Image. I have not found a way to convert directly a string into an image but you can create a dummy txtb = Text Box (n), and then get the picture of that object txtimg = tctb &amp;lt;&amp;lt; Get Picture, and finally use the txtimg variable as you background.&lt;BR /&gt;I hope it helps. Others may have more elegant ways to tackle this.&lt;BR /&gt;Best,&lt;BR /&gt;TS&lt;BR /&gt;</description>
    <pubDate>Mon, 10 May 2021 20:49:17 GMT</pubDate>
    <dc:creator>Thierry_S</dc:creator>
    <dc:date>2021-05-10T20:49:17Z</dc:date>
    <item>
      <title>Adding a picture as a background of a graph</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/383873#M63441</link>
      <description>&lt;P&gt;Dear All,&lt;BR /&gt;I wrote the following script. After opening a data table, it takes the data and creates a graph by using the graph builder. Then it loads a picture which has the same name as the opened data table and use that picture as a background for the graph.&lt;BR /&gt;In order to make the script work, I had to add to the data table name the file extension .png as part of the name. So I had to name both the picture and the data table by adding .png in their name (the picture file has the extension .png). &lt;BR /&gt;For example, if the name of the picture is sample.png, I had to change it into sample.png.png.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Of course I do not like this but if I do not make this change jmp says that it can’t find the picture file.&lt;BR /&gt;I am sure the problem can be solved in a cleaner way.&lt;BR /&gt;Thanks a lot for any help.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt=Current Data Table();
gb = dt &amp;lt;&amp;lt;
Graph Builder(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Variables( X( :x ), Y( :y ), Overlay( :track ) ),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Elements( Points( X, Y, Legend( 5 ) ) ),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SendToReport(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispatch(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ScaleBox,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {Min( 0 ), Max( 280 ), Inc( 50 ), Minor Ticks( 1 )}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispatch(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "y",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ScaleBox,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {Min( 0 ), Max( 265 ), Inc( 50 ), Minor Ticks( 1 )}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispatch( {}, "Graph Builder", FrameBox, {Transparency( 0.05 )} )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )
);
frame = (gb &amp;lt;&amp;lt; report)[FrameBox( 1 )];
&amp;nbsp;n = dt &amp;lt;&amp;lt; Get Name();
&amp;nbsp;img = newImage(n);
&amp;nbsp;img&amp;lt;&amp;lt;Rotate(270);
&amp;nbsp;frame &amp;lt;&amp;lt; Add Image( image(img),bounds( top( 265 ), Left( 0 ), bottom( 0 ), Right( 280 ) ))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:13:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/383873#M63441</guid>
      <dc:creator>MFVIT</dc:creator>
      <dc:date>2023-06-11T11:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a picture as a background of a graph</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/383941#M63443</link>
      <description>Hi,&lt;BR /&gt;The issue is that the variable "n" is a string, not an image even after calling the New Image. I have not found a way to convert directly a string into an image but you can create a dummy txtb = Text Box (n), and then get the picture of that object txtimg = tctb &amp;lt;&amp;lt; Get Picture, and finally use the txtimg variable as you background.&lt;BR /&gt;I hope it helps. Others may have more elegant ways to tackle this.&lt;BR /&gt;Best,&lt;BR /&gt;TS&lt;BR /&gt;</description>
      <pubDate>Mon, 10 May 2021 20:49:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/383941#M63443</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-05-10T20:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a picture as a background of a graph</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/383990#M63447</link>
      <description>&lt;P&gt;On Windows, the Get Name() message to a data table returns only the table name, without the ".jmp" appended.&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( "$DESKTOP/Big Class.jmp" );
Show( dt &amp;lt;&amp;lt; get name() );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;//:*/
Names Default To Here( 1 );
dt = Open( "$DESKTOP/Big Class.jmp" );
Show( dt &amp;lt;&amp;lt; get name() );
/*:

dt &amp;lt;&amp;lt; get name() = "Big Class";&lt;/PRE&gt;
&lt;P&gt;So, you'll need to append the ".png" to get a complete filename for New Image().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example using Big Class (copied to your desktop) and the attached Big Class.png file here.&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( "$DESKTOP/Big Class.jmp" );


gb = dt &amp;lt;&amp;lt; Graph Builder(
	Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) ),
	SendToReport( Dispatch( {}, "Graph Builder", FrameBox, {Transparency( 0.5 )} ) )
);
frame = (gb &amp;lt;&amp;lt; report)[FrameBox( 1 )];
n = dt &amp;lt;&amp;lt; Get Name();
img = New Image( "$DESKTOP/" || n || ".png" );
frame &amp;lt;&amp;lt; Add Image(
	image( img ),
	Bounds(
		Left( 61.2587412587413 ),
		Right( 179.370629370629 ),
		Top( 70.8292080975384 ),
		Bottom( 48.5033161162993 )
	),
	SetSize( {799, 620} )

);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NB: On the Mac, &amp;lt;&amp;lt;Get Name() returns the whole filename, including the .jmp. Therefore, on the Mac you'll need to use &lt;A href="https://www.jmp.com/support/help/en/16.0/#page/jmp/substitute-and-substitute-into.shtml" target="_self"&gt;Substitute Into()&lt;/A&gt; to replace the ".jmp" with ".png".&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( "~/Desktop/Big Class.jmp" );
gb = dt &amp;lt;&amp;lt; Graph Builder(
	Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) ),
	SendToReport( Dispatch( {}, "Graph Builder", FrameBox, {Transparency( 0.5 )} ) )
);
frame = (gb &amp;lt;&amp;lt; report)[FrameBox( 1 )];
n = dt &amp;lt;&amp;lt; Get Name();
Substitute Into( n, ".jmp", ".png" );
img = New Image( "~/Desktop/" || n );
 //img&amp;lt;&amp;lt;Rotate(270);
frame &amp;lt;&amp;lt; Add Image(
	image( img ),
	Bounds( Left( 61.2587412587413 ), Right( 179.370629370629 ), Top( 70.8292080975384 ), Bottom( 48.5033161162993 ) ),
	SetSize( {799, 620} )

);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 11:36:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/383990#M63447</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2021-05-12T11:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a picture as a background of a graph</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/384409#M63479</link>
      <description>Many thanks!</description>
      <pubDate>Wed, 12 May 2021 07:50:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/384409#M63479</guid>
      <dc:creator>MFVIT</dc:creator>
      <dc:date>2021-05-12T07:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a picture as a background of a graph</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/384410#M63480</link>
      <description>&lt;P&gt;Many thanks, this worked and I solved my problem.&lt;/P&gt;&lt;P&gt;Do you know how I can get rid of the file extension in a text string? I have a script that reads the names of the picture files in a folder and put their names in a vector. Each name contains also the extension. Is there a simple command to eliminate the last four letters of a text string?&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Marcello.&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 07:55:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/384410#M63480</guid>
      <dc:creator>MFVIT</dc:creator>
      <dc:date>2021-05-12T07:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a picture as a background of a graph</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/384411#M63481</link>
      <description>&lt;P&gt;Maybe one of these will work for you:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;filename = "testname.html";
Substr(filename, 1, Contains(filename, ".")-1);
Left(filename, Length(fileName) - 5);
Word(1, filename, ".");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Check Scripting Index for more information what the functions do&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 08:03:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-a-picture-as-a-background-of-a-graph/m-p/384411#M63481</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-05-12T08:03:53Z</dc:date>
    </item>
  </channel>
</rss>

