Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
DS
DS
Level VI

How to add HTML links to JMP interactive HTML files

Hi JMP Community,

 

(JMP Pro 14.1.0, W10E 64-bit)

 

  I have several separately saved JMP interactive HTML files -- I must have it this way because I am using "Column Switcher" and HTML has no concept of columns, hence can't switch them out.

 

  Instead, I'd like to insert a href link from one of the analyses HTML files to the other.

 

  For example, I have a oneway anova interactive HTML called "test.htm". In JMP, I use column switcher to change out the horizontal categorical column and save that as "test2.htm".

 

  I'd like to go in and edit the HTM files so that there is a link embedded in each one to take you to the other. Is this possible? I have tried several things, like adding it in the <script></script> tags or using <iframe></iframe> tags, but those don't work. It seems this should be doable.

 

Thanks in advance for your time!

DS

 

UPDATE: So, I found out that I can call a JMP function in the JavaScript to generate a new button at the top of the interactive HTML that links to the other file and will open a new tab in the browser. A temporary workaround, but not ideal. I'd like to not have to add it to some random section within the JavaScript, but rather in an easier to find location so that editing the multiple files is much easier. Any thoughts on how to build on this for an easier way to switch between analyses via HTML is much appreciated. Thanks!

 

_(u,"test2.htm","spaceLeft","buttonSquare buttonUp")

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to add HTML links to JMP interactive HTML files

Hi DS, 

 

Our Interactive HTML files are not designed to be edited. We build up the content when the page is loaded using JavaScript code, so anything you try to inject will be overwritten, except of course something in the <script> section itself that calls a strangely named function within our compressed JavaScript code to add a button.

However, there are a few ways to achieve a single web page with a graph for each column of your column switcher. The first two options below will be useful if you are willing to rebuild your Interactive HTML files, while the third is useful if you want to work with existing HTML files. Finally, I would be remiss if I did not mention that if you had JMP Live or were willing to use JMP Public(with JMP 15), published Column Switchers would work as you expect without any extra work. See Column Switchers in JMP Live

 

1. If you are willing to rebuild your Interactive HTML files, you could make separate reports, one for each column by choosing Redo Analysis, then choose another column from the column switcher. Next, use File > Publish > Publish to File and choose all the reports you created. This will generate a web page with thumbnails of each variation of your plot that you can click on to launch a specific one.

 

This doesn't create a 'Next' button, so you'd have to use the browser's back button to pick the next one.

 

If you really want a "Next" button instead of a page with several thumbnails, you could right click on the gray triangle to the left of the Column Switcher and choose Append Item > Add URL Reference. For the Link Name, enter Next and for the URL, remove the http:// and enter ./<nextFile.htm> where <nextFile.htm> is the name of the next Interactive HTML file you'd like to display. For this to work, you'd have to choose the file names you are going to save to in advance and make sure you use those file names when you save as Interactive HTML. To keep it simple, you should save all the files to the same folder. 

 

2. Another option is to create a Dashboard and place each variation on a separate tab. Then Save the Dashboard as Interactive HTML. I can elaborate on this if you like this solution.

 

3. If you must work with existing Interactive HTML files, you could wrap each one in an iFrame with a reference to the next.  Let's say you decide to call these wrapper files Frame1.htm, Frame2.htm, ... FrameN.htm. Each one would look like this:

<!DOCTYPE html>
<html><head></head><body>
	<style> 
		.next { position:absolute; right:0; margin-right:30px; z-index:10000 }
		.wrapper { position:absolute; top:0; left: 0; right: 0; bottom: 0; }
		.wrapper iframe { display:block; width:100%; height:100%; border:none; }
	</style>
	<a class="next" href="./Frame2.htm">Next</a>	
	<div class="wrapper"><iframe frameborder="0" src="./oneway.htm" ></iframe></div>
</body>
</html>

The href in the <a> element would point to the next wrapper file (./FrameX.htm) and the last one could point back to the first.

The src in the <iframe> element is the name of the existing Interactive HTML file and would be different in each FrameX.htm file. The "./" in front of the file name assumes the Frame files and the original Interactive HTML files are all in the same folder, but  this can be modified to point to another folder.

 

I hope one of these solutions works better for you than the solution you found.

-John

 

 

 

 

View solution in original post

3 REPLIES 3
Highlighted

Re: How to add HTML links to JMP interactive HTML files

Hi DS, 

 

Our Interactive HTML files are not designed to be edited. We build up the content when the page is loaded using JavaScript code, so anything you try to inject will be overwritten, except of course something in the <script> section itself that calls a strangely named function within our compressed JavaScript code to add a button.

However, there are a few ways to achieve a single web page with a graph for each column of your column switcher. The first two options below will be useful if you are willing to rebuild your Interactive HTML files, while the third is useful if you want to work with existing HTML files. Finally, I would be remiss if I did not mention that if you had JMP Live or were willing to use JMP Public(with JMP 15), published Column Switchers would work as you expect without any extra work. See Column Switchers in JMP Live

 

1. If you are willing to rebuild your Interactive HTML files, you could make separate reports, one for each column by choosing Redo Analysis, then choose another column from the column switcher. Next, use File > Publish > Publish to File and choose all the reports you created. This will generate a web page with thumbnails of each variation of your plot that you can click on to launch a specific one.

 

This doesn't create a 'Next' button, so you'd have to use the browser's back button to pick the next one.

 

If you really want a "Next" button instead of a page with several thumbnails, you could right click on the gray triangle to the left of the Column Switcher and choose Append Item > Add URL Reference. For the Link Name, enter Next and for the URL, remove the http:// and enter ./<nextFile.htm> where <nextFile.htm> is the name of the next Interactive HTML file you'd like to display. For this to work, you'd have to choose the file names you are going to save to in advance and make sure you use those file names when you save as Interactive HTML. To keep it simple, you should save all the files to the same folder. 

 

2. Another option is to create a Dashboard and place each variation on a separate tab. Then Save the Dashboard as Interactive HTML. I can elaborate on this if you like this solution.

 

3. If you must work with existing Interactive HTML files, you could wrap each one in an iFrame with a reference to the next.  Let's say you decide to call these wrapper files Frame1.htm, Frame2.htm, ... FrameN.htm. Each one would look like this:

<!DOCTYPE html>
<html><head></head><body>
	<style> 
		.next { position:absolute; right:0; margin-right:30px; z-index:10000 }
		.wrapper { position:absolute; top:0; left: 0; right: 0; bottom: 0; }
		.wrapper iframe { display:block; width:100%; height:100%; border:none; }
	</style>
	<a class="next" href="./Frame2.htm">Next</a>	
	<div class="wrapper"><iframe frameborder="0" src="./oneway.htm" ></iframe></div>
</body>
</html>

The href in the <a> element would point to the next wrapper file (./FrameX.htm) and the last one could point back to the first.

The src in the <iframe> element is the name of the existing Interactive HTML file and would be different in each FrameX.htm file. The "./" in front of the file name assumes the Frame files and the original Interactive HTML files are all in the same folder, but  this can be modified to point to another folder.

 

I hope one of these solutions works better for you than the solution you found.

-John

 

 

 

 

View solution in original post

Highlighted
DS
DS
Level VI

Re: How to add HTML links to JMP interactive HTML files

Hi @John_Powell_JMP,

 

  Thank you so much for the clear explanation about how to work around the column switcher issue with HTML files. I doubt we have enough need to go with JMP Live, so this is why I wanted to find a format that could work.

 

  I like the Dashboard option as an HTML file myself, as the data from one analysis is linked to the other, so that is very cool. I have generated all three options that you provided and shared them with my colleague who is the one who needs to share the data. I'll find out which method he prefers and help him out with that.

 

Thanks!,

DS

Highlighted

Re: How to add HTML links to JMP interactive HTML files

You're welcome.

 

Article Labels

    There are no labels assigned to this post.