BookmarkSubscribeRSS Feed
d_barnett

Community Trekker

Joined:

Nov 30, 2011

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
Highlighted
txnelson

Super User

Joined:

Jun 22, 2012

Solution

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
3 REPLIES
Highlighted
txnelson

Super User

Joined:

Jun 22, 2012

Solution

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
nascif_jmp

Staff

Joined:

Jul 30, 2015

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

Community Trekker

Joined:

Nov 30, 2011

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.