def _plot_figure(self, idx, fig_format='json'): """ Returns the figure in html format on the first call and """ self.plot.update(idx) if self.embed or fig_format == 'html' or bokeh_lt_011: return self.renderer.html(self.plot, fig_format) else: doc = self.plot.document if hasattr(doc, 'last_comms_handle'): handle = doc.last_comms_handle else: doc.add_root(self.plot.state) handle = _CommsHandle(get_comms(doc.last_comms_target), doc, doc.to_json()) doc.last_comms_handle = handle to_json = doc.to_json() if handle.doc is not doc: msg = dict(doc=to_json) else: msg = Document._compute_patch_between_json(handle.json, to_json) if isinstance(handle._json, dict): handle._json[doc] = to_json else: handle._json = to_json handle.comms.send(json.dumps(msg))
def _plot_figure(self, idx, fig_format='json'): """ Returns the figure in html format on the first call and """ self.plot.update(idx) if self.embed or fig_format == 'html' or bokeh_lt_011: return self.renderer.html(self.plot, fig_format) else: doc = self.plot.document if hasattr(doc, 'last_comms_handle'): handle = doc.last_comms_handle else: doc.add_root(self.plot.state) handle = _CommsHandle(get_comms(doc.last_comms_target), doc, doc.to_json()) doc.last_comms_handle = handle to_json = doc.to_json() if handle.doc is not doc: msg = dict(doc=to_json) else: msg = Document._compute_patch_between_json(handle.json, to_json) if isinstance(handle._json, dict): handle._json[doc] = to_json else: handle._json = to_json handle.comms.send(json.dumps(msg)) return 'Complete'