def getCards(df): summaryProvider = [] for idx, r in df.iterrows(): if ' - ' not in r[0]: summaryProvider.append( html.Div([ dbc.Card([ dbc.CardHeader(r[0]), dbc.CardBody([ html.H4(r[1], className="card-title"), html.P("of tests taken, passed", className="card-text"), ]), ], ) ], style={"display": "inline-block"})) summaryProviderMulti = [] for idx, r in df.iterrows(): if ' - ' in r[0]: summaryProviderMulti.append( html.Div([ dbc.Card([ dbc.CardHeader(r[0]), dbc.CardBody([ html.H4(r[1], className="card-title"), html.P("of tests taken, passed", className="card-text"), ]), ], ) ], style={"display": "inline-block"})) return summaryProvider, summaryProviderMulti
def card_content(card_name, card_new_value, card_total_value): card = [ dbc.CardHeader( [ html.H2(card_name, style={'text-align': 'center'}, className="card-sub-header"), ] ), dbc.CardBody( [ html.H4(children=['New : ', f"{int(card_new_value):,}"], #style={'text-align': 'right'}, className="card-sub-body" ), html.H4(children=['Total : ', f"{int(card_total_value):,}"], #style={'text-align': 'right'}, className="card-sub-body2" ), ] ), # dbc.CardFooter( # [ # html.P(f"{int(card_total_value):,}", className="card-sub-footer"), # ] # ), ] return card
def render_output_panel(area_select): data.process_data_for_area(area_select) card = html.Div([ dbc.Card(className="bg-dark text-light", children=[ dbc.CardBody([ html.H4(area_select, id="card-name", className="card-title"), html.Br(), html.H6("Compared to England:", className="card-title"), html.H4("{:,.0f}%".format(data.compare_to_eng), className="card-text text-light"), html.Br(), html.H6( "Compared to previous year:".format(area=area), className="card-title"), html.H4("{:,.0f}%".format(data.change_area), className="card-text text-light"), html.Br(), html.H6("Best period:", className="card-title"), html.H4(data.best_period, className="card-text text-light"), html.H6("with recycling rate {:,.0f}%".format( data.best_rate), className="card-title text-light"), html.Br() ]) ]) ]) return card
def get_cloud_recommendation( self, on_cloud: str, cloud_provider_name: str, cloud_emissions_barchart_data: pd.DataFrame, ): if on_cloud == "N": return html.H4() cloud_emissions_project_region = cloud_emissions_barchart_data.iloc[ 0, :] cloud_emissions_minimum_region = cloud_emissions_barchart_data.iloc[ 1, :] if (cloud_emissions_minimum_region.emissions > cloud_emissions_project_region.emissions): return html.H4([ f"Already running on {cloud_provider_name}'s least emissions region ", html.Strong( f"{cloud_emissions_project_region.region}", style={ "fontWeight": "normal", "color": "green" }, ), ]) else: return ( html.H4([ "Had this been run in ", html.Strong( f"{cloud_emissions_minimum_region.region}", style={ "fontWeight": "normal", "color": "green" }, ), " region, ", ]), html.H4([ "then the emitted carbon would have been ", html.Strong( f"{'{:.1f}'.format(cloud_emissions_minimum_region.emissions)} kg", style={ "fontWeight": "normal", "color": "green" }, ), ]), html.H4([ "Reducing the current emissions by ", html.Strong( f"{'{:.1f}'.format(cloud_emissions_project_region.emissions - cloud_emissions_minimum_region.emissions)} kg", style={ "fontWeight": "normal", "color": "green" }, ), ]), )
def create_card(card: dict): res = [] for tile, value in card.items(): rows = value["text"] # if isinstance(text, str): # text = html.H3(text) html_text = [] for row in rows: html_text.append( html.Div(row, className="d-flex flex-row justify-content-center")) res.append( html.Div(dbc.Card([ html.H4(tile, className="card-title text-center"), dbc.Row([ dbc.Col(dbc.CardBody(html_text, style={ "whiteSpace": "nowrap", "fontSize": "160%" }), className="text-center"), dbc.Col( dbc.CardImg(src=value.get("src", Component.UNDEFINED), style={"maxHeight": "7rem"})) ], className="align-items-center flex-nowrap") ], className="h-100 p-2"), className="col-sm-12 col-md-6 col-lg-3 py-2")) return res
def update_ror_box(acct_names, comp_type, min_date, max_date, n_clicks, sim_symbol): if not acct_names: return "..." min_date, max_date = pd.to_datetime(min_date), pd.to_datetime(max_date) components = [html.H4("Annualized rate of return: ")] if comp_type == "compare": for name in acct_names: components.append(ror_component([name], min_date, max_date, name)) elif comp_type == "sim": components.append( ror_component(acct_names, min_date, max_date, "Actual portfolio") ) components.append( ror_component( acct_names, min_date, max_date, "Counterfactual portfolio", sim_symbol, ) ) else: components.append(ror_component(acct_names, min_date, max_date)) return components
def __init__(self, project_name, description): super().__init__() self.card = html.A(html.Button( dbc.Card( dbc.CardBody( [ html.H4("Project : {}".format(project_name), className="card-title"), html.H6("Description : {}".format(description), className="card-subtitle", style={"margin-bottom": "8px"}), html.Div([ dbc.CardLink(dbc.Button("Test", style={"margin-right": "16px"}, color="primary"), href="{}/test".format(project_name), style={"float": "left"}), # dbc.CardLink(dbc.Button("Open", style={"margin-right": "20px"}, color="info"), # href=project_name), html.A(dbc.Button("Export CSV", style={"margin-right": "32px"}, color="secondary"), href="{}/export/csv".format(project_name)), html.A(dbc.Button("Export Excel", style={"margin-right": "32px"}, color="secondary"), href="{}/export/excel".format(project_name)), dbc.CardLink(dbc.Button("Delete", color="danger", style={"margin-right": "16px"}), href="{}/delete".format(project_name), style={"float": "right"}), # dbc.Badge("Success", style={"float": "right"}) ], ) ] ), style={"width": "65rem"}, ) ), href=project_name )
def get_net_summary(): return html.Div( [ html.H2("Across All Projects", style={"textAlign": "center"}), html.H4( [ "Net Power Consumption : ", html.Strong( id="net_power_consumption", style={ "fontWeight": "normal", "color": "green" }, ), ], style={ "textAlign": "left", "float": "left" }, ), html.H4( [ "Net Carbon Equivalent : ", html.Strong( id="net_carbon_equivalent", style={ "fontWeight": "normal", "color": "green" }, ), ], style={ "textAlign": "right", "float": "right" }, ), ], style={ "paddingLeft": "1.4%", "paddingRight": "1.4%" }, )
def form_layout(title, form): return html.Div([ html.Div([ html.Div([ html.Div([ html.H4(title, className="card-title"), form, ], className='card-body') ], className="card fat") ], className="col-6 mx-auto") ], className="row align-items-center h-100")
def patient_information(): """ Return: Card with patient information """ information = [ dcc.Tab(label='About', value='what-is', children=html.Div( className='control-tab', children=[ html.H4(className='what-is', children='Information about patient'), html.A('Download data', id='my-link2'), html.P(id="text", className="card-text"), ])) ] return information
def get_energy_mix_tab(): return dcc.Tab( label="Energy Mix", value="energy_mix_tab", id="global_energy_mix", children=[ html.Div( dbc.Col([ html.Br(), html.H4("Select Energy Source"), dcc.Dropdown( id="energy_type", options=[ { "label": "Fossil", "value": "fossil" }, { "label": "Geothermal", "value": "geothermal" }, { "label": "Hydroelectricity", "value": "hydroelectricity", }, { "label": "Nuclear", "value": "nuclear" }, { "label": "Solar", "value": "solar" }, { "label": "Wind", "value": "wind" }, ], value="fossil", ), dcc.Graph( id="global_energy_mix_choropleth", style={"marginLeft": "-16%"}, ), ])) ], )
def div_topo(): return html.Div( children=[ html.H2('Informações da Cidade de Sousa-PB', style={ 'font-weight': 'bold', }), html.H4('Dados de 1983 até 2018') ], style={ 'textAlign': 'center', 'font-weight': 'bold', 'border': '2px solid lightgreen', 'box-shadow': '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)', 'background-color': '#8FBC8F', })
def layout(): @app.callback(Output("report", "children"), Input("checkbox-form", "form_data")) def _callback(form_data): report = NOUPDATE if form_data: del form_data['submit_count'] values = {'form_data': form_data} report = json.dumps(values, sort_keys=True, indent=2) return report form = form_container("Check box examples", formFields(), id="checkbox-form") return html.Div([form, html.H4(id='report')])
def div_daq_log(): """ Generates an HTML Div containing the DAQ log """ return html.Div( [ # Title html.H4('Last DAQ Log', style={"textAlign": "center"}), # Div to display the DAQ output log html.Div([ # Box that display the DAQ log dcc.Textarea( id="text-log", placeholder=" ", value="DAQ log will appear here when available...", style={ "width": "90%", "height": "300px", "marginLeft": "5%", "marginTop": "10px", "background-color": "black", "color": "white" }, disabled=True) ]), # Invisible div that stores the path to the log file dcc.Store(id='store-log-path') ], className="six columns", style={ "border-radius": "5px", "border-width": "5px", "border": "2px solid rgb(216, 216, 216)", "position": "relative", "height": "400px", "margin-top": "10px", "margin-right": "0px", "width": "55%" })
def __init__(self, project, api, api_id, method, status): super().__init__() print("status", status) status_color = "success" if "success" == status.lower() else "danger" self.card = dbc.Card( dbc.CardBody( [ html.H4("API : {}".format(api), className="card-title"), html.H6("Method : {}".format(method), className="card-subtitle"), html.Div([ dbc.CardLink(dbc.Button("Test", style={"margin-right": "16px"}, color="primary"), href="{}/{}/test".format(project, api_id)), dbc.CardLink(dbc.Button("Delete", color="danger", style={"margin-right": "16px"}), href="{}/{}/delete".format(project, api_id), style={"float": "right"}), dbc.Badge(status, color=status_color, style={"float": "center"}) ], ) ] ), style={"width": "20rem"}, )
def view_item(item, id): """Helper function to view a single item. """ html_comps = [] j = 0 for index in item.index: html_comps.append(html.H4(index)) d = item[index] if type(d) == pd.DataFrame: html_comps.append(get_standard_data_table(d, f"data_view_item_{j}")) elif type(d) == list: html_comps.append(html.Pre("\n".join([str(di) for di in d]))) elif d is None: html_comps.append(html.Pre("None")) else: html_comps.append(html.Pre(d)) j += 1 return html_comps
def card(title, text, link=None): return html.Div( [ html.Div( [ html.Img(alt=''), html.Div([ html.H4(title, className='card-title'), html.P(text, className='card-text') ], className='card-body'), html.Div( [ # spa.ButtonLink('Find Out More!', href=spa.url_for(link)).layout ], className='card-footer') ], className='card h-100') ], className='col-lg-3 col-md-6 mb-4')
def test_mdcap001_dcc_components_as_props(dash_dcc): app = Dash(__name__) app.layout = html.Div( [ dcc.Checklist( [ {"label": html.H2("H2 label"), "value": "h2"}, {"label": html.A("Link in checklist", href="#"), "value": "a"}, ], id="checklist", ), dcc.RadioItems( [ {"label": html.H3("on"), "value": "on"}, {"label": html.P("off"), "value": "off"}, ], id="radio-items", ), dcc.Dropdown( [ {"label": html.H4("h4"), "value": "h4"}, {"label": html.H6("h6"), "value": "h6"}, ], id="dropdown", ), ] ) dash_dcc.start_server(app) dash_dcc.wait_for_text_to_equal("#checklist h2", "H2 label") dash_dcc.wait_for_text_to_equal("#checklist a", "Link in checklist") dash_dcc.wait_for_text_to_equal("#radio-items h3", "on") dash_dcc.wait_for_text_to_equal("#radio-items p", "off") dash_dcc.find_element("#dropdown").click() dash_dcc.wait_for_text_to_equal("#dropdown h4", "h4") dash_dcc.wait_for_text_to_equal("#dropdown h6", "h6")
def form_container(title, fields, id=None): if id: form = dhc.Form(fields, id=id, preventDefault=True) else: form = dhc.Form(fields, preventDefault=True) return html.Div( [ html.Div( [ html.Div(className="col-md-2"), html.Div( [ html.Div( [ html.Div( [ html.Br(), html.H4(title), html.Br(), form, html.Br(), ], className="card-body", ) ], className="card", ) ], className="col-md-8", ), html.Div(className="col-md-2"), ], className="row", ) ], className="container-fluid", )
def plot_option_layout(self) -> List[html.Div]: """Renders a dropdown widget for each plot option""" divs = [] # The plot type dropdown is handled separate divs.append( html.Div( style=self.style_options_div, children=[ html.H4("Set plot options"), html.P("Plot type"), dcc.Dropdown( id=self.uuid("plottype"), clearable=False, options=[{"label": i, "value": i} for i in self.plots], value=self.plot_options.get("type", "scatter"), ), ], ) ) # Looping through all available plot options # and renders a dropdown widget for key, arg in self.plot_args.items(): divs.append( html.Div( style=self.style_options_div_hidden, id=self.uuid(f"div-{key}"), children=[ html.P(key), dcc.Dropdown( id=self.uuid(f"dropdown-{key}"), clearable=arg["clearable"], options=[{"label": i, "value": i} for i in arg["options"]], value=arg["value"], multi=arg["multi"], ), ], ) ) return divs
def __call__(self): """ Return a html Div for grouped sliders """ slider_group_component = [] for group_id, slider_ids in self._slider_groups.items(): slider_object = [] for slider_member in slider_ids: slider_object += [self._sliders[slider_member]] slider_group_component.append(html.Div([ html.H4(group_id), html.Br(), html.Div( children=slider_object, id=group_id, style={'marginBottom': '1em'}) ])) return html.Div(slider_group_component)
def get_layout(): div_instructions = html.H5( 'Start by loading and selecting the event log (XES format) to be analyzed.' ) load_files_div = html.Div([ html. P('Here you can load the event logs for analyzing process drifts. If the log is already ' 'loaded, just click on its name to continue.'), du.Upload( id='dash-uploader', max_file_size=1800, # 1800 Mb filetypes=['xes'], upload_id=get_user_id()), ]) show_files_div = html.Div([ html.H4('Loaded event logs.'), html.H5('Select the file you want to analyze:'), html.Div(id='div-alerts', children=[]), html.Div(id='list-files', children=return_li_files()), ], className='mt-2') # main layout of the page layout = [ dbc.Row([dbc.Col(navbar, width=12)]), dbc.Row([ dbc.Col(dbc.CardBody( [div_instructions, load_files_div, show_files_div]), className='mt-2', width=12), ]), ] return layout
def get_layout(**kwargs): return html.Div( [ dcc.Markdown( dedent( """ # App Dashboard """ ) ), html.Div( children=[ html.H4( [ "Select an app",], className="app-selection-title", ), dcc.Dropdown( id="app-option", options=[{ 'label': i, 'value': i } for i in get_app_options()], value=get_app_options()[0] ), ] ), html.Div( children=[ html.Div( children=[ html.H4( ["App Dependency Graph",], className="price-heatmap-title", ), dcc.Graph( id="app-dag", figure=blank_fig(), # config={"displayModeBar": False}, ) ], style={'width': '49%', 'height': '100%', 'display': 'inline', 'text-align': 'center'}, ), html.Div( children=[ html.Div( children=[ dcc.Loading( id = "loading-icon", type="circle", children=[ html.Div( children=[ html.Div( "Cost Saving: ", style={'color': 'black', 'margin-right': 30,'fontSize': 36, 'text-align': 'justify'}, ), html.Div( id="price-calc", style={'color': 'black', 'fontSize': 36, 'text-align': 'justify'}, ), ], style={'flex-direction': 'row', 'display' : 'flex'}, ), ]), dcc.Loading( id = "loading-icon", type="circle", children=[ html.Div( children=[ html.Div( "Latency reduction: ", style={'color': 'black', 'fontSize': 36, 'text-align': 'justify'}, ), html.Div( id="latency-calc", style={'color': 'black', 'fontSize': 36, 'text-align': 'justify'}, ), ], style={'flex-direction': 'row', 'display' : 'flex'}, ), ]), ], ), ], style={'width': '100%', 'height': '100%','display': 'inline', 'text-align': 'center'}, ), ] ), html.Div( children=[ html.H4( ["Clusters Locations",], className="clusters-location-title", ), dcc.Loading( id = "loading-icon", type="circle", children=[ dcc.Graph( id="clusters-map", figure=blank_fig(), # config={"displayModeBar": False}, ), ]), ], className="twelve columns pretty_container", ), # Heat Maps html.Div( children=[ html.Div( children=[ html.H4( ["Latency in ms",], className="latency-heatmap-title", ), dcc.Graph( id="latency-heatmap", figure=blank_fig(), # config={"displayModeBar": False}, ) ], style={'width': '49%', 'display': 'inline-block'}, ), html.Div( children=[ html.H4( ["Price per GB outbound in USD($)",], className="price-heatmap-title", ), dcc.Graph( id="price-heatmap", figure=blank_fig(), # config={"displayModeBar": False}, ) ], style={'width': '49%', 'display': 'inline-block'}, ), ] ), # Capacity html.Div( children=[ html.H4( [ "Service capacity per cluster (RPS)",], className="app-balance-selection-title", ), dcc.Loading( id = "loading-icon", type="circle", children=[ dcc.Graph( id="capacity-table", figure=blank_fig(), # config={"displayModeBar": False}, ), ]), ] ), html.Div( children=[ html.H4( [ "Select balancing option",], className="app-balance-selection-title", ), dcc.Dropdown( id="balance-option", options=[{ 'label': i, 'value': i } for i in get_balancing_options()] , value="Combined" ), ] ), # Load html.Div( className="global-load", children=[ html.H4( ["Global AVG Load",], className="global-load-title", ), dcc.Loading( id = "loading-icon", type="circle", children=[ dcc.Graph( id="global-load", figure=blank_fig(), # config={"displayModeBar": False}, ), ]), ], ), html.Div( className="service-to-service-load", children=[ html.H4( ["Load",], className="service-to-service-load-title", ), dcc.Loading( id = "loading-icon", type="circle", children=[ dcc.Graph( id="service-to-service-load", figure=blank_fig(), # config={"displayModeBar": False}, ), ]), ], ), # # html.Div( # className="services-map", # children=[ # html.H4( # ["Services Map",], # className="service-map-title", # ), # dcc.Loading( # id = "loading-icon", # type="circle", # children=[ # dcc.Graph( # id="service-map", # figure=blank_fig(), # # config={"displayModeBar": False}, # ), # ]), # ], # ), ] )
def layout(): return html.Div( id='variantmap-body', className='app-body', children=[ html.Div( id='variantmap-control-tabs', className='control-tabs', children=[ dcc.Tabs( id='variantmap-tabs', value='what-is', children=[ # "What is" tab dcc.Tab( label='About', value='what-is', children=html.Div( className='control-tab', children=[ html.H4( className='what-is', children='What is VariantMap?'), html. P('VariantMap is a genomic structural variant (SV) visualization ' 'technique that displays variants across multiple samples in a ' 'single heatmap. Each row represents a sample and each column ' 'represents an SV breakend in the sample cohort. The colors ' 'indicate the class of an SV present in a sample. The ' 'heatmap can be customized interactively to suit your analysis ' 'by changing various components in the "Customize" tab.' ), html. P('VariantMap requires a dataframe object that is generated by ' 'VariantBreak. Do note that only NanoVar VCF ' 'files are currently compatible to work with VariantBreak in creating the ' 'dataframe.') ])), # Data tab dcc.Tab( label='Data', value='data', children=html.Div( className='control-tab', children=[ # Dataset upload html.Div( 'Upload dataset:', title= 'Upload your own dataset below.', className='app-controls-name'), html.Div( id='variantmap-file-upload', title= 'Upload your own VariantBreak generated HDF5 dataset here.', children=[ dcc.Upload( id='upload-data', className='control-upload', children=html.Div([ "Drag and drop your .h5 file or ", html.A("select file.") ]), accept='.hdf5,.h5', multiple=False) ]), html.Br(), # Label file upload html.Div( 'Upload label file:', title= 'This file is used to rename and sort samples.\nExample:\n#Default ' 'name<tab>Label\nS1<tab>SampleA\nS3<tab>SampleC\nS2<tab>SampleB', className='app-controls-name'), html.Div( id='variantmap-tsv-upload', title= 'Upload a .tsv file to rename and sort samples.\nExample:\n#Default ' 'name<tab>Label\nS1<tab>SampleA\nS3<tab>SampleC\nS2<tab>SampleB', children=[ dcc.Upload( id='upload-tsv', className='control-upload', children=html.Div([ "Drag and drop your .tsv file or ", html.A("select file.") ]), accept='.txt,.tsv,.csv', multiple=False) ]), html.Br(), # Sample selection check boxes html.Div( id='output-data-info', className= 'fullwidth-app-controls-name', children=[ dcc.Checklist( id="select-samples", style={'display': 'none'}), html.Br(), html.Button( id='submit-button-samples', style={'display': 'none'}) ]) ])), # Customize tab dcc.Tab( label='Customize', value='customize', children=html.Div( className='control-tab', children=[ html.Div( id='customize-tab', className= 'fullwidth-app-controls-name', children=[ dcc.Dropdown( id='sample_filt', style={'display': 'none'}), dcc.Dropdown( id='file_filt', style={'display': 'none'}), dcc.Dropdown( id='gene_names', style={'display': 'none'}), dcc.Input( id='input_index', style={'display': 'none'}), dcc.Checklist( id="select-genetype", style={'display': 'none'}), dcc.Checklist( id="select-feature", style={'display': 'none'}), dcc.Checklist( id="select-annotation", style={'display': 'none'}), dcc.Input( id='entries_size', style={'display': 'none'}), html.Button( id='submit-button', style={'display': 'none'}) ]) ])), # Variant info tab dcc.Tab( label='Variant info', value='info', children=html.Div( className='control-tab', children=[ html.Div( id='info-tab', className= 'fullwidth-app-controls-name', children=[ html.Div( 'Click on variant to display its information' ) ]) ])) ]) ]), dcc.Loading( className='dashbio-loading', children=html.Div( id='variantmap-wrapper', children=[ # Error message box html.Div(id='error-msg', style={ 'color': 'crimson', 'text-align': 'center', 'font-size': '18px' }), # Plot VariantMap figure html.Div(id='variantmap-fig', children=[ html.Div(dcc.Graph(id='variantmap'), style={'display': 'none'}) ]), # Plot Slider html.Div(id='batch-slider', children=[ html.Div('', style={ 'textAlign': 'center', }), html.Div(dcc.Slider(id='slider', ), style={'display': 'none'}) ]) ])), # Create Store component to store JSON of dataframe and metadata dcc.Store(id='memory'), # To store variant counts dcc.Store(id='count-store'), # To store custom settings dcc.Store(id='custom-store'), # To store name dictionary dcc.Store(id='name_dict'), # To store sample labels dcc.Store(id='sample_labels'), # To store sample order dcc.Store(id='sample_order') ])
facet_col_wrap=4, binary_format='png') #, binary_string=True) ### Change the titles of the images subTitles = list('ab') for i, annot in enumerate(subTitles): figx.layout.annotations[i]['text'] = annot figx.update_layout(width=2000, height=1000, margin=dict(l=1, r=1, b=1, t=1, pad=1)) app = dash.Dash(__name__) app.layout = html.Div([ html.H4(children='Title'), dash_table.DataTable( id='table', columns=[{ "name": i, "id": i } for i in df.columns], data=df.to_dict('records'), style_cell=dict(textAlign='left'), style_header=dict(backgroundColor='paleturquoise'), style_data=dict(backgroundColor='lavender'), ), dcc.Graph(id='example-graph', figure=figx) ]) if __name__ == '__main__':
def filter_layout(self) -> Optional[list]: """Makes dropdowns for each dataframe column used for filtering.""" if not self.use_filter: return None df = self.data dropdowns = [html.H4("Set filters")] for col in self.filter_cols: if df[col].dtype in [np.float64, np.int64]: min_val = df[col].min() max_val = df[col].max() mean_val = df[col].mean() dropdowns.append( html.Div( children=[ html.Details( open=True, children=[ html.Summary(col.lower().capitalize()), dcc.RangeSlider( id=self.uuid(f"filter-{col}"), min=min_val, max=max_val, step=(max_val - min_val) / 10, marks={ min_val: f"{min_val:.2f}", mean_val: f"{mean_val:.2f}", max_val: f"{max_val:.2f}", }, value=[min_val, max_val], ), ], ) ] ) ) else: elements = list(self.data[col].unique()) dropdowns.append( html.Div( children=[ html.Details( open=True, children=[ html.Summary(col.lower().capitalize()), wcc.Select( id=self.uuid(f"filter-{col}"), options=[ {"label": i, "value": i} for i in elements ], value=elements if self.filter_defaults is None else [ element for element in self.filter_defaults.get( col, elements ) if element in elements ], size=min(15, len(elements)), ), ], ) ] ) ) return dropdowns
def render_page_content(pathname): if pathname in ["/", "/page-1"]: return html.Div([ dbc.Container([ html.H4("About the Data and the App", className="display-about"), html.P( "Getting insights from the docs", className="lead", ), html.Hr(className="my-2"), dcc.Markdown( ''' Pellentesque posuere pellentesque imperde laoreet’s Velit leading pulvinar velit a hendrerit Donec non pellentesque jus businesses tincidunt. Suspendisse at maximus turpis, non loborsrt. Dolor sit amet consectetur elit sed do eiusmod tempor incididunt labore et dolore magna aliqua enim ad minim veniam quis nostrud exercitation ulac laboris aliquip ex ea commodo consequat duis aute irure.dolor in repre henderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur excep teur sint cupidatat non proident. Pellentesque posuere pellentesque imperde laoreet’s Velit leading pulvinar velit a hendrerit Donec non pellentesque jus businesses tincidunt. Suspendisse at maximus turpis, non loborsrt. * consectetur elit sed do eius * consectetur elit sed * consectetur elit sed do ''' ), ]) ]) elif pathname == "/page-2": if 'data' in globals(): del data data = load_data() return html.Div([ html.H3('Text Data', style={'font-weight': 'bold'}), html.P('Preprocessed: stopwords removed; words in original form; without numbers; predefined phrase linked by "_"'), dash_table.DataTable( id='table', # columns=[{"name": i, "id": i} for i in textdata.columns], # data=textdata.to_dict('records'), columns=[{"name": i, "id": i} for i in data[['FileID','Text','text']].columns], data=data[['FileID','Text','text']].to_dict('records'), editable=False, filter_action="native", sort_action="native", sort_mode="multi", column_selectable=False, row_selectable=False, row_deletable=False, selected_columns=[], selected_rows=[], page_action="native", page_current= 0, page_size= 20, # style_cell_conditional=[ # {'if': {'column_id': 'Member'}, # 'width': '100px'}, # ] style_data={ 'whiteSpace': 'normal', 'height': 'auto' }, style_cell={ # 'height': 'auto', 'minWidth': '20px', 'maxWidth': '300px', # 'whiteSpace': 'normal', 'textAlign': 'left', 'verticalAlign': 'top', 'fontSize':12, }, ) ]) elif pathname in ["/page-3"]: return html.Div([ # Chart 1 dbc.Row([ dbc.Col([ html.H3('Summary Statistics of Documents', style={'font-weight': 'bold'}), html.P( id="description", children=dcc.Markdown( children=( ''' Member submisions, and Chair and Secretariat summaries/notes. ''') ) ), html.Br(), html.H6('Number of documents by year', style={'font-weight': 'bold'}), ], lg=10), ]), dbc.Row([ dbc.Col([ html.Label('Select Pillar:'), dcc.Dropdown( id='stat-year-dropdown-pillar', options=[{'label': v, 'value': k} for k, v in dict_pillar.items()], multi=False, value= 'All', ), ], lg=4), dbc.Col([ html.Label('Select Proponent:'), dcc.Dropdown( id='stat-year-dropdown-proponent', options=[{'label': v, 'value': k} for k, v in dict_proponent.items()], multi=False, value= 'All Members & Groups', ), ], lg=4) ]), dbc.Row([ dbc.Col([ dcc.Graph( id='stat-plot-year-pillar-proponent' ), ], lg=10), ]), # Chart 2 dbc.Row([ dbc.Col([ html.Label('Select topic:'), dcc.Dropdown( id='stat-year-dropdown-topic', options=[{'label': v, 'value': k} for k, v in dict_topic.items()], multi=False, value= 'All', ), ], lg=4), dbc.Col([ html.Label('Select Proponent:'), dcc.Dropdown( id='stat-year-dropdown-proponent2', options=[{'label': v, 'value': k} for k, v in dict_proponent.items()], multi=False, value= 'All Members & Groups', ), ], lg=4) ]), dbc.Row([ dbc.Col([ dcc.Graph( id='stat-plot-year-topic-proponent' ), ], lg=10), ]), # Chart 3 dbc.Row([ dbc.Col([ html.H6('Number of documents by proponent', style={'font-weight': 'bold'}), html.Label('Select Year:'), dcc.Dropdown( id='stat-3-dropdown-year', options=[{'label': v, 'value': k} for k, v in dict_year.items()], multi=False, value= 'All', ), ], lg=4), # dbc.Col([ # html.Label('Select Proponent:'), # dcc.Dropdown( # id='stat-year-dropdown-proponent2', # options=[{'label': v, 'value': k} # for k, v in dict_proponent.items()], # multi=False, # value= 'All Members & Groups', # ), # ], lg=4) ]), dbc.Row([ dbc.Col([ dcc.Graph( id='stat-3-proponent' ), ], lg=10), ]), # Chart 4 dbc.Row([ dbc.Col([ html.Br(), html.Br(), html.H6('Number of documents by topic', style={'font-weight': 'bold'}), html.Label('Select Year:'), dcc.Dropdown( id='stat-4-dropdown-year', options=[{'label': v, 'value': k} for k, v in dict_year.items()], multi=False, value= 'All', ), ], lg=4), # dbc.Col([ # html.Label('Select Proponent:'), # dcc.Dropdown( # id='stat-year-dropdown-proponent2', # options=[{'label': v, 'value': k} # for k, v in dict_proponent.items()], # multi=False, # value= 'All Members & Groups', # ), # ], lg=4) ]), dbc.Row([ dbc.Col([ dcc.Graph( id='stat-4-topic' ), ], lg=10), ]), ]) elif pathname in ["/page-4"]: # if 'data' in globals(): # del data # data = load_data() return html.Div([ dbc.Row([ # dbc.Col(lg=1), dbc.Col([ html.H3('Similarity within topics', style={'font-weight': 'bold'}), # html.H5('Updata on 14 June 2020'), html.P( id="description", children=dcc.Markdown( children=( ''' Similarity between two docs in a topic. ''') ) ), html.Br(), # html.H6('Number of Proposals by year', style={'font-weight': 'bold'}), # dcc.Dropdown( # id='my-dropdown', # options=[{'label': v, 'value': k} # for k, v in dict_pillar.items()], # multi=False, # value= [0,1,2,3,4,5,6,7,8,9], # ), ], lg=10), ]), dbc.Row([ dbc.Col([ html.Label('Select Topic:'), dcc.Dropdown( id='plot-year-dropdown-pillar1', options=[{'label': v, 'value': k} for k, v in dict_topic.items()], multi=False, value= 'COT', ), ], lg=4), # dbc.Col([ # html.Label('Select Proponent:'), # dcc.Dropdown( # id='plot-year-dropdown-proponent1', # options=[{'label': v, 'value': k} # for k, v in dict_proponent.items()], # multi=False, # value= 'All', # ), # ], lg=4) ]), dbc.Row([ # dbc.Col(lg=1), # dbc.Col([ # dcc.Graph( # id='top_topics' # ), # ], lg=3), dbc.Col([ dcc.Graph( id='plot_year1' ), ], lg=10), ]), ]) elif pathname in ["/page-5"]: # return html.H5("Content to be added page 2.") return html.Div([ dbc.Row([ # dbc.Col(lg=1), dbc.Col([ html.H3('WordCloud by topic', style={'font-weight': 'bold'}), # html.H5('Updata on 14 June 2020'), html.P( id="description", children=dcc.Markdown( children=( ''' Word frequency in a topic. ''') ) ), html.Br(), ], lg=10), ]), dbc.Row([ dbc.Col([ html.Label('Select Topic:'), dcc.Dropdown( id='plot-year-dropdown-pillar2', options=[{'label': v, 'value': k} for k, v in dict_topic.items()], multi=False, value= 'COT', ), ], lg=4), ]), dbc.Row([ dbc.Col([ dcc.Graph( id='plot_year2' ), ], lg=10), ]), ]) elif pathname in ["/page-6"]: return html.Div([ # html.H1('Title'), html.H3('Networks: proposal proponents & document cross reference', style={'font-weight': 'bold'}), html.Embed(src = "assets/network_proponent.html", width=850, height=850), html.Embed(src = "assets/network_crossreference.html", width=850, height=850) ]) elif pathname in ["/page-7"]: return html.Div([ dbc.Row([ dbc.Col([ html.H3('Term Frequency', style={'font-weight': 'bold'}), html.P( id="description", children=dcc.Markdown( children=( ''' Term frequency across time ''') ) ), ]), ]), dbc.Row([ dbc.Col([ dbc.Input(id='term-freq-input', value='tariff ams', type='text'), dbc.Button(id='term-freq-button', type='submit', children='Submit', className="mr-2"), html.P(id='term-freq-invalid'), ], lg=6), ]), dbc.Row([ dbc.Col([ dcc.Graph( id='term-freq-plot' ), # dbc.Button(id='term-freq-button', type='submit', children='Submit', className="mr-2"), ], lg=10), ]) ]) elif pathname in ["/page-8"]: return html.Div([ dbc.Row([ dbc.Col([ html.H3('TF-IDF keywords', style={'font-weight': 'bold'}), html.P( id="description2", children=dcc.Markdown( children=( ''' Keywords based on TF-IDF. Select documents ''') ) ), ]), ]), dbc.Row([ dbc.Col([ html.P(id='tfidf-invalid'), dcc.Dropdown(id='tfidf-dropdown', multi=True, value=['AIE-1', 'AIE-2','AIE-3','AIE-4','AIE-5'], placeholder='Select members', options=[{'label': country, 'value': country} for country in allfileid]), ],lg=10), ]), dbc.Row([ dbc.Col([ dcc.Graph( id='tfidf-plot' ), ], lg=10), ]) ]) # If the user tries to reach a different page, return a 404 message return dbc.Container( [ html.H1("404: Not found", className="text-danger"), html.Hr(), html.P(f"The pathname {pathname} was not recognised..."), ] )
card = dbc.Card( [ dbc.Row( [ dbc.Col( dbc.CardImg( src="/static/images/portrait-placeholder.png", className="img-fluid rounded-start", ), className="col-md-4", ), dbc.Col( dbc.CardBody( [ html.H4("Card title", className="card-title"), html.P( "This is a wider card with supporting text " "below as a natural lead-in to additional " "content. This content is a bit longer.", className="card-text", ), html.Small( "Last updated 3 mins ago", className="card-text text-muted", ), ] ), className="col-md-8", ), ],
dbc.Input(id='id_start_date', value="2020-01-01", type="text") ], ), dbc.InputGroup( [dbc.Input(id='id_end_date', value="2021-01-01", type="text")]), dbc.InputGroup( [dbc.Input(id='id_nbr_mixtures', value=3, type='number')]), dropdown ]))) app.layout = dbc.Container( [ html.Div(children=[ html.H1(children='Gaussian Mixtures'), html.H2(children='Data Source: ECB'), html.H4(children='...', id='id_title') ], style={ 'textAlign': 'center', 'color': 'black' }), html.Hr(), dbc.Row( [ dbc.Col(input_groups, md=2), dbc.Col(dcc.Graph(id="id_graph", figure=fig), md=10), ], align="center", ), ], fluid=True,
"HealthPath enables you to find itineraries going through the best natural \ and built environment for your health.", ), ], ), html.Div( id='app-container', children=[ html.Div( id='left-column', children=[ html.Div( id='address-container', # style = {'zIndex':2}, children=[ html.H4('What is your itinerary?'), html.Label([ "Origin", dcc.Dropdown( id="dynamic-start", style={ 'fontSize': '16px', 'color': '#ffffff', # 'zIndex': 3, 'backgroundColor': '#ffffff', }, placeholder="Search an address") ]), html.Label([ "Destination", dcc.Dropdown(