[bokeh] How to enable tooltips for only some glyphs?

Hover does now work for lines.

You would do add_glyph twice:

  1. for all your data that you don’t want to hover and
  2. for the line you do want to hover

add_glyph returns the renderer.

Then, when you make your hovertool, you specify the renderer. Something like this:

p = Plot(**plot_config)

line = Line(**line_config)

hover_on = p.add_glyph(hover_source, line)

hover_off = p.add_glyph(non_hover_source, line)

p.add_tools(HoverTool(tooltips=tooltips, renderers=[hover_on]))

You can see an example of specifying the renderers for tooltips in the examples folder here: https://github.com/bokeh/bokeh/blob/master/examples/glyphs/data_tables.py#L56


On Sun, Aug 2, 2015 at 4:23 PM, wzhd de [email protected] wrote:

For example, I’d like to plot several lines, and enable tooltips for only one of them.
Currently, there doesn’t seem to be a way to do this easily. The only approach I could come up with is to draw other lines as images.

There is an answer on StackOverflow that suggests the same: http://stackoverflow.com/a/29465823/2175968

But this approach has obvious drawbacks.

Is there a better way to do this? Does new features need to be implemented to achieve this? If so, are there any plans?

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/7177c22d-5219-4bd0-96ef-2992bcf36304%40continuum.io.

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