New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hv.HTML Element? #2221

Closed
jbednar opened this Issue Dec 20, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@jbednar
Member

jbednar commented Dec 20, 2017

Linked streams in HoloViews make it feasible to make richly linked interactive apps, where hovering or clicking in one plot can control which information is shown in other plots. E.g. the Tap example shows how a click on a heatmap can open an associated curve, and the LandSat example shows how to do the same by just hovering. This functionality is really powerful, but it's limited by the scope of what can be contained in a HoloViews element, and so what can be linked right now are just plots and tables.

It could be very useful to be able to bring up arbitrary HTML information, if we add an HV element that can accept arbitrary HTML-renderable content as its .data. Such content might include a textual description of a selected data point, a news article about that item, some web page links associated with it, and so on -- anything that can be put into a <div> and displayed along with the main plot.

Bokeh should be able to handle arbitrary HTML like this, but the matplotlib renderer would not have an HTML parser, in which case it could possibly show the .data characters as a plot with a text annotation, just to give it some value under mpl as well. It's not ideal, but exploiting the power of HTML for formatting and hyperlinking in the Bokeh case seems to override the goal of having the backends have similar functionality.

@philippjfr philippjfr added the feature label Dec 20, 2017

@jlstevens

This comment has been minimized.

Member

jlstevens commented Dec 20, 2017

I don't think I would ever approve of hv.HTML but I would consider hv.Div given a good set of compelling examples. I would also make hv.Div a Bokeh only element analogous to how matplotlib/plotly have the 3D elements but bokeh does not.

@jbednar

This comment has been minimized.

Member

jbednar commented Dec 20, 2017

What's the difference between hv.Div and hv.HTML, apart from div being more obscure (and slightly inaccurate, in that the data supplied need not be a div (as it will be placed into a div)?

@jlstevens

This comment has been minimized.

Member

jlstevens commented Dec 20, 2017

There is a bokeh Div model and there isn't a bokeh HTML model. In addition, Div is a type of HTML node in the DOM whereas HTML is the markup language itself. We don't want to support HTML headers, body or script tags either.

@philippjfr

This comment has been minimized.

Member

philippjfr commented Dec 21, 2017

@jlstevens

This comment has been minimized.

Member

jlstevens commented Dec 21, 2017

The prototype looks good: a relatively thin wrapper around Bokeh's Div model.

I do think your examples demonstrate the generality of such an element which I consider a curse as much as a blessing. I suppose I would be ok with this as a bokeh-only element although I would hate to see it abused. I just hope our users will use this power in the few sensible ways it can be used as opposed to the uncountably larger number of ways it could be used to give me nightmares!

@philippjfr philippjfr referenced this issue Dec 21, 2017

Merged

Add Div Element #2223

2 of 2 tasks complete
@jbednar

This comment has been minimized.

Member

jbednar commented Dec 21, 2017

@philippjfr, that Div prototype looks fabulous! Showing a dataframe there is an odd coincidence, as I just added that ability to Datashader's Images class as well; it can now handle anything with a _repr_html_() method (not yet pushed to master). That's definitely something I've very often wished for when writing docs -- showing a dataframe easily as a table right next to a plot, and now we'll be able to do it! You might consider checking to see if the .data for a Div is something with such a method (_repr_html_() or to_html()?) and calling that to get the repr, for ease of working with dataframes in practice. It's a very common idiom.

Can you add an example of what would happen for formatted text in general, i.e. something with paragraphs? When it's big, will it get a scroll bar, get crammed into a box, get cut off, or...?

@philippjfr philippjfr added this to the v1.10 milestone Mar 14, 2018

@philippjfr philippjfr self-assigned this Mar 14, 2018

@philippjfr philippjfr closed this Mar 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment