Skip to content

Commit

Permalink
Handle individual messages in HoloMap
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Nov 8, 2018
1 parent ad8c0c4 commit 450b5f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 9 additions & 2 deletions holoviews/plotting/bokeh/bokehwidgets.js
Expand Up @@ -15,7 +15,10 @@ BokehScrubberWidget.prototype = Object.create(ScrubberWidget.prototype);
var BokehMethods = {
update_cache : function(){
for (var index in this.frames) {
this.frames[index] = JSON.parse(this.frames[index]);
var data = this.frames[index];
for (var i=0; i<data.content.length; i++) {
data.content[i] = JSON.parse(data.content[i]);
}
}
},
update : function(current){
Expand All @@ -29,7 +32,11 @@ var BokehMethods = {
} else {
var doc = Bokeh.index[data.root].model.document;
}
doc.apply_json_patch(data.content);
for (var i=0; i<data.content.length; i++) {
try {
doc.apply_json_patch(data.content[i]);
} catch(err) { }
}
}
},
init_comms: function() {
Expand Down
7 changes: 3 additions & 4 deletions holoviews/plotting/bokeh/widgets.py
Expand Up @@ -306,10 +306,9 @@ def _plot_figure(self, idx, fig_format='json'):
"""
self.plot.update(idx)
if self.embed:
patch = self.renderer.diff(self.plot, binary=False)
msg = serialize_json(dict(content=patch.content,
root=self.plot.state._id))
return msg
patch = self.renderer.diff(self.plot, binary=False, individual=True)
patches = [serialize_json(p.content) for p in patch]
return {'content': patches, 'root': self.plot.state._id}


class BokehSelectionWidget(BokehWidget, SelectionWidget):
Expand Down

0 comments on commit 450b5f2

Please sign in to comment.