def get_item_hud(hud_title='LCL FORECAST ANALYSIS', hud_1_0='', hud_1_1='') \ -> Container: """ :param hud_title: str top of HUD :param hud_1_0: str Byline Position 1 :param hud_1_1: str Byline Position 2 :param hud_1_2: str :return: Container: 'item-hud-container' Row Container:'item-hud-title-container' Col H1: 'hud-title' Container: 'item-hud-byline-container' Row Navbar: item-hud-bar' NavItem: H2: 'hud-1-0' H2: hud-1-1' Row Tabs: 'table-tabs-nav' Tab: 'tab-all """ layout = Container( fluid=True, id='item-hud-container', children=[ Row( Container( id='item-hud-title-container', children=[Col(H1(id='hud-title', children=hud_title))])), Container( id='item-hud-byline-container', style=VISIBILITY_HIDDEN, children=[ Row([ Navbar(id='item-hud-bar', children=[ NavItem(H2(hud_1_0, id='hud-1-0')), NavItem(H2(hud_1_1, id='hud-1-1')) ]) ]), Row([ Tabs( id='table-tabs-nav', children=[Tab(tab_id='tab-all', label='All')], ) ], id='item-hub-tabs-row') ]), Div(id='datasource-1'), Div(id='datasource-2') ]) return layout
def get_html(self): """Initializes the content container dash html """ content = Main( className="py-5", style={ "marginLeft": "320px", "marginTop": "56px" }, children=[ Container(children=self.components["header"].html + self.components["intro"].html) ] + self.components["visualizations"].html + [Container(children=self.components["footer"].html)], ) return [content]
def get_table_container(): table_container = Container( dt.DataTable(id='my-dash-data-table', fill_width=False, style_as_list_view=True, style_data={'whiteSpace': 'normal'}, style_table={'max-width': '1200px'}, style_cell={'color': 'black'})) return table_container
def not_found() -> Div: """ Returns the 404 page not found page """ return Container([ Row([ Col([ H1('404 Page not found'), internal_link('Home', href='/'), ]) ]) ])
def get_html(self): """Glues individual setup components together """ return Div(children= self.components["navbar"].html + [Container( children=Row(self.components["sidebar"].html + [Div( id="page-wrapper", children=self.components["index"].html )]), fluid=True, className="mt-5", )])
def makeRoot_RisksBar(hide=F): return Div(Container([ Col([ Label('operational region(s)'), Div(id='risks-area-div', children=Dropdown(id='risks-area', placeholder='Select Operating Area(s)', options=[{ 'label': v, 'value': v } for v in data['alist']], value=data['alist'][0:], multi=True)), Tooltip( children= 'Select Operating Area(s) to See Details on the Geographical Footprint Map', id='risks-area-tip', target='risks-area-div', placement='right') ], className='dis nop r1p', width=6, style={'display': 'none'}), Col( [ Label('operational footprint'), Div(id='risks-foot-div', children=Dropdown(id='risks-foot', placeholder='Select Corporate Footprint', options=[{ 'label': k, 'value': v } for k, v in data['fdict'].items()], value='subsidiaries')), Tooltip( children= 'Select Footprint Metric to See Details on the Geographical Footprint Map', id='risks-foot-tip', target='risks-foot-div', placement='left') ], className='dis nop', width=3, ) ], id='risks-tool', fluid=True, style={'padding': '0rem'}), id='risks-wrap', hidden=hide)
def index() -> Div: ''' Returns the app index page ''' return Container([ Row([ Col([ H1('Welcome to the Index Page'), P('You can visit a second page by' ' clicking the link below'), internal_link('Hello Page', href='/hello'), ]) ]) ])
def makeRoot_MandABar(hide=T): return Div(Container([ Col([ Label('activity window'), Div(id='manda-date-div', children=DatePickerRange(id='manda-date', )), Tooltip( children= 'Select Date Range to Filter Stock Market Performance and M & A History', id='manda-date-tip', target='manda-date-div', placement='right') ], className='dis nop r1p', width=6, style={'display': 'none'}), Col( [ Label('activity filter'), Div(id='manda-type-div', children=Dropdown(id='manda-type', placeholder='Select M & A Type', options=[{ 'label': v, 'value': v } for v in data['tlist']], value='Merger/Acquisition')), Tooltip(children='Select M & A Type to Filter M & A History', id='manda-type-tip', target='manda-type-div', placement='left') ], className='dis nop', width=3, ), ], id='manda-tool', fluid=True, style={'padding': '0rem'}), id='manda-wrap', hidden=hide)
def hello() -> Div: ''' Returns the hello page ''' return Container([ Row([ Col([ H1('Hello, World!'), Br(), Input(id='hello_input', value='', type='text', placeholder='Enter name', debounce=True), Br(), Div(id='hello_output'), internal_link('Home', href='/'), ]) ]) ])
def get_main_layout(main_window_col_10, side_menu_col_2, top_navbar, bottom_navbar=None): """ :param bottom_navbar: dash_bootstrap_components.Navbar :param main_window_col_10: dash_bootstrap_components. :param side_menu_col_2: dash_bootstrap_components. :param top_navbar: dash_bootstrap_components.Navbar :return: """ this_layout = Container( [ Row( Col([ top_navbar, Row([side_menu_col_2, main_window_col_10]) # ,bottom_navbar ])) ], fluid=True) return this_layout
def get_html(self) -> List[ComponentMeta]: """Initializes the header dash html """ today = date.today().strftime(self.content["date-format"]) return [ Container( className="mt-5", children=[ H2(self.content["new-admissions-title"]), Markdown(self.content["new-admissions-text"]), ] ), Container(fluid=True, children=Graph(id="new_admissions_graph")), Container([ A( self.content["download-text"], id="new_admissions_download", download="admissions_{}.csv".format(today), href="", target="_blank", className="btn btn-sm btn-info", ), Div( children=Button( "Lock Zoom", id="new_admissions_lock_zoom", color="info", outline=False, className="btn btn-sm" ), style={"display": "inline-block", "padding": 10} ), Div( className="row justify-content-center", children=Div( id="new_admissions_table_container", className="col-auto", children=Table( id="new_admissions_table", className="table-responsive mx-auto" ), ), ), ]), Container( className="mt-5", children=[ H2(self.content["admitted-patients-title"]), Markdown(self.content["admitted-patients-text"]), ], ), Container(fluid=True, children=Graph(id="admitted_patients_graph")), Container([ A( self.content["download-text"], id="admitted_patients_download", download="census_{}.csv".format(today), href="", target="_blank", className="btn btn-sm btn-info", ), Div( children=Button( "Lock Zoom", id="admitted_patients_lock_zoom", color="info", outline=False, className="btn btn-sm" ), style={"display": "inline-block", "padding": 10} ), Div( className="row justify-content-center", children=Div( id="admitted_patients_table_container", className="col-auto", children=Table( id="admitted_patients_table", className="table-responsive" ), ), ), ]), Container( className="mt-5", children=[ H2(self.content["SIR-title"]), Markdown(self.content["SIR-text"]), ], ), Container(fluid=True, children=Graph(id="SIR_graph")), Container([ A( self.content["download-text"], id="SIR_download", download="SIR_{}.csv".format(today), href="", target="_blank", className="btn btn-sm btn-info my-4", ), Div( children=Button( "Lock Zoom", id="SIR_lock_zoom", color="info", outline=False, className="btn btn-sm" ), style={"display": "inline-block", "padding": 10} ), Div( className="row justify-content-center", children=Div( id="SIR_table_container", className="col-auto", children=Table( id="SIR_table", className="table-responsive" ), ), ), ]) ]
selected = dot({'shop': None, 'kind': None}) #TODO: #Dropdown limit #Shop dropdown? #Line evolution_page = [ Container([ H1('Evolution'), H4('Select product'), P("Shop"), dcc.Dropdown(id='shopEvo', options=[{ 'label': i, 'value': i } for i in shops], value=[i for i in shops], placeholder="Shop"), P("Kind"), dcc.Dropdown(id='productEvo', ), Button("Load Products", id="LoadNamesEvo", n_clicks=0), P("Product name"), dcc.Dropdown(id='evolutionDropdown', ), dcc.Graph(id="evolutionGraph") ], id='app-main-evolution') ] @app.callback(DOutput("LoadNamesEvo", "disabled"), [DInput("shopEvo", "value"), DInput("productEvo", "value")])
from app import app from dash_bootstrap_components import Container from dash_html_components import H1 from dash.dependencies import Input as DInput from dash.dependencies import Output as DOutput from dotmap import DotMap as dot import pandas as pd import dash_core_components as dcc __prices_file = 'csv/prices.csv' prices_df = pd.read_csv(__prices_file) dates = prices_df.name.unique() home_page = [ Container([ H1('Home'), dcc.Dropdown(id='dateDropdown', options=[{ 'label': i, 'value': i } for i in dates], value=[i for i in dates]), ], id='app-main-home') ]
def makeRoot_Contents(): return Container( [ Div(id='store', hidden=True), Modal([ ModalHeader([ B('Welcome to the Global Risk Management Visualization') ]), ModalBody( P([ B('Global risk data for everyone'), P('It is frustrating when you can nott make a qualified assessment on the global risk position of a multinational corporation due to the enormous complexity of its operations. The global risk visualization addresses that challenge by offering the most intuitive options to interact with corporate risk data all in one place.' ), B('Valuable insights through disparate data connections' ), P('By connecting financial performance, global footprint, and national risk data for over 100 countries, the visualization helps you get a better sense of the political, economic and financial risks facing these organizations.' ), Hr(), B('Target Audience:'), P('Investors, Students, Corporate Legal and Researchers' ), Hr(), B('Data Sources:'), P('Yahoo Finance, PRS Global Risk Dataset, Orbis Global Footprint Dataset, and SAP Capital IQ M&A Dataset' ), Hr(), B('Team:'), P('Jay Venkata, Keith Wertsching, and Pri Nonis'), Hr(), Iframe( src= 'https://zoom.us/rec/play/vJYqcu-grzM3SIWW5ASDB_IqW9W9La6sgyke8qdYyx63VSZRYVCuMuYRMAI0fIKQL0LNUUuXXcgTFVo', width=1106, height=650) ])), ModalFooter(Button('Close', id='close', className='ml-auto')), ], id='modal', size='xl', is_open=True), makeRoot_ToolsBar(), Row( [ Col( makeCard('stock-plot', 'manda', hide=False), width=12, ), # Col( # makeCard('table-plot', 'manda', hide = False), # width = 3 # ), ], className='manda'), Row([ Col(makeCard('world-plot', 'risks', hide=True), width=6, style={'paddingRight': '0rem'}), Col(makeCard('total-plot', 'risks', hide=True), width=6), ], className='risks t1p'), Row([ Col(makeCard('burst-plot', 'risks', hide=True), width=3, style={'paddingRight': '0rem'}), Col(makeCard('trend-plot', 'risks', hide=True), width=9), ], className='risks v1p'), ], fluid=True, style={})
def makeRoot_ToolsBar(): _ = \ [ Col([ NavbarBrand( [ Img( src = 'assets/logo.gif', height = '36px', width = '144px', className = 'nop nom' ), ], className = 'nop nom', ), ], className = 'dis nop', width = 2, ), Col([ Label('corporation'), Div(id = 'tools-corp-div', children = Dropdown( id = 'tools-corp', placeholder = 'Select Corporation', options = [{'label' : f'{k} ({v})', 'value' : k} for k, v in data['hdict'].items()], value = 'Apple', searchable = True) ), Tooltip( children = 'Select Corporation to See Stock Market Performance and M & A History', id = 'tools-corp-tip', target = 'tools-corp-div', placement = 'right') ], className = 'dis nop r1p', width = 2, ), Col([ makeRoot_MandABar(), makeRoot_RisksBar() ], className = 'nop r1p', width = 6, ), Col([ Label('current view'), DropdownMenu( [ DropdownMenuItem('Mergers & Acquisitions', id = 'manda-pick'), DropdownMenuItem('Corporate Global Risks', id = 'risks-pick'), ], id = 'views-pick', label = 'Corporate Global Risks', color = 'primary', style = {'lineHeight' : '22px'}, className = '' ), Tooltip( children = 'Select Activity View', id = 'views-pick-tip', target = 'views-pick', placement = 'left') ], className = 'dis nop', width = 2 ) ] return Navbar(id='extra-bar', className='rounded v1m', children=Container(_, className='nom nop', fluid=True))
fig = px.bar(prices_today, x='name', y='price',title="Product Prices") bars_page = [ Container([ H1('Bar plot'), H4('Select Date'), dcc.Dropdown( id='dateDropdown', options=[{'label': i, 'value': i} for i in dates], value=[i for i in dates]), H4('Select shop'), dcc.Dropdown( id='shopDropdown', options=[{'label': i, 'value': i} for i in shops], value=[i for i in shops]), H4('Select type of product'), dcc.Dropdown( id='productDropdown', ), Button('Reload', id='loadButton', n_clicks=0), dcc.Graph( id='graph', figure=fig ) ], id='app-main-bars') ]
Container([ H1('Table'), H4('Select type of product'), dcc.Dropdown(id='productDropdown', options=[{ 'label': i, 'value': i } for i in productOptions], value=[i for i in productOptions]), dash_table.DataTable(columns=[{ 'name': 'Name', 'id': 'name', 'type': 'text' }, { 'name': 'Kind', 'id': 'kind', 'type': 'text' }, { 'name': 'Shop', 'id': 'shop', 'type': 'text' }, { 'name': 'Url', 'id': 'url', 'type': 'text' }, { 'name': 'Price', 'id': 'price', 'type': 'numeric' }, { 'name': 'Date', 'id': 'date', 'type': 'datetime' }], data=prices_df.to_dict('records'), filter_action='native', sort_action='native', sort_mode='multi', style_table={ 'height': 400, }, style_data={ 'width': '150px', 'minWidth': '150px', 'maxWidth': '150px', 'overflow': 'hidden', 'textOverflow': 'ellipsis', }, id="table") ], id='app-main-table')
Container([ H1('Comparator'), #First Product H4('Select first product'), P("Shop"), dcc.Dropdown( id='shopCompOne', options=[{'label': i, 'value': i} for i in shops], value=[i for i in shops], placeholder="Shop"), P("Kind"), dcc.Dropdown( id='productCompOne', ), Button("Load Products", id="LoadNamesCompOne", n_clicks=0), P("Product name"), dcc.Dropdown( id='nameCompOne',), #Second Product H4('Select second product'), P("Shop"), dcc.Dropdown( id='shopCompTwo', options=[{'label': i, 'value': i} for i in shops], value=[i for i in shops], placeholder="Shop"), P("Kind"), dcc.Dropdown( id='productCompTwo', ), Button("Load Products", id="LoadNamesCompTwo", n_clicks=0), P("Product name"), dcc.Dropdown( id='nameCompTwo',), #Graph Button("Show comparation graph", id="loadButtonComp", n_clicks=0), dcc.Graph( id="compGraph", ) ], id='app-main-comparator')