Esempio n. 1
0
 def figure_data(self, plot, fmt="html", **kwargs):
     if not old_bokeh:
         doc = Document()
         doc.add_root(plot.state)
         plot.set_root(plot.state)
         plot.set_document(doc)
     return notebook_div(plot.state)
Esempio n. 2
0
 def figure_data(self, plot, fmt='html', **kwargs):
     if not old_bokeh:
         doc = Document()
         doc.add_root(plot.state)
         plot.set_root(plot.state)
         plot.set_document(doc)
     return notebook_div(plot.state)
Esempio n. 3
0
 def figure_data(self, plot, fmt='html', **kwargs):
     if not bokeh_lt_011:
         doc = Document()
         doc.add_root(plot.state)
         comms_target = str(uuid.uuid4())
         doc.last_comms_target = comms_target
         div = notebook_div(plot.state, comms_target)
         return div
     else:
         return notebook_div(plot.state)
Esempio n. 4
0
    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))
Esempio n. 5
0
    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'