Open link on click

I apologize if I’m missing something easy here, but I’d like to make a plot (currently in ipython notebook) which opens a specific url when you click on a point. I’m already using the HoverTool to show more information on the particular data point; I just want a mouse click to do a little more.

It doesn’t seem like HoverTool (given the name) is quite the right place to do this, but I’d really like something like:

hover = [t for t in curplot().tools if isinstance(t, HoverTool)][0]

hover.tooltips =

hover.on_click_url =

Even more ideally:

hover.on_click_clipboard =

Any thoughts?

Thanks,

Gary Godfrey

Austin, TX

1 Like

Hi Gary,

You are correct that the hover tool is not the best place for this. For one thing the mouse is never actually over the tooltip, so a link there could never be clicked. I don’t think there is any capability in Bokeh currently that would facilitate this. Can you add a GitHub issue for requesting this feature? Then we can discuss it more and figure out where on the short term roadmap it might fit.

Thanks,

···

--
Bryan Van de Ven
Continuum Analytics

On May 22, 2014 at 7:46:05 PM, Gary Godfrey ([email protected]) wrote:

I apologize if I'm missing something easy here, but I'd like to make a plot
(currently in ipython notebook) which opens a specific url when you click
on a point. I'm already using the HoverTool to show more information on
the particular data point; I just want a mouse click to do a little more.

It doesn't seem like HoverTool (given the name) is quite the right place to
do this, but I'd really like something like:

hover = [t for t in curplot().tools if isinstance(t, HoverTool)][0]
hover.tooltips =
hover.on_click_url =

Even more ideally:

hover.on_click_clipboard = > on this point>

Any thoughts?

Thanks,
Gary Godfrey
Austin, TX

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion
- Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/88d182e1-33d1-472b-abab-36947d4fb370%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Bryan,

Thanks - I opened up the bug. But I’m not sure why hover tool wouldn’t basically do it - the mouse is over the object that has the link. I played with it a little and got something working ( https://github.com/yerfdogyrag/bokeh/tree/hover_link_sample ). Wow - Javascript isn’t what it was 10 years ago :-).

It’s pretty much changing the mousemove to click and pulling a url.

Regards,

Gary Godfrey

Austin, TX

···

On Friday, May 23, 2014 10:57:18 AM UTC-5, Bryan Van de ven wrote:

Hi Gary,

You are correct that the hover tool is not the best place for this. For one thing the mouse is never actually over the tooltip, so a link there could never be clicked. I don’t think there is any capability in Bokeh currently that would facilitate this. Can you add a GitHub issue for requesting this feature? Then we can discuss it more and figure out where on the short term roadmap it might fit.

Thanks,

Bryan Van de Ven

Continuum Analytics

On May 22, 2014 at 7:46:05 PM, Gary Godfrey ([email protected]) wrote:

I apologize if I’m missing something easy here, but I’d like to make a plot

(currently in ipython notebook) which opens a specific url when you click

on a point. I’m already using the HoverTool to show more information on

the particular data point; I just want a mouse click to do a little more.

It doesn’t seem like HoverTool (given the name) is quite the right place to

do this, but I’d really like something like:

hover = [t for t in curplot().tools if isinstance(t, HoverTool)][0]

hover.tooltips =

hover.on_click_url =

Even more ideally:

hover.on_click_clipboard = > on this point>

Any thoughts?

Thanks,

Gary Godfrey

Austin, TX

You received this message because you are subscribed to the Google Groups "Bokeh Discussion

  • Public" group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/88d182e1-33d1-472b-abab-36947d4fb370%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Wow - Javascript isn’t what it was 10 years ago :-).

Thanks Gary for open the issue, btw… you are writing Coffeescript instead of Javascript, maybe this is why you see it so different :wink:

···

On Sat, May 24, 2014 at 12:17 PM, Gary Godfrey [email protected] wrote:

Bryan,

Thanks - I opened up the bug. But I’m not sure why hover tool wouldn’t basically do it - the mouse is over the object that has the link. I played with it a little and got something working ( https://github.com/yerfdogyrag/bokeh/tree/hover_link_sample ). Wow - Javascript isn’t what it was 10 years ago :-).

It’s pretty much changing the mousemove to click and pulling a url.

https://github.com/ContinuumIO/bokeh/issues/653

Regards,

Gary Godfrey

Austin, TX

On Friday, May 23, 2014 10:57:18 AM UTC-5, Bryan Van de ven wrote:

Hi Gary,

You are correct that the hover tool is not the best place for this. For one thing the mouse is never actually over the tooltip, so a link there could never be clicked. I don’t think there is any capability in Bokeh currently that would facilitate this. Can you add a GitHub issue for requesting this feature? Then we can discuss it more and figure out where on the short term roadmap it might fit.

Thanks,

Bryan Van de Ven

Continuum Analytics

On May 22, 2014 at 7:46:05 PM, Gary Godfrey ([email protected]) wrote:

I apologize if I’m missing something easy here, but I’d like to make a plot

(currently in ipython notebook) which opens a specific url when you click

on a point. I’m already using the HoverTool to show more information on

the particular data point; I just want a mouse click to do a little more.

It doesn’t seem like HoverTool (given the name) is quite the right place to

do this, but I’d really like something like:

hover = [t for t in curplot().tools if isinstance(t, HoverTool)][0]

hover.tooltips =

hover.on_click_url =

Even more ideally:

hover.on_click_clipboard = > on this point>

Any thoughts?

Thanks,

Gary Godfrey

Austin, TX

You received this message because you are subscribed to the Google Groups "Bokeh Discussion

  • Public" group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/88d182e1-33d1-472b-abab-36947d4fb370%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/85b8066f-8716-4c53-9e92-da5fbff25c7d%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Gary,

I had misunderstood, I thought you wanted a clickable link in the hover tooltip (which the mouse is never over, only adjacent to). If you'd like to work this up as a PR we can definitely see about getting it included. It might make sense to have it as a separate "click tool" that can be configured with an action (like opening a link) on the click. Let us know what you think, and thanks for tying out Bokeh!

Bryan

···

On May 24, 2014, at 10:17 AM, Gary Godfrey <[email protected]> wrote:

Bryan,

Thanks - I opened up the bug. But I'm not sure why hover tool wouldn't basically do it - the mouse is over the object that has the link. I played with it a little and got something working ( https://github.com/yerfdogyrag/bokeh/tree/hover_link_sample ). Wow - Javascript isn't what it was 10 years ago :-).

It's pretty much changing the mousemove to click and pulling a url.

Allow click on graph to follow link · Issue #653 · bokeh/bokeh · GitHub

Regards,
Gary Godfrey
Austin, TX

On Friday, May 23, 2014 10:57:18 AM UTC-5, Bryan Van de ven wrote:
Hi Gary,

You are correct that the hover tool is not the best place for this. For one thing the mouse is never actually over the tooltip, so a link there could never be clicked. I don’t think there is any capability in Bokeh currently that would facilitate this. Can you add a GitHub issue for requesting this feature? Then we can discuss it more and figure out where on the short term roadmap it might fit.

Thanks,

--
Bryan Van de Ven
Continuum Analytics

On May 22, 2014 at 7:46:05 PM, Gary Godfrey (g.g...@wamp.us) wrote:
> I apologize if I'm missing something easy here, but I'd like to make a plot
> (currently in ipython notebook) which opens a specific url when you click
> on a point. I'm already using the HoverTool to show more information on
> the particular data point; I just want a mouse click to do a little more.
>
> It doesn't seem like HoverTool (given the name) is quite the right place to
> do this, but I'd really like something like:
>
> hover = [t for t in curplot().tools if isinstance(t, HoverTool)][0]
> hover.tooltips =
> hover.on_click_url =
>
> Even more ideally:
>
> hover.on_click_clipboard = > on this point>
>
> Any thoughts?
>
> Thanks,
> Gary Godfrey
> Austin, TX
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion
> - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/88d182e1-33d1-472b-abab-36947d4fb370%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/85b8066f-8716-4c53-9e92-da5fbff25c7d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi, did you end up implementing this feature?

There is JavaScript callbacks — Bokeh 2.4.2 Documentation

However, just calling window.open yourself from any selection CustomJS callback is probably better.

There’s no need for a specific class just for this given that it’s JS one-liner in any CustomJS callback, so we may very well deprecate and remove OpenURL in the future.

1 Like