def make_layout(): return dbc.Container( children=[ dbc.Row(className="mt-3", children=dbc.Col(children=html.P(''' Use the search box below to add as many stops as you like to your map. The app will find the fastest route between every pair. '''))), dbc.Row(justify="between", children=[ dbc.Col(width="auto", children=dbc.Checklist( options=[{ "label": "Bus", "value": "bus" }, { "label": "DLR", "value": "dlr" }, { "label": "Overground", "value": "overground" }, { "label": "Tube", "value": "tube" }], value=["bus", "dlr", "overground", "tube"], id="maps-checklist", inline=True)), dbc.Col(width="auto", children=dbc.RadioItems( className="float-right", options=[ { "label": "Schematic", "value": "schematic" }, { "label": "Geographical", "value": "geographical" }, ], value="schematic", id="maps-radioitems-input", inline=True)), ]), dbc.Row(className="mt-3", children=[ dbc.Col(children=dcc.Dropdown( id="maps-dropdown", multi=True, clearable=True, placeholder="Add stops to generate a map...", persistence=True, persistence_type="local")), ]), dbc.Row(className="mt-3", children=dbc.Col(children=html.Div(id="maps-plot"))), dcc.Store(id="maps-store", storage_type="local") ])
def create_shopHour_layout(): analysis_shopHour_layout = [ html.Div([ html.Div([ dbc.Label("Choose a store type"), dbc.FormGroup( dbc.RadioItems( options=[ {"label": 'All', "value": 0}, {"label": 'Off-license (-1)', "value": 1}, {"label": "Discount home goods store (-0.8)", "value": 2}, {"label": 'Convenience store (-0.6)', "value": 3}, {"label": 'Discount supermarket (0.4)', "value": 4}, {"label": 'Small Supermarket (0.8)', "value": 5}, {"label": 'Large/Premium supermarket (1.75)', "value": 6} ], value= 0, id="radio_storeType", inline=True, ) )],style = {'font-size':'small' } ), dcc.Graph(id = 'heatmap_shopHour') ]) ] return analysis_shopHour_layout
def generate_asset_page(asset_code): asset_code = re.sub(r'^([0-9]+)([a-zA-Z]+)$', r'\1.\2', asset_code).upper() layout = html.Div([ dcc.Store(id='asset-code', data=asset_code), html.Div(id='asset-info'), dbc.Checklist( id='show-asset-money', options=[{'label': '显示金额', 'value': 'show'}], value=[], switch=True, ), html.Hr(), dcc.Graph( id='asset-prices-graph', config={ 'displayModeBar': False }, ), html.Center( [ dbc.RadioItems( id="asset-history-range", className='btn-group', labelClassName='btn btn-light border', labelCheckedClassName='active', options=[ {"label": "近一月", "value": "1m"}, {"label": "近三月", "value": "3m"}, {"label": "近半年", "value": "6m"}, {"label": "近一年", "value": "12m"}, {"label": "今年以来", "value": "thisyear"}, {"label": "本月", "value": "thismonth"}, {"label": "本周", "value": "thisweek"}, {"label": "所有", "value": "all"}, {"label": "自定义", "value": "customized"}, ], value="all", ), ], className='radio-group', ), html.Div( id='customized-asset-history-range-container', children=[ dcc.RangeSlider( id='customized-asset-history-range', min=2018, max=2022, step=None, marks={year: str(year) for year in range(2018, 2023)}, value=[2018, 2022], ) ], className='my-auto ml-0 mr-0', style={'max-width': '100%', 'display': 'none'} ), html.Hr(), html.Div(id='asset-deals'), ]) return layout
def card_sn_scores(data) -> dbc.Card: """ Card containing the score evolution Parameters ---------- data: java.util.TreeMap Results from a HBase client query Returns ---------- card: dbc.Card Card with the scores drawn inside """ graph_lc = dcc.Graph(id='lightcurve_scores', style={ 'width': '100%', 'height': '15pc' }, config={'displayModeBar': False}) graph_scores = dcc.Graph(id='scores', figure=draw_scores(data), style={ 'width': '100%', 'height': '15pc' }, config={'displayModeBar': False}) card = dbc.Card(dbc.CardBody([ graph_lc, dbc.Row(dbc.RadioItems(id='switch-mag-flux-score', inline=True), ), html.Br(), graph_scores ]), className="mt-3") return card
def physician_assess_group(label, value_list, value, id): value_list_len = len(value_list) options = [] for i in range(value_list_len): options.append({"label": value_list[i], "value": value[i]}) return html.Div( [ dbc.FormGroup([ dbc.Label(label), dbc.RadioItems( options=options, id={ 'type': 'berg-scale-question-content', 'index': id }, labelStyle={'display': 'block'}, style={"textAlign": "start"}, ), ]) ], id={ 'type': 'container-berg-scale-question-content', 'index': id }, hidden=True, )
def question_group_answer_prior(label, value_list, value, key, answer): value_list_len = len(value_list) options = [] for i in range(value_list_len): options.append({ "label": value_list[i], "value": value[i], "disabled": True }) return html.Div([ dbc.FormGroup([ dbc.Label(label, style={ "padding-top": "10px", "padding-bottom": "10px" }), dbc.RadioItems(options=options, value=answer[key], style={ "font-size": "0.8rem", "padding": "20px", "border-radius": "0.5rem", "background": "#f5f5f5" }), ], style={"padding": "20px"}) ])
def get_publication_type_form_group() -> dbc.FormGroup: return dbc.FormGroup([ dbc.Label('Rodzaj publikacji:', className='lead'), html.Div( [ dbc.RadioItems( className="btn-group", labelClassName="btn btn-primary", labelCheckedClassName="active", options=[ { "label": "czasopisma", "value": 'czasopisma' }, { "label": "konferencje", "value": 'konferencje' }, { "label": "monografie", "value": 'monografie' }, ], value='czasopisma', id="publication-type-input", ), ], className='radio-group', ) ])
def generate_clips(): clips = [] for i, clip in enumerate(sorted(os.listdir(CLIP_FOLDER))): clips.append( dbc.Col([ dbc.Card([ dbc.Row([ dbc.Col(html.Audio(src=f'/assets/unlabeled_data/{clip}', controls=True)) ]), dbc.Row([ dbc.Col(html.P(clip)), dbc.Col(dbc.RadioItems( id={ 'type': 'filter-dropdown', 'index': i }, options=[ {"label": "Correct", "value": True}, {"label": "Wrong", "value": False}, ], labelClassName="date-group-labels", labelCheckedClassName="date-group-labels-checked", className="date-group-items", inline=True, ), align='center') ]) ], color='light') ], width=12) ) if not clips: clips = [dbc.Row(dbc.Col(html.P('Nothing to review!')))] return clips
def parameter_form(name="Parameter Name", elem_id="element-id", options=[], value=True, inline=True, selector_type="radio", min_val=None, max_val=None, suffix="", step=1): # Set the ID as a dict elem_dict = dict(elem_type="input", elem=elem_id) # If the element is the default, set up a radio selector if selector_type == "radio": selector = dbc.RadioItems(options=options, value=value, inline=inline, id=elem_dict) # If the element is a dropdown if selector_type == "dropdown": selector = dcc.Dropdown( options=options, value=value, id=elem_dict, ) # If the element is a slider elif selector_type == "slider": # Mark the middle value mid_val = min_val + ((max_val - min_val) / 2.) selector = dcc.Slider( min=min_val, max=max_val, value=value, marks={ x: f"{x}{suffix}" for x in [ int(min_val) if min_val == int(min_val) else min_val, int(mid_val) if mid_val == int(mid_val) else mid_val, int(max_val) if max_val == int(max_val) else max_val ] }, step=step, id=elem_dict, ) # Format the entire card return dbc.FormGroup( [dbc.Col([ dbc.Label(name), selector, ], className="text-center")])
def get_specific_roof(): table = html.Div([ dbc.Row([ dbc.Col(html.Div([ dbc.InputGroup( [ dbc.InputGroupAddon("Y", addon_type="prepend"), dbc.Input(id='y-slider', type='number', min=0, max=9500, step=500, value=2000), dbc.InputGroupAddon("X", addon_type="prepend"), dbc.Input(id='x-slider', type='number', min=0, max=9500, step=500, value=8000), ], className="mb-3", ), dbc.Checklist( options=[ { "label": "Show detected solar arrays", "value": "show_panels" }, ], value=[], id="map-config", switch=True, ) ]), md=8), dbc.Col( dbc.RadioItems(options=[{ 'label': x, 'value': x } for x in range(2015, 2021)], value=2020, labelStyle={'display': 'idasnline-block'}, inline=True, id='year-choice')) ]), dbc.Row([ dbc.Col(dcc.Graph(id='map', config={'displayModeBar': False}), md=8), dbc.Col(html.Div([ html.Div(id='roof-estimates'), html.Br(), dcc.Graph(id='barchart', config={'displayModeBar': False}) ]), md=4), ]), ]) return table
def card_cutouts(data): """ Add a card containing cutouts Parameters ---------- data: java.util.TreeMap Results from a HBase client query Returns ---------- card: dbc.Card Card with the cutouts drawn inside """ card = dbc.Card(dbc.CardBody([ dbc.Row([ dbc.Col(html.H5(children="Science", className="text-center")), dbc.Col(html.H5(children="Template", className="text-center")), dbc.Col(html.H5(children="Difference", className="text-center")) ]), dbc.Row([ dcc.Graph(id='science-stamps', style={ 'display': 'inline-block', }, config={'displayModeBar': False}), dcc.Graph(id='template-stamps', style={ 'display': 'inline-block', }, config={'displayModeBar': False}), dcc.Graph(id='difference-stamps', style={ 'display': 'inline-block', }, config={'displayModeBar': False}), ], justify='around', no_gutters=True), html.Br(), html.Br(), dcc.Graph(id='lightcurve_cutouts', style={ 'width': '100%', 'height': '15pc' }, config={'displayModeBar': False}), dbc.Row( dbc.RadioItems(options=[{ 'label': k, 'value': k } for k in all_radio_options.keys()], value="Difference magnitude", id="switch-mag-flux", inline=True)) ]), className="mt-3") return card
def render_themes(selected=None): return [ dbc.RadioItems(id="select-theme", options=[{ "label": theme, "value": theme } for theme in THEMES], value=selected) ]
def exporting_subset_radio(): m = dbc.RadioItems(options=[ {"label": "All cells (default)", "value": "all"}, {"label": "Subset of cells", "value": "subset"} ], id="exporting_subset_radio", value="all" ) return m
def generate_health_intervent_children(id_index): children = [html.Div([ html.P(''), dbc.Label(health_intervent_full[id_index], color='secondary'), dbc.Container(dbc.Label(health_intervent_required[id_index], color='secondary', size='sm')), dbc.RadioItems( options = [{'label':y, 'value':x} for x,y in enumerate(health_intervent_option)], id=radio_id_health_intervent[id_index]) ], style={'margin-left':'25px', 'margin-right':'25px', 'margin-bottom':'20px'})] return children
def layout(self): cats_display = 'none' if self.explainer.cats is None else None return dbc.Container([ dbc.Row([dbc.Col([html.H2('Feature Importances:')])]), dbc.Row([ dbc.Col([ dbc.FormGroup( [ dbc.Label("Importances type:"), dbc.RadioItems( options=[ {'label': 'Permutation Importances', 'value': 'permutation'}, {'label': 'SHAP values', 'value': 'shap'} ], value='shap', id='permutation-or-shap', inline=True, ), ] ) ]), dbc.Col([ html.Label('Select max number of importances to display:'), dcc.Dropdown(id='importance-tablesize', options = [{'label': str(i+1), 'value':i+1} for i in range(len(self.explainer.columns_cats))], value=min(self.n_features, len(self.explainer.columns_cats))) ]), dbc.Col([ html.Div([ dbc.Label("Grouping:"), dbc.FormGroup( [ dbc.RadioButton( id='group-categoricals', className="form-check-input", checked=True), dbc.Label("Group Cats", html_for='group-categoricals', className="form-check-label"), ], check=True), ], style=cats_display) ]), ], form=True, justify="between"), dbc.Row([ dbc.Col([ dcc.Loading(id="loading-importances-graph", children=[dcc.Graph(id='importances-graph')]) ]), ]), ], fluid=True)
def display_graphs(n_clicks, dummy, dummy_models, div_children): ctx = dash.callback_context button_id = ctx.triggered[0]["prop_id"].split(".")[0] if button_id == 'dummy-output-models': div_children = [] elif button_id == 'btn_plot' and DATA is not None: new_child = dbc.Col(children=[ dbc.Row([ dbc.Col(dbc.RadioItems( id={ 'type': 'dynamic-choice', 'index': n_clicks }, options=[{ 'label': 'Yield', 'value': 'yield' }, { 'label': 'Purity', 'value': 'purity' }, { 'label': 'Histogram', 'value': 'count' }], value='yield', ), width=2), dbc.Col(dcc.Dropdown( id={ 'type': 'dynamic-dpn-var1', 'index': n_clicks }, options=[{ 'label': var, 'value': var } for var in DATA.columns if var not in ['cut 1', 'cut 2', 'yield', 'purity']], multi=False, value=[], placeholder='Select variable to plot...', clearable=False), width=8) ]), dcc.Graph(id={ 'type': 'dynamic-graph', 'index': n_clicks }, figure={}) ], width=4) div_children.append(new_child) return div_children
def single_gene_expression_radio(): m = dbc.RadioItems(id="single_gene_expression_radio", options=[{ 'label': 'standard', 'value': 'standard' }, { 'label': 'mixed', 'value': 'mixed' }], value='standard') return m
def neighbors_method_radio(): m = dbc.RadioItems(id="neighbors_method_radio", options=[{ 'label': 'standard', 'value': 'standard' }, { 'label': 'batch-corrected (bbknn)', 'value': 'bbknn' }], value='standard') return m
def n_dims_processing_radio(): m = dbc.RadioItems(id="n_dims_processing_radio", options=[{ 'label': '2D ', 'value': 2 }, { 'label': '3D ', 'value': 3 }], value=2) return m
def n_dims_proj_expression_radio(): m = dbc.RadioItems(id="n_dims_proj_expression_radio", options=[{ 'label': '2D ', 'value': 2 }, { 'label': '3D ', 'value': 3 }], value=2, inline=True) return m
def create_x_stream_radiogroup(opts, value=None): value = value or opts[0] return dbc.FormGroup([ dbc.Label('Select x-axis stream:'), dbc.RadioItems( options=[{'label': x, 'value': x} for x in opts], value=value, id='x-selector', inline=True ), ])
def layout(self): return html.Div([ dbc.Row( [make_hideable(html.H3("Residuals"), hide=self.hide_title)]), dbc.Row([ dbc.Col([ dcc.Graph(id='residuals-graph-' + self.name, config=dict(modeBarButtons=[['toImage']], displaylogo=False)), ]) ]), dbc.Row([ make_hideable(dbc.Col([ dbc.FormGroup([ dbc.RadioItems( options=[ { "label": "vs Prediction", "value": "vs_pred" }, { "label": "vs Actual", "value": "vs_actual" }, ], value=self.pred_or_actual, id='residuals-pred-or-actual-' + self.name, inline=True, ), ]), ], md=3), hide=self.hide_pred_or_actual), make_hideable(dbc.Col([ html.Label('Residual type:'), dcc.Dropdown(id='residuals-type-' + self.name, options=[{ 'label': 'Difference', 'value': 'difference' }, { 'label': 'Ratio', 'value': 'ratio' }, { 'label': 'Log ratio', 'value': 'log-ratio' }], value=self.residuals), ], md=3), hide=self.hide_ratio), ], justify="center") ])
def get_div_children(text): return html.Div([ dbc.Row([dbc.Col(html.Label("Temperature:", className="padding8"), width=7), dbc.Col(html.Label("Modality: ", className="padding8"), width=5)]), dbc.Row([ dbc.Col(dcc.Slider( id="fm_temp_slider", min=0, max=40, value=15, marks={ #-20: {'label': '-20 °C', 'style': {'color': '#f50'}}, 0: {'label': '0°C', 'style': {'color': '#f50'} }, 15: {'label': '15°C'}, 30: {'label': '30°C'}, 40: {'label': '40°C', 'style': {'color': '#f50'}} }, className="bottom24", included=False ), width=7), dbc.Col(dbc.RadioItems( options=[ {"label": "Outdoor", "value": "Outdoor"}, {"label": "Indoor", "value": "Indoor"}, ], value="Indoor", id="in-or-out-door", inline=True, ) ) ]), html.Label("Humidity:", className="padding8"), dcc.Slider( id="fm_humid_slider", min=0, max=100, value=65, marks={ 0: {'label': '0%', 'style': {'color': '#f50'}}, 25: {'label': '25%'}, 50: {'label': '50%'}, 75: {'label': '75%'}, 100: {'label': '100%', 'style': {'color': '#f50'}} }, className="bottom24", included=True ), html.Div(children=text), # button to submit the values Cities / Tempeature / Humidity dbc.Button("Apply", color="primary", block=True, className="top32", id="customize-button") # html.Div() ], className="info-sliders")
def get_radio_items(): ritems = dbc.FormGroup([ html.H4('Choose type:', style={'color':'black'}), dbc.RadioItems( options=[ {"label": "confirmed cases", "value": 'confirmed'}, {"label": "deaths", "value": 'deaths'}, ], value='confirmed', id="type_input", ) ]) return ritems
def get_body(self): return [ lay.card([ dcc.Graph(id="plot_comp_1", config=c.dash.PLOT_CONFIG), dbc.RadioItems( id="radio_comp_1", options=self.radio_opt, value=c.names.INCOMES, inline=True, ), ]), lay.card([ dcc.Graph(id="plot_comp_2", config=c.dash.PLOT_CONFIG), dbc.RadioItems( id="radio_comp_2", options=self.radio_opt, value=c.names.EXPENSES, inline=True, ), ]), lay.get_dummy_div("comp_aux"), ]
def pseudotime_gene_relative_radio(): m = dbc.RadioItems( id="pseudotime_gene_relative_radio", options=[{ "label": "absolute", "value": "absolute" }, { "label": "relative", "value": "relative" }], value="absolute", ) return m
def distribution_type(margin_10, radio_style): dist_radio = dbc.FormGroup([ dbc.RadioItems(options=[{ "label": i, "value": i } for i in ['Histogram', 'Distribution']], id="dist_type", inline=True, value='Histogram', style=radio_style) ], style=margin_10) return dist_radio
def panel_param(): r = [ html.H4(className='mdl-card__title-text', style={ 'font-size': '24px', 'margin-bottom': '4px', 'overflow': 'visible', 'color': 'white' }, children='Parámetros de Detección'), dbc.Form([ dbc.FormGroup([ html.Div('+ Modelo', className='label'), dbc.RadioItems(id='p_model', options=[{ 'label': 'YOLOv5 Best', 'value': 'weights/best_yolov5s_results.pt' }, { 'label': 'YOLOv5 Best Old', 'value': 'weights/best_yolov5s_result_old.pt' }], value='weights/best_yolov5s_results.pt') ]), dbc.FormGroup([ html.Div('+ Tamaño de Imágen', className='label'), dbc.Input(type='number', id='p_img', step=32, value=416, min=32, max=1024) #min=0, max=10 ]), dbc.FormGroup([ html.Div('+ Confianza: 0.4', className='label', id='lab_conf'), dcc.Slider(id='p_conf', min=0.1, max=0.9, step=0.1, value=0.4) ]), ]), # html.Div(style={'margin-top':'8px'}, children=[ # html.A('CANCELAR', className='mdl-button', style={'color':'white'}, id='p_cancel'), # html.A('GUARDAR', className='mdl-button', style={'color':'white'}, id='p_save'), # ]) ] return (r)
def mod_criteria_button_crhr(): return [ dbc.Button( "Click to modify criteria", id="button-mod-dim-lv1-crhr", className="mb-3", style={ "background-color": "#38160f", "border": "none", "border-radius": "10rem", "font-family": "NotoSans-Regular", "font-size": "0.8rem" }, ), dbc.Popover( [ dbc.PopoverHeader("Modify criteria"), dbc.PopoverBody([ html.Div([ dbc.RadioItems( options=[{ 'label': c, 'value': c, 'disabled': False } if c not in disable_list else { 'label': c, 'value': c, 'disabled': True } for c in dimensions], value="Medication Adherence", labelCheckedStyle={"color": "#057aff"}, id="list-dim-lv1-crhr", style={ "font-family": "NotoSans-Condensed", "font-size": "0.8rem", "padding": "1rem" }, ), ], style={ "padding-top": "0.5rem", "padding-bottom": "2rem" }) ]), ], id="popover-mod-dim-lv1-crhr", is_open=False, target="button-mod-dim-lv1-crhr", placement="top", ), ]
def plotly_templates(margin_12, radio_style): themes = ['ggplot2', 'seaborn', 'plotly', 'plotly_dark', 'presentation'] template = dbc.FormGroup([ dbc.RadioItems(options=[{ "label": i, "value": i } for i in themes], id="theme_dropdown", inline=True, style=radio_style, value='presentation') ], style=margin_12) return template