当前位置: 首页>>代码示例>>Python>>正文


Python widgets.Panel方法代码示例

本文整理汇总了Python中bokeh.models.widgets.Panel方法的典型用法代码示例。如果您正苦于以下问题:Python widgets.Panel方法的具体用法?Python widgets.Panel怎么用?Python widgets.Panel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bokeh.models.widgets的用法示例。


在下文中一共展示了widgets.Panel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_model

# 需要导入模块: from bokeh.models import widgets [as 别名]
# 或者: from bokeh.models.widgets import Panel [as 别名]
def generate_model(self, figurepage_idx: int = 0) -> Model:
        """Returns a model generated from internal blueprints"""
        if figurepage_idx >= len(self.figurepages):
            raise RuntimeError(f'Cannot generate model for FigurePage with index {figurepage_idx} as there are only {len(self.figurepages)}.')

        figurepage = self.figurepages[figurepage_idx]
        if not self._is_optreturn:
            tabs = self.generate_model_tabs(figurepage)
        else:
            tabs = []

        # now append analyzer tab(s)
        analyzers = figurepage.analyzers
        panel_analyzer = self.get_analyzer_panel(analyzers)
        if panel_analyzer is not None:
            tabs.append(panel_analyzer)

        # append meta tab
        if not self._is_optreturn:
            assert figurepage.strategy is not None
            meta = Div(text=metadata.get_metadata_div(figurepage.strategy))
            metapanel = Panel(child=meta, title="Meta")
            tabs.append(metapanel)

        model = Tabs(tabs=tabs)

        # attach the model to the underlying figure for later reference (e.g. unit test)
        figurepage.model = model

        return model 
开发者ID:verybadsoldier,项目名称:backtrader_plotting,代码行数:32,代码来源:bokeh.py

示例2: _get_nodata_panel

# 需要导入模块: from bokeh.models import widgets [as 别名]
# 或者: from bokeh.models.widgets import Panel [as 别名]
def _get_nodata_panel(self):
        chart_grid = gridplot([], toolbar_location=self.p.scheme.toolbar_location, toolbar_options={'logo': None})
        return Panel(child=chart_grid, title="No Data") 
开发者ID:verybadsoldier,项目名称:backtrader_plotting,代码行数:5,代码来源:bokeh.py

示例3: get_analyzer_panel

# 需要导入模块: from bokeh.models import widgets [as 别名]
# 或者: from bokeh.models.widgets import Panel [as 别名]
def get_analyzer_panel(self, analyzers: List[bt.Analyzer]) -> Optional[Panel]:
        if len(analyzers) == 0:
            return None

        table_width = int(self.p.scheme.analyzer_tab_width / self.p.scheme.analyzer_tab_num_cols)

        acolumns = []
        for analyzer in analyzers:
            table_header, elements = self._tablegen.get_analyzers_tables(analyzer, table_width)

            acolumns.append(column([table_header] + elements))

        childs = gridplot(acolumns, ncols=self.p.scheme.analyzer_tab_num_cols, toolbar_options={'logo': None})
        return Panel(child=childs, title='Analyzers') 
开发者ID:verybadsoldier,项目名称:backtrader_plotting,代码行数:16,代码来源:bokeh.py

示例4: __init__

# 需要导入模块: from bokeh.models import widgets [as 别名]
# 或者: from bokeh.models.widgets import Panel [as 别名]
def __init__(self, doc: Document, push_fnc, bokeh_fac: callable, push_data_fnc:callable, strategy: bt.Strategy, figurepage_idx: int = 0, lookback: int = 20):
        self._slider_aspectratio = None
        self._push_data_fnc = push_data_fnc
        self._push_fnc = push_fnc
        self._figurepage_idx = figurepage_idx
        self.last_data_index = -1
        self._lookback = lookback
        self._strategy = strategy
        self._current_group = None
        self.document = doc

        self._bokeh_fac = bokeh_fac
        self._bokeh = None

        bokeh = self._bokeh_fac()  # temporary bokeh object to get tradingdomains and scheme
        self._scheme = copy(bokeh.p.scheme)  # preserve original scheme as originally provided by the user

        tradingdomains = bokeh.list_tradingdomains(strategy)
        self._current_group = tradingdomains[0]
        self._select_tradingdomain = Select(value=self._current_group, options=tradingdomains)
        self._select_tradingdomain.on_change('value', self._on_select_group)

        btn_refresh_analyzers = Button(label='Refresh Analyzers', width=100)
        btn_refresh_analyzers.on_click(self._on_click_refresh_analyzers)

        td_label = Div(text="Trading Domain:", margin=(9, 5, 15, 5))
        controls = row(children=[td_label, self._select_tradingdomain, btn_refresh_analyzers])
        self.model = column(children=[controls, Tabs(tabs=[])], sizing_mode=self._scheme.plot_sizing_mode)

        # append meta tab
        meta = Div(text=metadata.get_metadata_div(strategy))
        self._panel_metadata = Panel(child=meta, title="Meta")

        self._refreshmodel() 
开发者ID:verybadsoldier,项目名称:backtrader_plotting,代码行数:36,代码来源:liveclient.py

示例5: plot_hail_hist_both

# 需要导入模块: from bokeh.models import widgets [as 别名]
# 或者: from bokeh.models.widgets import Panel [as 别名]
def plot_hail_hist_both(
    hist_data: hl.Struct, title: str, normalize: bool = True, log: bool = False
):
    p1 = plot_hail_hist(hist_data, title, log)
    p2 = plot_hail_hist_cumulative(
        hist_data, f"{title} (Cumulative)", normalize, log=log
    )
    return Tabs(
        tabs=[Panel(child=p1, title="Raw"), Panel(child=p2, title="Cumulative")]
    ) 
开发者ID:broadinstitute,项目名称:gnomad_methods,代码行数:12,代码来源:plotting.py

示例6: linear_and_log_tabs

# 需要导入模块: from bokeh.models import widgets [as 别名]
# 或者: from bokeh.models.widgets import Panel [as 别名]
def linear_and_log_tabs(plot_func: Callable, **kwargs) -> Tabs:
    panels = []
    for axis_type in ["linear", "log"]:
        fig = plot_func(**kwargs, axis_type=axis_type)
        panel = Panel(child=fig, title=axis_type)
        panels.append(panel)

    return Tabs(tabs=panels) 
开发者ID:broadinstitute,项目名称:gnomad_methods,代码行数:10,代码来源:plotting.py

示例7: generate_model_tabs

# 需要导入模块: from bokeh.models import widgets [as 别名]
# 或者: from bokeh.models.widgets import Panel [as 别名]
def generate_model_tabs(self, fp: FigurePage, tradingdomain=None) -> List[Panel]:
        observers = [x for x in fp.figure_envs if isinstance(x.master, bt.Observer)]
        datas = [x for x in fp.figure_envs if isinstance(x.master, bt.DataBase)]
        inds = [x for x in fp.figure_envs if isinstance(x.master, bt.Indicator)]

        # now assign figures to tabs
        # 1. assign default tabs if no manual tab is assigned
        for figure in [x for x in datas if x.plottab is None]:
            figure.plottab = 'Plots' if self.is_tabs_single else 'Datas'

        for figure in [x for x in inds if x.plottab is None]:
            figure.plottab = 'Plots' if self.is_tabs_single else 'Indicators'

        for figure in [x for x in observers if x.plottab is None]:
            figure.plottab = 'Plots' if self.is_tabs_single else 'Observers'

        # 2. group panels by desired tabs
        # groupby expects the groups to be sorted or else will produce duplicated groups
        sorted_figs = list(itertools.chain(datas, inds, observers))

        # 3. filter tradingdomains
        if tradingdomain is not None:
            filtered = []
            for f in sorted_figs:
                lgs = f.get_tradingdomains()
                for lg in lgs:
                    if lg is True or lg == tradingdomain:
                        filtered.append(f)
            sorted_figs = filtered

        sorted_figs.sort(key=lambda x: x.plottab)
        tabgroups = itertools.groupby(sorted_figs, lambda x: x.plottab)

        panels = []

        def build_panel(objects, panel_title):
            if len(objects) == 0:
                return

            Bokeh._sort_plotobjects(objects)

            g = gridplot([[x.figure] for x in objects],
                         toolbar_options={'logo': None},
                         toolbar_location=self.p.scheme.toolbar_location,
                         sizing_mode=self.p.scheme.plot_sizing_mode,
                         )
            panels.append(Panel(title=panel_title, child=g))

        for tabname, figures in tabgroups:
            build_panel(list(figures), tabname)

        return panels
    # endregion 
开发者ID:verybadsoldier,项目名称:backtrader_plotting,代码行数:55,代码来源:bokeh.py


注:本文中的bokeh.models.widgets.Panel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。