ContinuumIO/bokeh — pull request #656 by yerfdogyrag (2014-05-25 02:39:48+00:00)
Title:  Example for referencing links using the hover_tool

OK, I know this isn't ready to go by a mile - that's why didn't make it a PR to start with. To really do this, I would lean towards creating a new tool. Let's call it pointer_tool. It would have the current hover capability in it, plus a few others items:

* User can specify full html for tool-tip box (maybe also allow a graph to be in there?)
* Click/double-click can open a new window, or just link to a new page
* Click/double-click can stuff a value into user clipboard.

The code in this PR relies on the 'magic' field name 'link' to be in the datasource. It's probably better to do what was done in the hover tool and have the link value be pulled in indirectly. Then, then interface would look something like:

pointer = [t for t in curplot().tools if isinstance(t, PointerTool)][0]
pointer.click_action = "link"
pointer.click_data = "@url" # data value depends on action
pointer.double_click_action = "clipboard"
pointer.double_click_data = "@directory"

Actions:

* link (data = url and may be $@value_from_datasource)
* newwindow (same as link, but opens in a new window).
* tooltip (data = same as current hover tooltip - data in tabular form)
* tooltip_html (data = a reference to a datasource item which is assumed to be raw html)
* clipboard (data = reference to datasource to be stuffed into clipboard).

Feel free to tell me this is a bad way to go.

Question: how do y'all test this coffee/javascript stuff

G