Skip to content

Commit

Permalink
Merge 388f3d3 into d23d3bc
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 25, 2017
2 parents d23d3bc + 388f3d3 commit 505625b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions holoviews/plotting/bokeh/renderer.py
Expand Up @@ -17,7 +17,7 @@

from ...core import Store, HoloMap
from ..comms import JupyterComm, Comm
from ..plot import GenericElementPlot
from ..plot import GenericElementPlot, Plot
from ..renderer import Renderer, MIME_TYPES
from .widgets import BokehScrubberWidget, BokehSelectionWidget, BokehServerWidgets
from .util import compute_static_patch, serialize_json, attach_periodic, bokeh_version
Expand Down Expand Up @@ -155,18 +155,23 @@ def show_callback():
return server


def server_doc(self, plot, doc=None):
@bothmethod
def server_doc(self_or_cls, plot, doc=None):
"""
Get server document.
Get a bokeh Document with the plot attached. May supply
an existing doc, otherwise bokeh.io.curdoc() is used to
attach the plot to the global document instance.
"""
if doc is None:
doc = curdoc()
if not isinstance(plot, (Plot, BokehServerWidgets)):
renderer = self_or_cls.instance(mode='server')
plot, _ = renderer._validate(plot, 'auto')
root = plot.state
if isinstance(plot, BokehServerWidgets):
plot = plot.plot
plot.document = doc
plot.traverse(lambda x: attach_periodic(plot),
[GenericElementPlot])
plot.traverse(lambda x: attach_periodic(x), [GenericElementPlot])
doc.add_root(root)
return doc

Expand Down

0 comments on commit 505625b

Please sign in to comment.