You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it doesn't look like Table and TablePlot are wired to use finalize_hooks. Using them would allow things like wiring HTMLTemplateFormatter for cells. The below is a way to do this without modifying HoloViews, and so the feature would be to incorporate the few lines of wiring into TablePlot instead of overriding here.
from holoviews.plotting.bokeh.tabular import TablePlot
from holoviews.element.tabular import Table
class TableWithHooks(Table):
pass
class TableWithHooksPlot(TablePlot):
finalize_hooks = param.HookList(default=[])
def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
super(TableWithHooksPlot, self).initialize_plot(ranges, plot, plots, source)
self._execute_hooks(self.hmap.last)
def _execute_hooks(self, element):
for hook in self.finalize_hooks:
try:
hook(self, element)
except Exception as e:
self.warning("Plotting hook %r could not be applied:\n\n %s" % (hook, e))
hv.Store.register({TableWithHooks: TableWithHooksPlot}, 'bokeh')
name = ['homepage', 'github']
link = ['http://holoviews.org', 'https://github.com/ioam/holoviews']
table = TableWithHooks({'Name':name, 'Link':link}, vdims = ['Name', 'Link'], kdims=[])
from bokeh.models import HTMLTemplateFormatter
def apply_format(plot, element):
plot.handles['plot'].columns[1].formatter=HTMLTemplateFormatter(template='<a href="<%= value %>"><%= value %></a>')
table.opts(plot=dict(finalize_hooks=[apply_format]))
The text was updated successfully, but these errors were encountered:
* #1708
* Minor tweak to notebook
* add additional URL
* committing mostly to test failing Travis build
* move file to new directory per @jlstevens suggestion
Currently, it doesn't look like
Table
andTablePlot
are wired to usefinalize_hooks
. Using them would allow things like wiringHTMLTemplateFormatter
for cells. The below is a way to do this without modifying HoloViews, and so the feature would be to incorporate the few lines of wiring intoTablePlot
instead of overriding here.The text was updated successfully, but these errors were encountered: