☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Displaying arbitrary HTML using Hovertool

Community Support
vaggi.federico
vaggi.federico

Hi,

Upon a mouse-over event, I’d like to use the hover tool to display arbitrary HTML. Basically, what I"m doing is this:

for idx in plot_df.index:

plot_df.loc[idx, ‘html_str’] = post_peer_review.loc[idx, [col1, col2]].to_html()

and then turning plot_df into a ColumnDataSource, and using the hovertool to display ‘html_str’. This however quotes the html, and does not display it.

Unfortunately, I cannot put the actual html into the hovertool and refer to values in the ColumnSource, because the information is coming from a separate dataframe and contains a variable number of rows. It would of course be possible to put some clever javascript to nicely format a table depending on row numbers, but it would be much nicer to let pandas handle that for me.

Is there a way to get the hovertool to display the html without quoting it?

⌁   Link to post
Sarah_Bird3
Sarah_Bird3

At the moment I don’t believe so.

This is a really good idea though. We would need some kind of safe mark in the tooltips. This would be similar to what is available in many templating languages.

Would you mind opening an issue for this?

···

On Wed, Sep 9, 2015 at 4:46 AM, vaggi.federico@gmail.com wrote:

Hi,

Upon a mouse-over event, I’d like to use the hover tool to display arbitrary HTML. Basically, what I"m doing is this:

for idx in plot_df.index:

plot_df.loc[idx, ‘html_str’] = post_peer_review.loc[idx, [col1, col2]].to_html()

and then turning plot_df into a ColumnDataSource, and using the hovertool to display ‘html_str’. This however quotes the html, and does not display it.

Unfortunately, I cannot put the actual html into the hovertool and refer to values in the ColumnSource, because the information is coming from a separate dataframe and contains a variable number of rows. It would of course be possible to put some clever javascript to nicely format a table depending on row numbers, but it would be much nicer to let pandas handle that for me.

Is there a way to get the hovertool to display the html without quoting it?

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/13103526-f2a7-413b-a39d-b28bf201cb48%40continuum.io.

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

⌁   Link to post

End of archived discussion · Replies are disabled