Dear All,
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.
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).
For example, if the name of the picture is sample.png, I had to change it into sample.png.png.
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.
I am sure the problem can be solved in a cleaner way.
Thanks a lot for any help.
Names Default To Here(1);
dt=Current Data Table();
gb = dt <<
Graph Builder(
Variables( X( :x ), Y( :y ), Overlay( :track ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"x",
ScaleBox,
{Min( 0 ), Max( 280 ), Inc( 50 ), Minor Ticks( 1 )}
),
Dispatch(
{},
"y",
ScaleBox,
{Min( 0 ), Max( 265 ), Inc( 50 ), Minor Ticks( 1 )}
),
Dispatch( {}, "Graph Builder", FrameBox, {Transparency( 0.05 )} )
)
);
frame = (gb << report)[FrameBox( 1 )];
n = dt << Get Name();
img = newImage(n);
img<<Rotate(270);
frame << Add Image( image(img),bounds( top( 265 ), Left( 0 ), bottom( 0 ), Right( 280 ) ))