當前位置: 首頁>>代碼示例>>Python>>正文


Python io.curdoc方法代碼示例

本文整理匯總了Python中bokeh.io.curdoc方法的典型用法代碼示例。如果您正苦於以下問題:Python io.curdoc方法的具體用法?Python io.curdoc怎麽用?Python io.curdoc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bokeh.io的用法示例。


在下文中一共展示了io.curdoc方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _bokeh_cb_push_adds

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def _bokeh_cb_push_adds(self, bootstrap_document=None):
        if bootstrap_document is None:
            document = curdoc()
        else:
            document = bootstrap_document

        with self._lock:
            client = self._clients[document.session_context.id]
            updatepkg_df: pandas.DataFrame = self._datastore[self._datastore['index'] > client.last_data_index]

            # skip if we don't have new data
            if updatepkg_df.shape[0] == 0:
                return

            updatepkg = ColumnDataSource.from_df(updatepkg_df)

            client.push_adds(updatepkg, new_last_index=updatepkg_df['index'].iloc[-1]) 
開發者ID:verybadsoldier,項目名稱:backtrader_plotting,代碼行數:19,代碼來源:plotlistener.py

示例2: show_exception_page

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def show_exception_page():
            """ show an error page in case of an unknown/unhandled exception """
            title = 'Internal Error'

            error_message = ('<h3>Internal Server Error</h3>'
                             '<p>Please open an issue on <a '
                             'href="https://github.com/PX4/flight_review/issues" target="_blank">'
                             'https://github.com/PX4/flight_review/issues</a> with a link '
                             'to this log.')
            div = Div(text=error_message, width=int(plot_width*0.9))
            plots = [widgetbox(div, width=int(plot_width*0.9))]
            curdoc().template_variables['internal_error'] = True
            return (title, error_message, plots)


        # check which plots to show 
開發者ID:PX4,項目名稱:flight_review,代碼行數:18,代碼來源:main.py

示例3: app

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def app(self_or_cls, plot, show=False, new_window=False, websocket_origin=None, port=0):
        """
        Creates a bokeh app from a HoloViews object or plot. By
        default simply attaches the plot to bokeh's curdoc and returns
        the Document, if show option is supplied creates an
        Application instance and displays it either in a browser
        window or inline if notebook extension has been loaded.  Using
        the new_window option the app may be displayed in a new
        browser tab once the notebook extension has been loaded.  A
        websocket origin is required when launching from an existing
        tornado server (such as the notebook) and it is not on the
        default port ('localhost:8888').
        """
        if isinstance(plot, HoloViewsPane):
            pane = plot
        else:
            pane = HoloViewsPane(plot, backend=self_or_cls.backend, renderer=self_or_cls,
                                 **self_or_cls._widget_kwargs())
        if new_window:
            return pane._get_server(port, websocket_origin, show=show)
        else:
            kwargs = {'notebook_url': websocket_origin} if websocket_origin else {}
            return pane.app(port=port, **kwargs) 
開發者ID:holoviz,項目名稱:holoviews,代碼行數:25,代碼來源:renderer.py

示例4: get_root

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def get_root(self, doc=None, comm=None):
        """
        Returns the root model and applies pre-processing hooks

        Arguments
        ---------
        doc: bokeh.Document
          Bokeh document the bokeh model will be attached to.
        comm: pyviz_comms.Comm
          Optional pyviz_comms when working in notebook

        Returns
        -------
        Returns the bokeh model corresponding to this panel object
        """
        doc = doc or _curdoc()
        root = self.layout.get_root(doc, comm)
        ref = root.ref['id']
        self._models[ref] = (root, None)
        state._views[ref] = (self, root, doc, comm)
        return root 
開發者ID:holoviz,項目名稱:panel,代碼行數:23,代碼來源:param.py

示例5: get_root

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def get_root(self, doc=None, comm=None):
        """
        Returns the root model and applies pre-processing hooks

        Arguments
        ---------
        doc: bokeh.Document
          Bokeh document the bokeh model will be attached to.
        comm: pyviz_comms.Comm
          Optional pyviz_comms when working in notebook

        Returns
        -------
        Returns the bokeh model corresponding to this panel object
        """
        doc = doc or _curdoc()
        if self._updates:
            root = self._get_model(doc, comm=comm)
        else:
            root = self.layout._get_model(doc, comm=comm)
        self._preprocess(root)
        ref = root.ref['id']
        state._views[ref] = (self, root, doc, comm)
        return root 
開發者ID:holoviz,項目名稱:panel,代碼行數:26,代碼來源:base.py

示例6: theme

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def theme(name):
    """Set color theme.

    :param name: name of theme

    >>> import arlpy.plot
    >>> arlpy.plot.theme('dark')
    """
    if name == 'dark':
        name = 'dark_minimal'
        set_colors(dark_palette)
    elif name == 'light':
        name = 'light_minimal'
        set_colors(light_palette)
    _bio.curdoc().theme = name 
開發者ID:org-arl,項目名稱:arlpy,代碼行數:17,代碼來源:plot.py

示例7: _on_select_group

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def _on_select_group(self, a, old, new):
        _logger.info(f"Switching logic group to {new}...")
        self._current_group = new
        doc = curdoc()
        doc.hold()
        self._refreshmodel()
        doc.unhold()

        self._push_data_fnc(doc)

        _logger.info(f"Switching logic group finished") 
開發者ID:verybadsoldier,項目名稱:backtrader_plotting,代碼行數:13,代碼來源:liveclient.py

示例8: _bokeh_cb_push_patches

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def _bokeh_cb_push_patches(self):
        document = curdoc()
        session_id = document.session_context.id
        with self._lock:
            client: LiveClient = self._clients[session_id]

            patch_pkgs = self._patch_pkgs[session_id]
            self._patch_pkgs[session_id] = []
            client.push_patches(patch_pkgs) 
開發者ID:verybadsoldier,項目名稱:backtrader_plotting,代碼行數:11,代碼來源:plotlistener.py

示例9: animate

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def animate():
    if button.label == ' Play':
        button.label = ' Pause'
        curdoc().add_periodic_callback(animate_update, 10)
    else:
        button.label = ' Play'
        curdoc().remove_periodic_callback(animate_update) 
開發者ID:jhu-lcsr,項目名稱:costar_plan,代碼行數:9,代碼來源:stack_player.py

示例10: plan_update_data

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def plan_update_data(self):
        doc = curdoc()
        if self._update_complete == True:
            self._update_complete = False
            self._ntcb = doc.add_next_tick_callback(self.update_data) 
開發者ID:ChristianTremblay,項目名稱:BAC0,代碼行數:7,代碼來源:BokehRenderer.py

示例11: stop_update_data

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def stop_update_data(self):
        doc = curdoc()
        try:
            doc.remove_periodic_callback(self._pcb)
        except:
            pass
        if self._recurring_update.is_running:
            self._recurring_update.stop()
            while self._recurring_update.is_running:
                pass
        try:
            doc.remove_next_tick_callback(self._ntcb)
        except (ValueError, RuntimeError):
            pass  # Already gone 
開發者ID:ChristianTremblay,項目名稱:BAC0,代碼行數:16,代碼來源:BokehRenderer.py

示例12: update_data

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def update_data(self):
        controller = self.network.notes[0]
        notes_df = pd.DataFrame(self.network.notes[1]).reset_index()
        notes_df.columns = ["index", "notes"]
        notes = ColumnDataSource(notes_df)
        self.data_table.source.data.update(notes.data)
        curdoc().title = "Notes for {}".format(controller) 
開發者ID:ChristianTremblay,項目名稱:BAC0,代碼行數:9,代碼來源:BokehRenderer.py

示例13: server_doc

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def server_doc(self_or_cls, obj, doc=None):
        """
        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 not isinstance(obj, HoloViewsPane):
            obj = HoloViewsPane(obj, renderer=self_or_cls, backend=self_or_cls.backend,
                                **self_or_cls._widget_kwargs())
        return obj.layout.server_doc(doc) 
開發者ID:holoviz,項目名稱:holoviews,代碼行數:12,代碼來源:renderer.py

示例14: get_plot

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def get_plot(self_or_cls, obj, doc=None, renderer=None, **kwargs):
        """
        Given a HoloViews Viewable return a corresponding plot instance.
        Allows supplying a document attach the plot to, useful when
        combining the bokeh model with another plot.
        """
        plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
        if plot.document is None:
            plot.document = Document() if self_or_cls.notebook_context else curdoc()
        plot.document.theme = self_or_cls.theme
        return plot 
開發者ID:holoviz,項目名稱:holoviews,代碼行數:13,代碼來源:renderer.py

示例15: tearDown

# 需要導入模塊: from bokeh import io [as 別名]
# 或者: from bokeh.io import curdoc [as 別名]
def tearDown(self):
        Store.current_backend = self.previous_backend
        bokeh_renderer.last_plot = None
        Callback._callbacks = {}
        with param.logging_level('ERROR'):
            Renderer.notebook_context = self.nbcontext
        state.curdoc = None
        curdoc().clear()
        time.sleep(1) 
開發者ID:holoviz,項目名稱:holoviews,代碼行數:11,代碼來源:testserver.py


注:本文中的bokeh.io.curdoc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。