Skip to content

Commit

Permalink
Bokeh protocol improvements (#1896)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and jlstevens committed Sep 20, 2017
1 parent f8bb486 commit 34ebbb6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,12 @@ def _get_colormapper(self, dim, element, ranges, style, factors=None, colors=Non

if 'color_mapper' in self.handles:
cmapper = self.handles['color_mapper']
cmapper.palette = palette
cmapper.update(**opts)
if cmapper.palette != palette:
cmapper.palette = palette
opts = {k: opt for k, opt in opts.items()
if getattr(cmapper, k) != opt}
if opts:
cmapper.update(**opts)
else:
cmapper = colormapper(palette=palette, **opts)
self.handles['color_mapper'] = cmapper
Expand Down
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def push(self):

if bokeh_version > '0.12.9':
msg = self.renderer.diff(self, binary=True)
if msg is None:
return
self.comm.send(msg.header_json)
self.comm.send(msg.metadata_json)
self.comm.send(msg.content_json)
Expand Down
5 changes: 3 additions & 2 deletions holoviews/plotting/bokeh/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ def server_doc(self_or_cls, obj, doc=None):
def figure_data(self, plot, fmt='html', doc=None, **kwargs):
model = plot.state
doc = Document() if doc is None else doc
if bokeh_version > '0.12.9':
doc.hold()
for m in model.references():
m._document = None
doc.add_root(model)
Expand All @@ -227,6 +225,7 @@ def figure_data(self, plot, fmt='html', doc=None, **kwargs):
raise
logger.disabled = False
plot.document = doc
if bokeh_version > '0.12.9': doc.hold()
return div


Expand All @@ -237,6 +236,8 @@ def diff(self, plot, serialize=True, binary=False):
"""
if binary:
events = list(plot.document._held_events)
if not events:
return None
msg = Protocol("1.0").create("PATCH-DOC", events)
plot.document._held_events = []
return msg
Expand Down

0 comments on commit 34ebbb6

Please sign in to comment.