cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
d_barnett
Level IV

Clickable Links in Graph Builder which Opens Website/ Image or Directory

I have created a data table and used the EventHandler function to make one of the columns hyperlink to a website when clicked.

 

What I want to do now is to put this data into Graph Builder and when the points are clicked they open the website pertaining to the row. Is this possible? I have used the column as a label, but this doesn't work as it isn't clickable.

 

I have attached a small example table where it shows the data table and graph side by side and where the cloumn is labelled - it is this label in the graph I'd like to be hyperlinked.

 Capture.JPG

regards

 

David

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Clickable Links in Graph Builder which Opens Website/ Image or Directory

Here is an example script that uses Make Row State Handler to do what you want.  It does not require your  Event Handler, so I remove it.  I can be left in if you want it, but it is not required.

Names Default To Here( 1 );
dt = New Table( "click and Link",
	Add Rows( 5 ),
	New Script(
		"where vs. Position",
		Graph Builder(
			Size( 522, 454 ),
			Show Control Panel( 0 ),
			Variables( X( :Position ), Y( :where ) ),
			Elements( Points( X, Y, Legend( 3 ) ) )
		)
	),
	New Column( "Position",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5] ),
		Set Display Width( 56 )
	),
	New Column( "where",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [5, 4, 3, 2, 1] ),
		Set Display Width( 48 )
	),
	New Column( "Link",
		Character,
		"Nominal",
		Set Selected,
		Set Values(
			{"https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States",
			"https://www.bbc.co.uk/home/five/beta", "https://www.linkedin.com/feed/",
			"https://www.marketwatch.com/story/10-things-britain-does-better-than-america-2016-04-06",
			"http://www.astonmartin.com/en/configure"}
		),
		Set Display Width( 430 )
	),
	Set Label Columns( :Link )
);


f = Function( {a},
	Show( dt );
	If( N Rows( dt << get selected rows ) > 0,
		Web( Char( dt:link[((dt << get selected rows)[1])] ) )
	);
);
rs = dt << make rowstate handler( f );

Graph Builder(
	Size( 522, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :Position ), Y( :where ) ),
	Elements( Points( X, Y, Legend( 6 ) ) )
);

This could also be done by adding a graphics script to the frame box() in the chart.

gb = Graph Builder(
	Size( 522, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :Position ), Y( :where ) ),
	Elements( Points( X, Y, Legend( 6 ) ) )
);

Report( gb )[FrameBox( 1 )] << add graphics script(
	If( N Rows( dt << get selected rows ) > 0,
		Web( Char( dt:link[((dt << get selected rows)[1])] ) )
	)
);
Jim

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Clickable Links in Graph Builder which Opens Website/ Image or Directory

Here is an example script that uses Make Row State Handler to do what you want.  It does not require your  Event Handler, so I remove it.  I can be left in if you want it, but it is not required.

Names Default To Here( 1 );
dt = New Table( "click and Link",
	Add Rows( 5 ),
	New Script(
		"where vs. Position",
		Graph Builder(
			Size( 522, 454 ),
			Show Control Panel( 0 ),
			Variables( X( :Position ), Y( :where ) ),
			Elements( Points( X, Y, Legend( 3 ) ) )
		)
	),
	New Column( "Position",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5] ),
		Set Display Width( 56 )
	),
	New Column( "where",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [5, 4, 3, 2, 1] ),
		Set Display Width( 48 )
	),
	New Column( "Link",
		Character,
		"Nominal",
		Set Selected,
		Set Values(
			{"https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States",
			"https://www.bbc.co.uk/home/five/beta", "https://www.linkedin.com/feed/",
			"https://www.marketwatch.com/story/10-things-britain-does-better-than-america-2016-04-06",
			"http://www.astonmartin.com/en/configure"}
		),
		Set Display Width( 430 )
	),
	Set Label Columns( :Link )
);


f = Function( {a},
	Show( dt );
	If( N Rows( dt << get selected rows ) > 0,
		Web( Char( dt:link[((dt << get selected rows)[1])] ) )
	);
);
rs = dt << make rowstate handler( f );

Graph Builder(
	Size( 522, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :Position ), Y( :where ) ),
	Elements( Points( X, Y, Legend( 6 ) ) )
);

This could also be done by adding a graphics script to the frame box() in the chart.

gb = Graph Builder(
	Size( 522, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :Position ), Y( :where ) ),
	Elements( Points( X, Y, Legend( 6 ) ) )
);

Report( gb )[FrameBox( 1 )] << add graphics script(
	If( N Rows( dt << get selected rows ) > 0,
		Web( Char( dt:link[((dt << get selected rows)[1])] ) )
	)
);
Jim
Valerio
Level II

Re: Clickable Links in Graph Builder which Opens Website/ Image or Directory

Hi txnelson,

 

May I know how to Remove an Event Handler from a column using JSL?

 

Neither

dt:Column_with_EventHandler << Remove Event Handler;

nor

dt:Column_with_EventHandler << Delete Event Handler;

seem to work!

 

Can you help?


Thanks and best regards,
Valerio

txnelson
Super User

Re: Clickable Links in Graph Builder which Opens Website/ Image or Directory

The Event Handler is a Column Property, just like Value Labels, or Spec Limits.  You delete them using

dt:Column)with_EventHandler << delete property("event handler");
Jim
nascif_jmp
Level VI

Re: Clickable Links in Graph Builder which Opens Website/ Image or Directory

Keep an eye out for JMP 15.0 early adopter. Just saying. ;)

d_barnett
Level IV

Re: Clickable Links in Graph Builder which Opens Website/ Image or Directory

really good and I'm looking forward to JMP v15 already.

 

Just one addition to my question. Is there a way that it could not open the links when you click on a row in the data table itself? This could be slightly annoying if I'm still continuing to analyse the data.

 

Otherwise, brilliant solution.

nascif_jmp
Level VI

Re: Clickable Links in Graph Builder which Opens Website/ Image or Directory

Try opening your table in JMP 15.0 and creating a scatter or any other visualization in Graph Builder. 

The value for the "Link" column will show as a hyperlink in the hover label automatically - click on it to launch the corresponding web page.

You also have the option of not having an expression handler in the data table column (to avoid the issue you described) and have the launching behavior only in the Graph Builder hover labels by taking advantage of a new JMP 15 feature called Gridlets. You could even build the URL on-the-fly based on other column values.

 

default_link.jpg

 

For more details, please check https://www.jmp.com/content/dam/jmp/documents/en/support/jmp15/using-jmp.pdf, page 532.