Python bokeh.models.widgets.Select() Examples
The following are 4
code examples of bokeh.models.widgets.Select().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bokeh.models.widgets
, or try the search function
.
Example #1
Source File: liveclient.py From backtrader_plotting with GNU General Public License v3.0 | 5 votes |
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()
Example #2
Source File: layout.py From pairstrade-fyp-2019 with MIT License | 5 votes |
def build_widgets_wb(stock_list): # CODE SECTION: setup widgets, widgetbox name = controls_wb WIDGET_WIDTH = 250 # ========== Select Stocks ============= # select_stk_1 = Select(width = WIDGET_WIDTH, title='Select Stock 1:', value = stock_list[0], options=stock_list) select_stk_2 = Select(width = WIDGET_WIDTH, title='Select Stock 2:', value = stock_list[0], options=stock_list) # ========== Strategy Type ============= # strategy_list = ['kalman', 'distance', 'cointegration'] select_strategy = Select(width = WIDGET_WIDTH, title='Select Strategy:', value = strategy_list[0], options=strategy_list) # ========== set start/end date ============= # # date time variables MAX_START = date(2014, 1, 1) MAX_END = date(2018, 12, 30) DEFAULT_START = date(2016, 5, 1) DEFAULT_END = date(2016, 12, 31) STEP = 1 backtest_dates = DateRangeSlider(width = WIDGET_WIDTH, start=MAX_START, end=MAX_END, value=(DEFAULT_START, DEFAULT_END), step=STEP, title="Backtest Date Range:") start_bt = Button(label="Backtest", button_type="success", width = WIDGET_WIDTH) # controls = column(select_stk_1, select_stk_2, select_strategy, backtest_dates, start_bt) controls_wb = widgetbox(select_stk_1, select_stk_2, select_strategy, backtest_dates, start_bt, width=600) return controls_wb
Example #3
Source File: client_demo.py From pairstrade-fyp-2019 with MIT License | 5 votes |
def build_widgets_wb(stock_list, metrics): # CODE SECTION: setup buttons, widgetbox name = controls_wb WIDGET_WIDTH = 250 # ========== Select Stocks ============= # select_stk_1 = Select(width = WIDGET_WIDTH, title='Select Stock 1:', value = backtest_params["stk_0"], options=stock_list) select_stk_2 = Select(width = WIDGET_WIDTH, title='Select Stock 2:', value = backtest_params["stk_1"], options=stock_list) # ========== Strategy Type ============= # strategy_list = ['kalman', 'distance', 'cointegration', 'reinforcement learning'] select_strategy = Select(width = WIDGET_WIDTH, title='Select Strategy:', value = backtest_params["strategy_type"], options=strategy_list) # ========== set start/end date ============= # # date time variables MAX_START = datetime.strptime(backtest_params["max_start"], "%Y-%m-%d").date() MAX_END = datetime.strptime(backtest_params["max_end"], "%Y-%m-%d").date() DEFAULT_START = datetime.strptime(backtest_params["backtest_start"], "%Y-%m-%d").date() DEFAULT_END = datetime.strptime(backtest_params["backtest_end"], "%Y-%m-%d").date() STEP = 1 backtest_dates = DateRangeSlider(width = WIDGET_WIDTH, start=MAX_START, end=MAX_END, value=(DEFAULT_START, DEFAULT_END), step=STEP, title="Backtest Date Range:") start_bt = Button(label="Backtest", button_type="success", width = WIDGET_WIDTH) # controls = column(select_stk_1, select_stk_2, select_strategy, backtest_dates, start_bt) controls_wb = widgetbox(select_stk_1, select_stk_2, select_strategy, backtest_dates, start_bt, width=300) # CODE SECTION: setup table, widgetbox name = metrics_wb master_wb = None if metrics is not None: metric_source = ColumnDataSource(metrics) metric_columns = [ TableColumn(field="Metrics", title="Metrics"), TableColumn(field="Value", title="Performance"), ] metric_table = DataTable(source=metric_source, columns=metric_columns, width=300) master_wb = row(controls_wb, widgetbox(metric_table)) else: logging.info("creating controls without table") master_wb = row(controls_wb) return master_wb, select_stk_1, select_stk_2, select_strategy, backtest_dates, start_bt
Example #4
Source File: NeoPredViz.py From NeoPredPipe with GNU Lesser General Public License v3.0 | 5 votes |
def ChordDiagram(self): # Step 1 Get Data self.sharedNeos = self.GetShared() self.matchedNeos = self.GetMatchedNeos() hv.output(size=200) source = [] target = [] value = [] for i,sam in enumerate(self.sharedNeos): for pair in self.sharedNeos[sam]: source.append( sam+"_"+pair.split(',')[0] ) target.append( sam+"_"+pair.split(',')[1] ) value.append(self.sharedNeos[sam][pair]) for matched in self.matchedNeos: source.append(matched.split(',')[0]) target.append(matched.split(',')[1]) value.append(self.matchedNeos[matched]) links = pd.DataFrame({ 'source': source,'target': target,'value': value }) chord = hv.Chord(links) # chord = hv.Chord((links, nodes)).select(value=(5, None)) chord.opts( opts.Chord(cmap='Category20', edge_cmap='Category20', labels='index', node_color=dim('index').str())) p = hv.render(chord) select = Select(title="Option:", value="foo", options=["foo", "bar", "baz", "quux"]) return(p, select)