style=dict_style['text']['small']) ], style=dict_style['section']['filter_style']) filter_type_of_calls = dbc.FormGroup( [ html.Div('Select type of calls', style=dict_style['text']['small']), dcc.Dropdown(id='filter_type_of_calls', options=ls_opt_filter_type_of_calls, style=dict_style['text']['small']) ], style=dict_style['section']['filter_style']) ##################### Filter card #################### filters = dbc.Card([ dbc.CardHeader('Filters', className='text-center'), dbc.Row([dbc.Col(filter_date_execution), dbc.Col()]), dbc.Row([dbc.Col(filter_segment), dbc.Col(filter_category)]), dbc.Row([dbc.Col(filter_split_skill), dbc.Col(filter_type_of_calls)]), dbc.CardFooter(dbc.Button('Submit filters', color='primary', id='but_submit_filters', block=True, n_clicks=0), style={'margin-top': '20px'}) ], className='m-4' #style={'width':'30%', 'display':'inline-block'}
'height': '60px', 'lineHeight': '60px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', 'margin-bottom': '20px' }), ], justify="center"), images_component, images_component_cell, dbc.Card([ dbc.CardHeader("Similarity Porcentage: {}".format(90), style={ "color": "white", "text-align": "center", "font-size": "20px" }, id="similarity-result"), dbc.CardBody([ dbc.Button("Get Similarity", color="dark", style={ "margin-top": "20px", "margin-bottom": "20px" }, block=True) ]), ], style={ "margin-top": "20px",
import re from typing import Tuple, Optional import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, State import plotly.graph_objects as go import numpy as np import numpy_financial as npf from dash.exceptions import PreventUpdate from app import app first_card = dbc.Card([ dbc.CardHeader("Mortgage details:"), dbc.CardBody([ dbc.FormGroup([ dbc.Label("Deposit size (£ ,000)"), dbc.Input(id="deposit-size", type="number"), ]), dbc.FormGroup([ dbc.Label("Purchase price (£ ,000)"), dbc.Input(id="purchase-price", type="number"), ]), dbc.FormGroup([ dbc.Label("Offer term (years): "), dcc.Slider( id="offer-term", value=3, marks={i: f"{i}"
var_name='Monetary Aggregates', value_name='share_values') df_growth = pd.melt(df_growth, id_vars=cols[0], value_vars=cols[1:], var_name='Monetary Aggregates', value_name='growth_values') categories = df_level['Monetary Aggregates'].unique() height = 600 width = 600 dropdown_level = dbc.Card([ dbc.CardHeader("Levels (Billions of Birr)"), dcc.Dropdown(id='dropdown_level', options=[{ 'label': i, 'value': i } for i in categories], multi=True, value=['Money supply']), ], body=True) dropdown_share = dbc.Card([ dbc.CardHeader("Shares (Percent)"), dcc.Dropdown(id='dropdown_share', options=[{ 'label': i,
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) application = app.server app.title = 'ELISAQuant' app.layout = html.Div([ #header html.Div([ html.H1("ELISAQuant:", className = 'header-item'), html.H4("An app to easily and reproducibly quantify analyte concentration", className = 'header-item') ], id = 'header'), #body html.Div([ html.Div([ dbc.Card([ dbc.CardHeader("Upload Data"), dbc.CardBody([ html.Br(), #data needed to process the data html.Div([ dbc.Label("Choose Template", size = 'lg', style = {'width':'50%'}), dbc.Button(html.Span([html.Img(src=app.get_asset_url('info.png'), style={'height':'100%', 'width':'100%'})]), color = 'link', id = 'temp-info-button', className = 'info-button'), dbc.Modal([ dbc.ModalBody([ html.P("Please use one of the following two templates for your plate:"), html.P("Option 1:"), html.Img(src = app.get_asset_url('option_1.png'), style = {'width': '100%', 'height': '100%'}), html.Br(), html.Br(), html.P("Option 2:"), html.Img(src = app.get_asset_url('option_2.png'), style = {'width': '100%', 'height': '100%'})
def initialize_tables(): children = [ dbc.Row([ dbc.Col( dbc.Card([ dbc.CardHeader( html.H4("Faculty Members", className="card-title")), dbc.CardBody([ dash_table.DataTable( id='faculty_table', columns=[{ "name": i, "id": i, "deletable": False, "selectable": True } for i in faculty_df.columns], data=faculty_df.to_dict('records'), style_table={ 'overflowX': 'auto', 'minWidth': '100%', 'overflowY': 'auto', 'height': 400, }, style_as_list_view=False, style_header={ 'backgroundColor': 'rgb(30, 30, 30)' }, style_cell={ 'backgroundColor': 'rgb(50, 50, 50)', 'color': 'white' }, style_data_conditional=( community_colors(community_color_dict) + data_bars(faculty_df, 'Degree') + data_bars(faculty_df, 'Pagerank')), column_selectable=False, row_selectable=False, row_deletable=False, css=[{ 'selector': '.row', 'rule': 'margin: 0' }], page_current=0, page_size=20, page_action='native', filter_action='native', sort_action='native', # custom sort_mode='multi', ) ]) ])), dbc.Col( dbc.Card([ dbc.CardHeader(html.H4("Students", className="card-title")), dbc.CardBody([ dash_table.DataTable( id='students_table', columns=[{ "name": i, "id": i, "deletable": False, "selectable": True } for i in student_df.columns], data=student_df.sort_values( ['Degree'], ascending=False).to_dict('records'), style_table={ 'overflowX': 'auto', 'minWidth': '100%', 'overflowY': 'auto', 'height': 400, }, style_as_list_view=False, style_header={ 'backgroundColor': 'rgb(30, 30, 30)' }, style_cell={ 'backgroundColor': 'rgb(50, 50, 50)', 'color': 'white' }, style_data_conditional=( community_colors(community_color_dict) + data_bars(student_df, 'Degree') + data_bars(student_df, 'Pagerank')), column_selectable=False, row_selectable=False, row_deletable=False, css=[{ 'selector': '.row', 'rule': 'margin: 0' }], page_current=0, page_size=20, page_action='native', filter_action='native', sort_action='native', # custom sort_mode='multi', ) ]) ])) ]) ] return children
def make_asset_card(asset_info, show_money=True): def get_color(value): if not isinstance(value, (float, int)): return None if value > 0: return 'text-danger' if value < 0: return 'text-success' return None header = dbc.CardHeader([ html.H5( html.A( f'{asset_info["name"]}({asset_info["code"]})', href=f'/asset/{asset_info["code"].replace(".", "").lower()}', target='_blank' ), className='mb-0' ), html.P(f'更新日期 {asset_info["price_date"]}', className='mb-0'), ]) body_content = [] body_content.append( make_card_component( [ {'item_cls': html.P, 'type': 'text', 'content': '持有金额/份额'}, {'item_cls': html.H4, 'type': 'money', 'content': asset_info['money']}, {'item_cls': html.P, 'type': 'amount', 'content': asset_info['amount']} ], show_money=show_money, ) ) body_content.append( make_card_component( [ {'item_cls': html.P, 'type': 'text', 'content': '日收益'}, { 'item_cls': html.H4, 'type': 'money', 'content': asset_info['day_return'], 'color': get_color(asset_info['day_return']), }, { 'item_cls': html.P, 'type': 'percent', 'content': asset_info['day_return_rate'], 'color': get_color(asset_info['day_return']), } ], show_money=show_money, ) ) body_content.append( make_card_component( [ {'item_cls': html.P, 'type': 'text', 'content': '现价/成本'}, {'item_cls': html.H4, 'type': 'price', 'content': asset_info['price']}, {'item_cls': html.P, 'type': 'price', 'content': asset_info['avg_cost'] or 'N/A'} ], show_money=show_money, ) ) asset = Asset.get(zs_code=asset_info['code']) prices = [] for item in asset.history.order_by(AssetMarketHistory.date.desc()).limit(10): if item.close_price is not None: prices.append({ 'date': item.date, 'price': item.close_price, }) else: prices.append({ 'date': item.date, 'price': item.nav, }) if len(prices) >= 10: break prices.sort(key=itemgetter('date')) df = pd.DataFrame(prices) df['date'] = pd.to_datetime(df['date']) fig = go.Figure() fig.add_trace( go.Scatter( x=df['date'], y=df['price'], showlegend=False, marker={'color': 'orange'}, mode='lines+markers', ) ) fig.update_layout( width=150, height=100, margin={'l': 4, 'r': 4, 'b': 20, 't': 10, 'pad': 4}, xaxis={'showticklabels': False, 'showgrid': False, 'fixedrange': True}, yaxis={'showticklabels': False, 'showgrid': False, 'fixedrange': True}, ) fig.update_xaxes( rangebreaks=[ {'bounds': ["sat", "mon"]}, { 'values': get_holidays(df.date.min(), df.date.max(), False) } ] ) body_content.append( make_card_component( [ {'item_cls': html.P, 'type': 'text', 'content': '十日走势'}, { 'item_cls': None, 'type': 'figure', 'content': fig } ], show_money=show_money ) ) body_content.append( make_card_component( [ {'item_cls': html.P, 'type': 'text', 'content': '累计收益'}, { 'item_cls': html.H4, 'type': 'money', 'content': asset_info['return'], 'color': get_color(asset_info['return']), }, { 'item_cls': html.P, 'type': 'percent', 'content': asset_info['return_rate'], 'color': get_color(asset_info['return']), } ], show_money=show_money, ) ) body_content.append( make_card_component( [ {'item_cls': html.P, 'type': 'text', 'content': '占比'}, {'item_cls': html.H4, 'type': 'percent', 'content': asset_info['position']}, ], show_money=show_money, ) ) card = dbc.Card( [ header, dbc.CardBody( dbc.Row( [dbc.Col([card_component]) for card_component in body_content], ), className='py-2', ) ], className='my-auto' ) return card
dbc.CardHeader([ dbc.InputGroup( size="sm", children=[ dbc.Button( id=f"button-fractal-{path}-clear", children="Clear", color="warning", n_clicks=0, ), dbc.DropdownMenu( id=f"dropdownmenu-fractal-{path}", label=f"Fractal {path.capitalize()}", color="primary", direction="right", addon_type="prepend", children=[ dbc.DropdownMenuItem( header=True, children=f"Examples:", ) ] + [ dbc.DropdownMenuItem( id=f"dropdownmenuitem-fractal-{key}-{path}", children=key, n_clicks=0, ) for key in Fractal.example_paths[path].keys() ], ), dbc.Input( f"input-fractal-{path}", value="Custom Linear Shape", disabled=False, ), dbc.Button( id=f"button-fractal-{path}-undo", children="Undo", color="primary", n_clicks=0, ), dbc.InputGroupText( children="Modifying:", ), dbc.Button( id=f"button-fractal-{path}-mod", children=fractal_segment_datum["name"], color="primary", n_clicks=1, ), ], ), ]),
# Local Imports from gui.app import app from utils.router import Router router = Router() page = html.Div(children=[ dbc.Row([ # DASHBOARD dbc.Col([ # GENERAL INFO html.Div([ dbc.Card([ dbc.CardHeader(html.P('Account Balance', className='label')), dbc.CardBody([ html.P('$3203.71') ]) ]) ], className='dashboard-element-div'), # POSITIONS html.Div([ dbc.Card([ dbc.CardHeader(html.P('Top Positions', className='label')), dbc.CardBody([ html.P('QQQ: $276.71 (0.37%)'), html.P('TSLA: $420.69 (0.31%)'), html.P('GLD: $315.81 (0.27%)'), html.P('FNV: $154.17 (0.26%)'),
def layout(self): return dbc.Card([ make_hideable(dbc.CardHeader([ html.Div([ html.H3(self.title, id='decisionpath-title-' + self.name), make_hideable(html.H6(self.subtitle, className='card-subtitle'), hide=self.hide_subtitle), dbc.Tooltip(self.description, target='decisionpath-title-' + self.name), ]), ]), hide=self.hide_title), dbc.CardBody([ dbc.Row([ make_hideable(dbc.Col([ dbc.Label(f"{self.explainer.index_name}:", id='decisionpath-index-label-' + self.name), dbc.Tooltip( f"Select {self.explainer.index_name} to display decision tree for", target='decisionpath-index-label-' + self.name), self.index_selector.layout(), ], md=4), hide=self.hide_index), make_hideable(dbc.Col([ dbc.Label("Show tree:", id='decisionpath-tree-label-' + self.name), dbc.Tooltip( f"Select decision tree to display decision tree for", target='decisionpath-tree-label-' + self.name), dbc.Select( id='decisionpath-highlight-' + self.name, options=[{ 'label': str(tree), 'value': tree } for tree in range(self.explainer.no_of_trees)], value=self.highlight) ], md=2), hide=self.hide_highlight), make_hideable(dbc.Col([self.selector.layout()], width=2), hide=self.hide_selector), make_hideable(dbc.Col([ dbc.Button("Generate Tree Graph", color="primary", id='decisionpath-button-' + self.name), dbc.Tooltip( "Generate visualisation of decision tree. " "Only works if graphviz is properly installed," " and may take a while for large trees.", target='decisionpath-button-' + self.name) ], md=2, align="end"), hide=self.hide_button), ]), dbc.Row([ dbc.Col([ dcc.Loading(id="loading-decisionpath-" + self.name, children=html.Img(id="decisionpath-svg-" + self.name)), ]), ]), ]), ])
dbc.NavItem(dbc.NavLink("USF Covid Website", href="https://www.usf.edu/coronavirus/", target='__black', external_link=True, style=dict(hover=const.COLORS.LIGHT_GOLD))) ], brand="COVID-19 Dashboard for University of South Florida ", style=dict(overflowX='hidden', borderBottom='solid 1px white'), brand_href="/home", color=const.COLORS.LIGHT_GREEN, fluid=True, dark=True, id='navigation', expand='lg', ) # Cards tampa_card_content = [ dbc.CardHeader(html.H4("Tampa Campus"), style=dict(color=const.COLORS.DARK_GREEN, background=const.COLORS.LIGHT_GREY)), dbc.CardBody( [ html.H4("Total Cases", className="card-title"), html.H5( "", id='tampa_card_total_cases', className="card-text", ), html.H4('Latest Update', className='card-title'), html.H5( "", id='tampa_card_update', className="card-text", ),
def make_card(i): return dbc.Card([ dbc.CardHeader( dbc.Button( 'RL010101', color='link', n_clicks=0, id=f'edit-rules-group-{i}-toggle' ) ), dbc.Collapse([ dbc.CardBody([ dbc.Row([ dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'Tag', addon_type='prepend', className='input-group-prepend-110' ), dbc.Input(), ]) ], xs=12, sm=12, md=4, lg=4, xl=4), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'IP Rad.', addon_type='prepend', className='input-group-prepend-110' ), dbc.Input(), ]) ], className='breakColLine', xs=12, sm=12, md=4, lg=4, xl=4), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'IP Equip.', addon_type='prepend', className='input-group-prepend-110' ), dbc.Input(), ]) ], className='breakColLine', xs=12, sm=12, md=4, lg=4, xl=4), ], className='breakRowLine'), dbc.Row([ dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'FE', addon_type='prepend', className='input-group-prepend-110' ), dbc.Input(), ]) ], xs=12, sm=12, md=4, lg=4, xl=4), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'CN', addon_type='prepend', className='input-group-prepend-110' ), dbc.Input(), ]) ], className='breakColLine', xs=12, sm=12, md=4, lg=4, xl=4), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'Protocolo', addon_type='prepend', className='input-group-prepend-110' ), dbc.Select(options=[ dict(label='', value=''), dict(label='UDP', value='UDP'), dict(label='TCP', value='TCP'), ]), ]) ], className='breakColLine', xs=12, sm=12, md=4, lg=4, xl=4), ], className='breakRowLine'), dbc.Row([ dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'Porta Tx', addon_type='prepend', className='input-group-prepend-110' ), dbc.Input(), ]) ], xs=12, sm=12, md=4, lg=4, xl=4), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'Porta Rx', addon_type='prepend', className='input-group-prepend-110' ), dbc.Input(), ]) ], className='breakColLine', xs=12, sm=12, md=4, lg=4, xl=4), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon( 'Regra', addon_type='prepend', className='input-group-prepend-110' ), dbc.Select(options=[ dict(label='', value=''), dict(label='Ativa', value='A'), dict(label='Inativa', value='I'), ]), ]) ], className='breakColLine', xs=12, sm=12, md=4, lg=4, xl=4), ], className='breakRowLine'), ]), ], id=f"edit-rules-collapse-{i}") ])
asignar = [] for row in labels: asignar.append(colores[row]) f1 = basec[slct_axisX].values f2 = basec[slct_axisY].values fig40 = go.Figure(data=go.Scattergl( x=f1, y=f2, mode='markers', marker=dict(color=asignar, colorscale='Viridis', line_width=1))) return fig40 # ----------------------------------------------------------- card1 = dbc.Card([ dbc.CardHeader("¿Que es el Secop"), dbc.CardBody( "El (SECOP) también denominado Servicio Electrónico de Contratación Pública por sus siglas en español, es un sistema que permite " "a las entidades estatales cumplir con las obligaciones de publicidad de los diferentes actos expedidos en los procesos contractuales " "y permite a los interesados en participar en los procesos de contratación, proponentes, veedurías y a la ciudadanía en general, consultar " "el estado de los mismos.") ]) #Page-1 card2 = dbc.Card([ dbc.CardHeader("Total de inversión por mil personas"), dbc.CardBody( "Este indicador permite conocer la inversión territorial de cada departamento por cada mil personas. Permite estandarizar la inversión de acuerdo con " "la población de cada departemento, lo que hace que la inversión sea analizada de manera objetiva" ) ]) card3 = dbc.Card([
O['T2,0,0'] = TAB2.RC00.values O['T2,1,0'] = TAB2.RC10.values O['T3,0,0'] = TAB3.RC00.values O['T3,1,0'] = TAB3.RC10.values O['T4,0,0'] = TAB4.RC00.values O['T4,1,0'] = TAB4.RC10.values O['T5,0,0'] = TAB5.RC00.values O['T5,1,0'] = TAB5.RC10.values O['T6,0,0'] = TAB5.RC00.values O['T6,1,0'] = TAB5.RC10.values O['T6,2,0'] = TAB5.RC10.values O['T6,3,0'] = TAB5.RC10.values C = { } # color code : primary, secondary, info, success, warning, danger, light, dark C['T1,0,0'] = [ dbc.Card([dbc.CardHeader(T['T1,0,0']), dbc.CardBody(O['T1,0,0'])], color='light', inverse=False, outline=True) ] C['T1,1,0'] = [ dbc.Card([dbc.CardHeader(T['T1,1,0']), dbc.CardBody(O['T1,1,0'])], color='light', inverse=False, outline=True) ] C['T2,0,0'] = [ dbc.Card([dbc.CardHeader(T['T2,0,0']), dbc.CardBody(O['T2,0,0'])],
from dash.dependencies import Input, Output, State from plotly import graph_objs as go from sentiment import dashapp __navbar = dbc.NavbarSimple(children=[ dbc.NavItem(dbc.NavLink('API', href='/api/', external_link=True)) ], brand='SOCIAL MEDIA ANALYTICS', brand_href='#', sticky='top') __metrics = dbc.Container([ html.Br(), dbc.Card([ dbc.CardHeader(html.H5('MODEL TRAINING METRICS')), # dbc.CardBody(id='card-body-metrics') dbc.CardBody( dbc.Row([ dbc.Col('DATA SET'), dbc.Col('MODEL'), dbc.Col('CONFUSION MATRIX'), dbc.Col('CLASSIFICATION REPORT'), ])) ]), html.Br() ]) __upper = dbc.Container([ html.Br(), dbc.Row( dbc.Col(
T['T,0,1'] = 'T__' T['T,1,0'] = 'T__' T['T,1,1'] = 'T__' T['T,2,0'] = 'T__' T['T,2,1'] = 'T__' O = {} O['T,_,_'] = None O['T,0,0'] = TAB1.RC00.values O['T,1,0'] = TAB1.RC10.values O['T,1,1'] = TAB1.RC11.values O['T,2,0'] = TAB1.RC20.values O['T,2,1'] = TAB1.RC21.values C = { } # color code : primary, secondary, info, success, warning, danger, light, dark C['T,0,0'] = [ dbc.Card([dbc.CardHeader(T['T,0,0']), dbc.CardBody(O['T,0,0'])], color='light', inverse=False, outline=True) ] C['T,1,0'] = [ dbc.Card([dbc.CardHeader(T['T,1,0']), dbc.CardBody(O['T,1,0'])], color='light', inverse=False, outline=True) ] C['T,1,1'] = [ dbc.Card([dbc.CardHeader(T['T,1,1']), dbc.CardBody(O['T,1,1'])],
font_color='#333') return fig slider = dcc.Slider(min=2015, max=2020, value=2020, marks={i: i for i in range(2015, 2021)}, id='page_customer_suppliers_relation_slider') layout = \ dbc.Container([ dbc.Row([ dbc.Col([]), ], md=12), dbc.Row([ dbc.Col([ dbc.Card([ dbc.CardHeader("Основные поставщики"), dbc.CardBody([ dcc.Graph(id="page_customer_plot_suppliers_relation"), slider ]), ]), ], md=12), ]), ])
def Pitcher_Base_layout(app): app.title = "KBO analysis" year = count_year() team_name = [] pitcher_name = [] app.layout = html.Div([ baselayout, # 그래프 dbc.Container( [ dbc.Row( dbc.Col(children=[html.H2("선수를 선택해 주세요")], style={ 'margin-top': 80, 'margin-right': 10, 'margin-left': 10 }, id="title")), dbc.Row( dbc.Col( dbc.Alert( "해당 분석은 한국프로야구단 공식 홈페이지인 KBO에서 스크래핑한 데이터를 바탕으로 진행되었습니다.", color="secondary", style={ 'margin-top': 10, 'margin-right': 10, 'margin-left': 10 }))), dbc.Row([ dbc.Col(children=[ dbc.Card( [ dbc.CardHeader("최근 선수 스탯"), dbc.CardBody(dcc.Graph(id='graph1')), ], style={ 'width': "auto", 'margin-top': 20, 'margin-left': 10, 'margin-right': 10, 'margin-bottom': 20 }), dbc.Card( [ dbc.CardHeader("월별 피출루율 빈도"), dbc.CardBody(dcc.Graph(id='graph3')), ], style={ 'width': "auto", 'margin-top': 20, 'margin-left': 10, 'margin-right': 10, 'margin-bottom': 20 }) ], xs=12, sm=12, md=6, lg=6), dbc.Col(dbc.Card( [ dbc.CardHeader("연도별 스탯 변화 추이"), dbc.CardBody(dcc.Graph(id='graph2')) ], style={ 'width': "auto", 'margin-top': 20, 'margin-left': 10, 'margin-right': 10, 'margin-bottom': 20 }), xs=12, sm=12, md=6, lg=6), ], no_gutters=True, justify="around"), ], id="graphs", style={ "width": "auto", 'margin-left': 210, 'color': None, "transition": "all .2s", "z-index": -1 }, fluid=True), # 사이드바 html.Div( [ html.Div( [ dbc.Nav([ html.P("Main", style={ 'color': '#7E8083', 'font-size': '80%' }), html.Li( dbc.Row([ dbc.Col(html.I( className="fas fa-table fa-2x", style={ 'color': '#FFFFFF', 'margin-top': 10, 'font-size': 18 }), width="auto"), dbc.Col( dbc.NavItem( dbc.NavLink( "Pitchers", href= "http://127.0.0.1:5000/pitchers/", id="pitchers", style={ "color": "#FFFFFF", 'margin-left': -28 }))), dbc.Col(dbc.NavItem( dbc.NavLink( html.I( className= "fas fa-chevron-right fa-xs", style={ 'color': '#FFFFFF', 'margin-top': 8 }), href= "http://127.0.0.1:5000/pitchers/") ), width=3) ])), html.Div( [ dbc.Row([ dbc.Col( dcc.Dropdown( id='year_select', options=[{ 'label': i, 'value': i } for i in year], value='year_select', placeholder="year", )), dbc.Col( dcc.Dropdown( id='team_name_select', options=[{ 'label': i, 'value': i } for i in team_name], value='team_select', placeholder="team", )) ], no_gutters=True, align="center", justify="center"), html.Br(), dcc.Dropdown( id='pitcher_name_select', options=[{ 'label': i, 'value': i } for i in pitcher_name], value='pitcher_select', placeholder="Choose a pitcher", ) ], style={ 'width': '100%', 'display': 'inline-block', 'font-size': '80%', 'margin-bottom': 80, 'margin-top': 5 }), html.P("Others", style={ 'color': '#7E8083', 'font-size': '80%' }), html.Li( dbc.Row([ dbc.Col(html.I( className="fas fa-project-diagram", style={ 'color': '#7E8083', 'margin-top': 12 }), width="auto"), dbc.Col( dbc.NavItem( dbc.NavLink( "Teams", href= "http://127.0.0.1:5000/teams/", id="teams", style={ "color": "#7E8083", 'margin-left': -30 }))), dbc.Col(dbc.NavItem( dbc.NavLink( html.I( className= "fas fa-chevron-right fa-xs", style={ 'color': '#7E8083', 'margin-top': 8 }), href="http://127.0.0.1:5000/teams/" )), width=3) ])), html.Li( dbc.Row([ dbc.Col(html.I( className="fas fa-chart-bar fa-2x", style={ 'color': '#7E8083', 'margin-top': 11, 'font-size': 20 }), width="auto"), dbc.Col( dbc.NavItem( dbc.NavLink( "Batters", href= "http://127.0.0.1:5000/batters/", id="batters", style={ "color": "#7E8083", 'margin-left': -30 }))), dbc.Col(dbc.NavItem( dbc.NavLink( html.I( className= "fas fa-chevron-right fa-xs", style={ 'color': '#7E8083', 'margin-top': 8 }), href= "http://127.0.0.1:5000/batters/")), width=3) ])), html.Li( dbc.Row([ dbc.Col(html.I( className="fas fa-balance-scale fa-2x", style={ 'color': '#7E8083', 'margin-top': 11, 'font-size': 17, 'margin-left': -1.5 }), width="auto"), dbc.Col( dbc.NavItem( dbc.NavLink( "Comparer", href= "http://127.0.0.1:5000/comparer/", id="comparer", style={ "color": "#7E8083", 'margin-left': -30 }))), dbc.Col(dbc.NavItem( dbc.NavLink( html.I( className= "fas fa-chevron-right fa-xs", style={ 'color': '#7E8083', 'margin-top': 8 }), href= "http://127.0.0.1:5000/comparer/") ), width=3) ])) ], vertical="md", horizontal='start', className="ml-auto"), ], id="sidebar", style={ "position": "fixed", "top": 55, "left": "0", "bottom": 0, "width": "13rem", "padding": "2rem 1rem", "background-color": "#353A3F", "transition": "left .2s" }) ], id="side", style={ "position": "fixed", "top": 55, "left": "0", "bottom": 0, "width": "100%", "background-color": "rgba(0, 0, 0, 0.5)", "transition": "left .2s", }) ]) @app.callback(Output('team_name_select', "options"), Input('year_select', "value")) def team_name_list(value): team_name = get_team_name(value) return [{'label': i, 'value': i} for i in team_name] @app.callback( Output('pitcher_name_select', "options"), [Input('year_select', "value"), Input('team_name_select', "value")]) def pitcher_name_list(value1, value2): pitcher_name = pitcher_list(value1, value2) return [{'label': i, 'value': i} for i in pitcher_name] @app.callback(Output('title', 'children'), Input('pitcher_name_select', "value")) def pitcher_select_name(value): if value != 'pitcher_select' and value != None: children = [html.H2(f"{value} 선수의 분석결과 입니다.")] else: children = [html.H2("선수를 선택해 주세요")] return children @app.callback( Output('pitcher_name_select', "value"), [Input('year_select', "value"), Input('team_name_select', "value")]) def test_one(value1, value2): if value1 == None or value2 == None: return None @app.callback(Output("sidebar", "style"), Output("graphs", "style"), Output("side", "style"), [Input("sidebtn", "n_clicks")], [ State("sidebar", "style"), State("graphs", "style"), State("side", "style") ]) def toggle(n, style1, style2, style3): if n and style1['left'] == "0" and style2['margin-left'] == 210: style1['left'] = "-13rem" style2['margin-left'] = 0 style3['width'] = 0 return style1, style2, style3 else: style1['left'] = "0" style2['margin-left'] = 210 style3['width'] = "100%" return style1, style2, style3 @app.callback(Output("graph1", "figure"), Output("graph2", "figure"), [ Input('team_name_select', "value"), Input('pitcher_name_select', "value") ]) def pitcher_stat(value1, value2): scores, df = pitcher_yearly_base(value1, value2) fig1 = go.Figure( go.Bar(x=scores[-1][3:], y=['평균실점(RA9) ', '평균자책점(ERA) ', '수비무관투구(FIP) '], orientation='h', marker_color='#000000', width=0.4, opacity=0.6)) fig1.update_layout(margin=dict(l=0, r=0, t=0, b=0), template='plotly_white', yaxis=dict(showticklabels=True, ticks='', tickfont_size=15), height=300, showlegend=False) fig2 = make_subplots(rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.1, specs=[[{ "type": "scatter" }], [{ "type": "table" }]]) fig2.add_trace( go.Scatter(x=df['YEAR'], y=df['RA9'], name='평균실점(RA9)', marker_color='#243858')) fig2.add_trace( go.Scatter(x=df['YEAR'], y=df['ERA'], name='평균자책점(ERA)', marker_color='#EC7D7A')) fig2.add_trace( go.Scatter(x=df['YEAR'], y=df['FIP'], name='수비무관투구(FIP)', marker_color='#F5CA6F')) fig2.add_trace( go.Table( columnorder=[1, 2, 3, 4, 5], columnwidth=[7.5, 10, 10, 10, 10], header=dict(values=['YEAR', 'RA9', 'ERA', 'FIP'], height=32, fill_color='#6E757C', line_color='#6E757C', align='center', font=dict(color='white')), cells=dict(values=[df.YEAR, df.RA9, df.ERA, df.FIP], fill_color='white', line_color='#6E757C', font=dict(color='black'), align='center', height=32), ), 2, 1) fig2.update_layout(height=695, margin=dict(l=0, r=0, t=0, b=0), template='plotly_white', yaxis=dict(anchor="free", side="left", position=0.015), xaxis=dict(tickmode='linear', dtick=1), legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0)) return fig1, fig2 @app.callback(Output("graph3", "figure"), [ Input('team_name_select', "value"), Input('pitcher_name_select', "value") ]) def pitcher_graph(value1, value2): temp = pitcher_prop(value1, value2) fig = go.Figure() fig.add_trace( go.Scatter(x=temp['date'], y=temp['OBP'], mode='markers', name='피출루율(OBP)', marker=dict(size=10, color=temp['OBP'], colorscale='Viridis', showscale=True))) fig.update_layout(margin=dict(l=0, r=0, t=0, b=0), template='plotly_white', height=300, legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1)) return fig return app
dbc.NavbarBrand("Emerging Risk Detection", className="ml-2")), ], align='center', no_gutters=True, ), href='https://github.com/Dhruv26/10K-emerging-risk-detection', ) ], color="dark", dark=True, sticky="top", ) WORDCLOUD_PLOTS = [ dbc.CardHeader(html.H5("Risks for a company")), dbc.CardBody( [ dcc.Loading( id="loading-bigrams-comps", children=[ dbc.Alert( "Something's gone wrong! Give us a moment, but try loading this page again if problem persists.", id="no-data-alert-bigrams_comp", color="warning", style={"display": "none"}, ), dbc.Row([ dbc.Col(html.P("Choose two companies to compare:"), md=12), dbc.Col(
import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html import bing_maps_smartcity as bms from data.bingmaps_data import pp_roadworks, pp_congestions, pp_webcams, pp_energy, pl_roadworks, pg_webcams ################## # Row 0 - Functionality Tree ################## func_tree = html.Div([ dbc.Button([ html.Img(src = './static/down-icon.png', className = 'icon d-inline-block mb-1', ), ], id = 'overview_tree_button', outline=False, className = 'tree_button'), dbc.Collapse([ dbc.Card([ dbc.CardHeader('Functionality Tree', className = 'card_header'), html.Img(src='./static/Showcase UI Overview.jpg', style=dict(height = '500px')), ], className = 'card py-2') ],id="overview_tree_collapse",)]) ################## # Map ################## card_map = dbc.Card([dbc.CardHeader('City Detection Points', className = 'card_header'), # return bingmap in callback bms.BingMaps( id = 'city-map', polygons = pg_webcams, polylines = pl_roadworks, pushpins = pp_roadworks + pp_congestions + pp_webcams + pp_energy )
state_recovered = df_state[df_state['State'] == v_index]['Recovered'] state_deceased = df_state[df_state['State'] == v_index]['Deaths'] return state_confirmed,state_active,state_recovered,state_deceased body = html.Div([ html.H1("COVID INDIA DASHBOARD",style={ 'textAlign': 'center', 'height' :'75px', 'font-size':'50px', 'color': '#ffffff' }) #cards ,dbc.Row([ dbc.Col(dbc.Card([ dbc.CardHeader([html.H4("Confirmed",style={'height':'10px','font-size':'20px'})]), dbc.CardBody([ html.P(india_confirmed,style={'font-size':'20px'}) ]), ], color="danger", inverse=True,style={"height": "10rem",'textAlign':'center'})) ,dbc.Col(dbc.Card([ dbc.CardHeader([html.H4("Active",style={'height':'10px','font-size':'20px'})]), dbc.CardBody([ html.P(india_active,style={'font-size':'20px'}) ]) ], color="warning", inverse=True,style={"height": "10rem",'textAlign':'center'})) ,dbc.Col(dbc.Card([ dbc.CardHeader([html.H4("Recovered",style={'height':'10px','font-size':'20px'})]), dbc.CardBody([
import dash_html_components as html from dash.dependencies import Input, Output, State app = dash.Dash(__name__, external_stylesheets=[dbc.themes.LUMEN ]) # https://bootswatch.com/default/ app.layout = html.Div([ html.Div(html.H6( "Product: a beautiful Pizza reheated after a day in the fridge, for $99" ), style={"text-align": "center"}), html.Hr(), dbc.CardHeader( dbc.Button( "Why should I buy reheated pizza for $99?", color="link", id="button-question-1", )), dbc.Collapse(dbc.CardBody("Because it's a lot better than a hotdog."), id="collapse-question-1", is_open=False), dbc.CardHeader( dbc.Button( "Does it have extra cheese?", color="link", id="button-question-2", )), dbc.Collapse(dbc.CardBody( "Yes, and it is made from the goats of Antarctica, which keeps the cheese cold and fresh." ), id="collapse-question-2",
dropdown = dbc.Card([ dcc.Dropdown(id='id_holding', options=[{ 'label': i, 'value': i } for i in categories], multi=True, value=categories), ], body=True) levels = dbc.Card( [ dcc.Graph(id='id_levels'), html.Small("Source: National Bank of Ethiopia"), dbc.CardHeader(dbc.Button("Notes", color="link", id="button_levels")), dbc.Collapse(dbc.CardBody(""" This variable is stock. So, one would expect an increasing trend over time. """), id="collapse_levels", is_open=False), ], body=True, ) growth = dbc.Card( [ dcc.Graph(id='id_growth'), html.Small("Source: National Bank of Ethiopia"),
@app.callback(Output('debugger_div', 'children'), [Input('page_market_plot_change_prices', 'selectedData')]) def selected_data(selected): print(selected) # View layout = \ dbc.Container([ inputs.layout, dbc.Row([ dbc.Col([ dbc.Card([ dbc.CardHeader("Заказчики"), dbc.CardBody([ html.Div(id="page_market_table_top_customers", className='data-table'), ]), ]), ], md=12), ]), dbc.Row([ dbc.Col([ dbc.Card([ dbc.CardHeader("Поставщики"), dbc.CardBody([ html.Div(id="page_market_table_top_suppliers", className='data-table'), ]), ]), ], md=12),
], no_gutters=True, className="mt-2"), dbc.Row(children=dbc.Col(html.Div("A single, half-width column, width=6", className="bg-secondary p-2"), width=6), className="mt-2"), dbc.Row(children=dbc.Col(html.Div("An automatically sized column", className="bg-secondary p-2"), width="auto"), className="mt-2"), # 卡片类 ======================================================================================== html.Div(children=dbc.Row(children=[ dbc.Col(children=dbc.Card([ dbc.CardHeader("Header"), dbc.CardBody([ dbc.CardTitle("This card has a title"), dbc.CardText("And some text"), ]), ])), dbc.Col(children=dbc.Card([ dbc.CardBody([ dbc.CardTitle("This card has a title"), dbc.CardText("and some text, but no header"), ]), ], outline=True, color="primary")), dbc.Col(children=dbc.Card([ dbc.CardBody([
isosurfs_vtk.append(child) # ----------------------------------------------------------------------------- # 3D Viz # ----------------------------------------------------------------------------- vtk_view = dash_vtk.View(id="vtk-view", children=vehicle_vtk + isosurfs_vtk) # ----------------------------------------------------------------------------- # Control UI # ----------------------------------------------------------------------------- controls = [ dbc.Card([ dbc.CardHeader("Geometry"), dbc.CardBody([ dcc.Checklist( id="geometry", options=[{ 'label': ' body', 'value': 'body' }, { 'label': ' drivetrain', 'value': 'drive-train' }, { 'label': ' front-wing', 'value': 'front-wing' }, { 'label': ' rear-wing', 'value': 'rear-wing'
""" dff = pd.DataFrame(rows) fig = go.Figure( data=[ go.Bar(name="Confirmed", x=dff["Country/Region"], y=dff["Confirmed"],marker_color=' #40A0E0'), go.Bar(name="Recovered", x=dff["Country/Region"], y=dff["Recovered"],marker_color='SeaGreen'), go.Bar(name="Dead", x=dff["Country/Region"], y=dff["Dead"],marker_color='grey'), ] ) fig.update_layout(barmode="stack", margin=dict(l=10, r=5, t=10, b=5), height=250, width=718) return html.Div([dcc.Graph(figure=fig)]) # cards for world figured: world confirmed cases, world recovered cases, world dead cases card_confirmed = [ dbc.CardHeader("WORLD CONFIRMED CASES", style={"fontSize": 12, "fontWeight": "bold"}), dbc.CardBody( [ # html.H5("Card title", className="card-title"), html.P("%.2f" % int(data_table["Confirmed"].sum()), style={"fontSize": 15, "fontWeight": "bold"}), ] ), ] card_recovered = [ dbc.CardHeader("WORLD RECOVERED CASES", style={"fontSize": 12, "fontWeight": "bold"}), dbc.CardBody( [ # html.H5("Card title", className="card-title"), html.P("%.2f" % round(data_table["Recovered"].sum()), style={"fontSize": 15, "fontWeight": "bold"}), ]
def create_poltab_card_pol(projdf, compdf, poldf, poldata): polname = '' desc = '' projusedin_cols = [ {"name": ['Project'], "id": "projname"}, {"name": ['Project Version'], "id": "projvername"}, ] compusedin_cols = [ {"name": ['Component'], "id": "compname"}, {"name": ['Component Version'], "id": "compvername"}, ] usedbyprojstitle = html.P('Projects with Violations:', className="card-text", ) usedbycompstitle = html.P('Components with Violations:', className="card-text", ) projstable = dash_table.DataTable( columns=projusedin_cols, style_header={'backgroundColor': 'rgb(30, 30, 30)', 'color': 'white'}, id='poltab_card_projtable' ) compstable = dash_table.DataTable( columns=compusedin_cols, style_header={'backgroundColor': 'rgb(30, 30, 30)', 'color': 'white'}, # data=comps_data.to_dict('records'), # page_size=4, sort_action='native', # row_selectable="single", # sort_by=[{'column_id': 'score', 'direction': 'desc'}], # merge_duplicate_headers=False, id='poltab_card_comptable' ) projselbutton = html.Div( dbc.Button("Filter on Project", color="primary", className="mr-1", id="filter_polcard_proj_button", size='sm'), ) compselbutton = html.Div( dbc.Button("Filter on Component", color="primary", className="mr-1", id="filter_polcard_comp_button", size='sm'), ) if poldata is not None: polid = poldata['polid'] polname = poldata['polname'] desc = poldata['desc'] # projlist = [] # projverlist = [] # for projid in projpolmapdf[projpolmapdf['polid'] == polid].projverid.unique(): # projlist.append(projdf[projdf['projverid'] == projid].projname.values[0]) # projverlist.append(projdf[projdf['projverid'] == projid].projvername.values[0]) # # complist = [] # compverlist = [] # for compid in comppolmapdf[comppolmapdf['polid'] == polid].compverid.unique(): # complist.append(compdf[compdf['compverid'] == compid].compname.values[0]) # compverlist.append(compdf[compdf['compverid'] == compid].compvername.values[0]) # projlist = [] projverlist = [] for projid, row in projdf.iterrows(): if len(poldf[(poldf['polid'] == polid)]) > 0: projlist.append(row['projname']) projverlist.append(row['projvername']) complist = [] compverlist = [] for compid in compdf.index.values: if len(poldf[(poldf['polid'] == polid)]) > 0: complist.append(compdf.loc[compid]['compname']) compverlist.append(compdf.loc[compid]['compvername']) projs_data = pd.DataFrame({ "projname": projlist, "projvername": projverlist }) projstable = dash_table.DataTable( columns=projusedin_cols, data=projs_data.to_dict('records'), style_header={'backgroundColor': 'rgb(30, 30, 30)', 'color': 'white'}, page_size=4, sort_action='native', row_selectable="single", filter_action='native', merge_duplicate_headers=False, id='poltab_card_projtable' ) comps_data = pd.DataFrame({ "compname": complist, "compvername": compverlist }) compstable = dash_table.DataTable( columns=compusedin_cols, data=comps_data.to_dict('records'), style_header={'backgroundColor': 'rgb(30, 30, 30)', 'color': 'white'}, page_size=4, sort_action='native', row_selectable="single", filter_action='native', merge_duplicate_headers=False, id='poltab_card_comptable' ) return dbc.Card( [ dbc.CardHeader("Policy Details"), dbc.CardBody( [ html.H4("Policy: " + polname, className="card-title"), # html.H6("Description: " , className="card-subtitle"), html.P(desc), ], ), usedbyprojstitle, projstable, projselbutton, usedbycompstitle, compstable, compselbutton, ], id="poltab_card_pol", # style={"width": "28rem", "height": "50rem"}, # style={"width": "28rem"}, )
src="https://gnps-cytoscape.ucsd.edu/static/img/GNPS_logo.png", width="120px"), href="https://gnps.ucsd.edu"), dbc.Nav([ dbc.NavItem( dbc.NavLink("GNPS FBMN Group Comparison Dashboard", href="#")), ], navbar=True) ], color="light", dark=False, sticky="top", ) DASHBOARD = [ dbc.CardHeader(html.H5("GNPS FBMN Group Comparison Dashboard")), dbc.CardBody([ dcc.Location(id='url', refresh=False), html.Div(id='version', children="Version - 0.1"), html.Br(), html.H3(children='GNPS Task Selection'), dbc.Input(className="mb-3", id='gnps_task', placeholder="Enter GNPS FBMN Task ID"), html.Br(), html.H3(children='Metadata Selection'), dcc.Dropdown(id="metadata_columns", options=[{ "label": "Default", "value": "Default" }],
html.A(dbc.Col(html.Img(src=settings.LOGO, height="45px")), href='/'), dbc.Col(dbc.NavbarBrand(id='navbar-brand', className='ml-2'), style={'margin-left': '10px'}) ], align='center', no_gutters=True) ], fixed='top', className='wa-navbar') ]), dbc.Col([ dbc.Row([ dbc.Card([ dbc.CardHeader(add_help(html.H6('Created by'), 'created')), html.Div(id='created-by') ], className='col-md-3'), dbc.Card([ dbc.CardHeader(add_help(html.H6('Messages'), 'messages')), html.Div(id='count-message') ], className='col-md'), dbc.Card([ dbc.CardHeader(add_help(html.H6('Words'), 'words')), html.Div(id='count-word') ], className='col-md'), dbc.Card([ dbc.CardHeader(add_help(html.H6('Emoji'), 'emoji')),