app = dash.Dash(__name__,external_stylesheets=[dbc.themes.CYBORG]) server = app.server # style={'display':'inline-block', 'verticalAlign':'top', 'width':'30%'} # In[ ]: app.layout = html.Div(children=[ html.Title("Tweet Analyzer"), html.Img(src="https://help.twitter.com/content/dam/help-twitter/twitter-logo.png",style={'display':'inline-block', 'verticalAlign':'middle','height':'10%', 'width':'10%','margin-left': '45%'}), html.H1("Tweet Analyzer 🔥", style={ 'textAlign': 'center', 'color': '#7FDBFF' }), html.H3("Analyze Tweets Of Specific Account on Twitter", style={ 'textAlign': 'center', 'color': '#7FDBFF' }), dcc.Input(id='id1',placeholder='Enter the exact twitter handle of the User (without @)',type='text', style={'display':'inline-block','verticalAlign':'middle', 'width':'50%','margin-left': '25%'}), html.Br(), html.Br(), html.H6("Select Action To Perform",
) from refresh import update from pages.functions import indiadata, worlddata external_stylesheets = ["https://codepen.io/theajit/pen/vYYxVLb.css"] # external JavaScript files external_scripts = [ "https://codepen.io/theajit/pen/JjdLvZE.js", ] app.title = "Track Corona India | USA | China | Online Live " app.layout = html.Div([ dcc.Location(id="url", refresh=False), html.Title("Track Corona India"), html.Img(src=app.get_asset_url("track_corona_online_logo.png"), title="Track Corona Logo", style={ "height": "80px", "textAlign": "center", "display": "inline-block", "margin-left": "1.5%", "margin-top": "0.5%" }), html.Div( [ html.Ul([ html.Li([dcc.Link("Home ", href="/")]), html.Li([ dcc.Link("India", href="#"),
def tab_general(): global history clan, history, clanWar, dateWar = cr.getJsonWithCache( apiToken, playerId, clanId) currentDate = datetime.now().strftime('%d-%m-%Y %H:%M:%S') maxDonationValue = 0 minDonationValue = 6000 # get min and max donatin values for hist in history: if hist[2] > maxDonationValue: maxDonationValue = hist[2] if hist[2] < minDonationValue: minDonationValue = hist[2] limiteClanDonation = conf.K_CLANLIMITE if maxDonationValue < limiteClanDonation: limiteClanDonation = maxDonationValue if minDonationValue > limiteClanDonation: limiteClanDonation = minDonationValue marks = [] if minDonationValue > 100: minMark = minDonationValue + (100 - (minDonationValue % 100)) else: minMark = 0 if maxDonationValue > 100: maxMark = maxDonationValue + (100 - (maxDonationValue % 100)) else: maxMark = 100 for mark in range(minMark, maxMark, 100): marks.append(mark) marks.append(maxMark) return html.Div(children=[ html.Title('Clan ' + clan[conf.F_NAME]), html.H1(children=u'Statistiques du clan "' + clan[conf.F_NAME] + '"'), html.Div('Last update: ' + currentDate), html.Div(children=[ dcc.Graph(id='graph-dons'), ]), html.Div(children=[ dcc.RangeSlider( id='graph-dons-slider', min=minDonationValue, max=maxDonationValue, marks={i: str(i) for i in marks}, value=[0, limiteClanDonation], ) ]), html.Br(), html.Div(children=[ dcc.Graph(id='graph-war', figure={ 'data': [ { 'x': clanWar[0], 'y': clanWar[1], 'type': 'bar', 'name': u'Préparations' }, { 'x': clanWar[0], 'y': clanWar[2], 'type': 'bar', 'name': u'Guerre finale' }, ], 'layout': { 'title': u'Rapport de guerre du ' + dateWar } }) ]) ])
def serve_layout(): attributes = get_attributes() return html.Div( [ # page title html.Title(["Euronext Technology Companies"]), # page header html.Div([html.H1("Technological Companies Stocks Dashboard")]), # summary html.Div([ html.H2("Summary", className="summary-title"), html.P(summary_1, className="summary-text"), html.P(summary_2, className="summary-text"), html.A( "Please visit my GitHub!", href="https://github.com/jschnab/finance-scraping.git", className="summary-text", ), ], className="summary"), # timeseries html.Div([html.H2("Timeseries Analysis")]), # dropdown grid html.Div( [ # select y axis dropdown html.Div( [ html.Div("Select y-axis", className="label"), html.Div( dcc.Dropdown( id="y_var", options=attributes, value="last_quote", className="dropdown", )), ], className="subcontainer-dropdown", ), # select companies dropdown html.Div( [ html.Div("Select companies", className="label"), html.Div( dcc.Dropdown( id="companies", options=get_companies(), value=[ "Capgemini SE", "Ubisoft Entertainment", "Dassault Systemes SE", ], multi=True, className="dropdown", )), ], className="subcontainer-dropdown", ), # date picker html.Div( [ html.Div("Select date range", className="label"), html.Div( dcc.DatePickerRange( id="date_range", min_date_allowed=get_min_date(), max_date_allowed=get_max_date(), className="datepicker", )), ], className="subcontainer-dropdown", ), ], className="container-dropdown", ), # graph grid html.Div( [html.Div([dcc.Graph(id="timeseries")])], className="timeseries-container", ), html.Div(html.H2("Company rankings")), # tables container html.Div( [ # single table html.Div( [ html.H3("Top 10 values", className="top-values"), # table top 10 values dropdown html.Div([ html.Div("Table attribute", className="label"), html.Div( dcc.Dropdown( id="drop-top-values", options=attributes, value="capital", className="dropdown", )), ]), # table top 10 values html.Table(id="top-ten-values"), ], className="container-one-table", ), # single table html.Div( [ html.H3("Bottom 10 values", className="top-values"), # table bottom 10 values dropdown html.Div([ html.Div("Table attribute", className="label"), html.Div( dcc.Dropdown( id="drop-bottom-values", options=attributes, value="capital", className="dropdown", )), ]), # table bottom 10 values html.Table(id="bottom-ten-values"), ], className="container-one-table", ), # single table html.Div( [ html.H3("Top 10 movers", className="top-values"), # table top 10 progressions dropdown html.Div([ html.Div("Table attribute", className="label"), html.Div( dcc.Dropdown( id="drop-top-prog", options=attributes, value="capital", className="dropdown", )), ]), # table top 10 progressions html.Table(id="top-ten-prog"), ], className="container-one-table", ), # single table html.Div( [ html.H3("Bottom 10 movers", className="top-values"), # table top 10 progressions dropdown html.Div([ html.Div("Table attribute", className="label"), html.Div( dcc.Dropdown( id="drop-bottom-prog", options=attributes, value="capital", className="dropdown", )), ]), # table bottom 10 progressions html.Table(id="bottom-ten-prog"), ], className="container-one-table", ) ], className="container-tables", ), ], className="main", )
def create_app_ui(): main_layout = html.Div([ html.H1(id="heading", children='Terrorism analysis'), dcc.Tabs(id="Tabs", value="Map", children=[ dcc.Tab(label="Map Tool", id="Map tool", value="Map", children=[ dcc.Tabs(id="subtabs", value="WorldMap", children=[ dcc.Tab(label="World Map Tool", id="World", value="WorldMap"), dcc.Tab(label="India Map Tool", id="India", value="IndiaMap") ]), dcc.Dropdown( id="month_drop", options=month_list, multi=True, placeholder='Select Month', ), dcc.Dropdown( id="date_drop", options=date_list, multi=True, placeholder='Select date', ), dcc.Dropdown( id="day_drop", value=1, options=date_list, multi=True, placeholder='Select Day', ), dcc.Dropdown( id="region_drop", options=region_list, multi=True, placeholder='Select Region', ), dcc.Dropdown( id="country_drop", options=country_list, multi=True, placeholder='Select Country', ), dcc.Dropdown( id="state_drop", options=state_list, multi=True, placeholder='Select Sate', ), dcc.Dropdown( id="city_drop", options=city_list, multi=True, placeholder='Select City', ), dcc.Dropdown( id="attack_drop", options=attack_type_list, multi=True, placeholder='Select Attack-type', ), html.Title(children="Select the year range"), dcc.RangeSlider( id="range-slider", min=min(year_list), max=max(year_list), value=[min(year_list), max(year_list)], marks=year_dict, step=None), html.Br(), ]), dcc.Tab(label="Chart Tool", id="chart tool", value="Chart", children=[ dcc.Tabs(id="subtabs2", value="WorldChart", children=[ dcc.Tab(label="World Chart tool", id="WorldC", value="WorldChart"), dcc.Tab(label="India Chart tool", id="IndiaC", value="IndiaChart") ]), dcc.Dropdown(id="Chart_drop", options=chart_dropdown_values, placeholder="Select option", value="region_txt"), html.Br(), html.Br(), html.Hr(), dcc.Input(id="search", placeholder="Search Filter"), html.Hr(), html.Br(), dcc.RangeSlider( id='cyear_slider', min=min(year_list), max=max(year_list), value=[min(year_list), max(year_list)], marks=year_dict, step=None), html.Br() ]), ]), html.Div(id="graph-object", children="space for graph"), ]) return main_layout
return [ dcc.Dropdown(id='words-dd', options=return_list, className='round-dropdown', value=Utils.list_of_found_words, multi=True, clearable=False) ] ####################### # FRONTEND ####################### app.layout = \ html.Div(className="big_container", children=[ html.Title("uRank"), html.Div(className="bookmark_history", children=[ html.Div(className="bookmark", children=[ html.H1('Choose a topic', className='center-header'), # html.Br(), dcc.Dropdown( id='topic-dropdown', options=select_themas(), className='round-dropdown' ), ]), html.Div(id="words_search", className="history", children=[ html.H1('Type in words', className='center-header'), dcc.Input(
gmm = GaussianMixture(n_components=5) gmm.fit(cDf.values) km = KMeans(n_clusters=5, init='random', n_init=30, max_iter=300, random_state=0) km.fit(cDf.values) external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) app.layout = html.Div([ html.Title("View, Inc. Dashboard"), html.H1("View, Inc."), html.Div([ html.H3("Statistics table"), html.Br(), "Select date range", html.Br(), dcc.DatePickerRange(id='my-date-picker-range', min_date_allowed=df.index.min().date(), max_date_allowed=df.index.max().date(), initial_visible_month=df.index.min().date(), start_date=str(df.index.min().date()), end_date=str(df.index.min().date()), minimum_nights=0), html.Div(id='output-container-date-picker-single'), ]),
#My first Dash app, displaying the US States by 'Voting Opportunity'. #This will include how many eligible voters didn't vote, and other relevant slices. # -*- coding: utf-8 -*- import dash import dash_html_components as html import dash_core_components as dcc app = dash.Dash() app.layout = html.Div(children=[ html.Title('''Voting Opportunity'''), html.H1(children=[ '''Intro''' ]), html.P(children=[ '''100 million americans did not vote in the 2016 presidential election. The election was decided by a collective 78,000 votes. This elections displays the opportunity for increased voter turnout, by voting district, in the United States. ''' ]), dcc.Graph( id='example-graph', figure={
def GetMainSite(dashApp, dbRef, days): """ Returns the layout for the website. Documentation on dash.plotly.com """ dates = GetInitialDates(dbRef, days) mainSite = html.Div([ html.Title("jolyu | Dashboard"), # empty Div to trigger javascript file for graph resizing html.Div(id="output-clientside"), dcc.Store(id="dbDates"), # Header Div html.Div( [ html.Div( [ html.Img( src=dashApp.get_asset_url("jolyu.svg"), style={ "height": "8em", "width": "auto", }, ) ], id="jolyu-logo", className="one-third column", ), html.Div( [ html.Div([ html.H3( "Bird Statictics", style={"margin-bottom": "0px"}, ), html.H5("System overview", style={"margin-top": "0em"}), ]) ], className="one-half column", id="title", ), html.Div( [ html.A( html.Button("Learn More", id="learn-more-button"), href= "https://glados.no/files/ntnu/v20/ttt4270/jolyu_fremtidens_fugletitter_elsys_v2020.pdf", target="_blank", ) ], className="one-third column", id="button", ), ], id="header", className="row flex-display", style={"margin-bottom": "0em"}, ), # Div for main site html.Div([ html.Div( [ dcc.DatePickerRange( id="dbDatePicker", display_format="YYYY-MM-DD", start_date_placeholder_text='YYYY-MM-DD', end_date_placeholder_text='YYYY-MM-DD', start_date=dates[0], end_date=dates[1], first_day_of_week=1, ), html.Button("Fetch DB", id="fetchDbButton"), html.A(html.Button("Download Dataset", id="downloadDbButton"), id="downloadBut", download="rawdata.csv", href="", target="_blank"), ], className="pretty_container six columns", ), html.Div( [ html.P(id="dbResponse"), ], className="pretty_container six columns", ), ], id="quick-facts", className="row flex-display"), html.Div( [ html.Div( [ html.Div( [ dcc.Graph(id="mainGraph"), ], id="mainGraphContainer", className="pretty_container", ) ], className="twelve columns", ) ], id="mainGraphDiv", className="row flex-display", ), html.Div( [ html.Div( [ html.Div( [ dcc.Graph(id="secondGraph"), html.H5("Show:"), dcc.Checklist( labelStyle={'display': 'inline-block'}, id="checklistShow", ) ], id="secondaryGraphContainer", className="pretty_container", ) ], className="twelve columns", ) ], id="second_graph_div", className="row flex-display", ) ]) return mainSite
color="primary", className='mr-1', outline=False, style={ 'margin': '20px', 'border-radius': '5px' }), ], style={'text-align': 'center'}) display_page = html.Div([dcc.Graph(id="graph", figure=fig)]) no_display = html.Div([]) app.layout = html.Div([ html.Title("Transportation Topography"), dcc.Location(id='url', refresh=False), main_page, html.Div(id='visual-content', style={'text-align': 'center'}) ], style={'background-color': 'MintCream'}) @app.callback([ dash.dependencies.Output('visual-content', 'children'), dash.dependencies.Output('nbhd', 'active'), dash.dependencies.Output('district', 'active'), dash.dependencies.Output('city', 'active'), dash.dependencies.Output('region', 'active') ], [dash.dependencies.Input('go_button', 'n_clicks')], [dash.dependencies.State('nbhd', 'n_clicks_timestamp')], [dash.dependencies.State('district', 'n_clicks_timestamp')],
style={ "color": "white", 'font-weight': 'bold' }) ], vertical=True, pills=True, ), footer ], style=SIDEBAR_STYLE, ) # Permet de mettre le style du contenu pour chaque page content = html.Div(id="page-content", style=CONTENT_STYLE) # Le titre de notre page titleDash = html.Title(id="title", children=[html.Title(children="DataScience")]) # Notre header présent sur toutes les pages header = html.Header( id="header", children=[html.H1(children='Projet DATA SCIENCE'), html.Hr()]) # Toute notre application app.layout = html.Div([dcc.Location(id="url"), sidebar, content]) # Presentation dans la rubrique Home cardPresentationUs = dbc.Card( dbc.CardBody([ html.H6('A propos', className='card-title'), html.P( 'Dans le cadre de notre projet Data Science à l\'école d\'ingénieur Polytech Montpellier, nous avons ' 'réalisé ce site interactif afin de présenter les étapes de notre travail et nos résultats. ',
if len(sc) != 2: continue electoral_votes = int(line[1]) margin = abs(int(line[2]) - int(line[3])) voter_opp = (non_voters_map[sc] / float(margin)) * (electoral_votes / TOTAL_ELECTORAL_VOTES) voter_opp_map[sc] = voter_opp with open('voter_opp.csv', 'w') as voter_opp_file: voter_opp_file.write('State, Voter Turnout Opportunity\n') voter_opp_file.write('string, number\n') for k,v in sorted(voter_opp_map.items(), key=lambda x: x[1], reverse=True): voter_opp_file.write(k + "," + ("%.3f" % v) + '\n') app.layout = html.Div([ html.Title("Voting opportunity"), dcc.Graph( id='voting-opportunity', figure={ 'data': [ go.Bar( x=list(voter_opp_map.keys()), y=list(voter_opp_map.values()), ) ], 'layout': go.Layout( xaxis={'title': 'State'}, yaxis={'title': 'Turnout opportunity'}, title="Voter turnout opportunity by state for the 2016 presidential election" ) }
def server_layout(mode=None): #return the layout of the GUI session_id = str(uuid.uuid4()) #variable, distribution selection panel selection_panel = html.Div(id='selection-panel',children=[ html.Div(id='selected-column-panel',children=[ html.Div(id='selected-column-sec1-panel',children=[ drc.NamedDropdown( name='Select series', id='selected-series', searchable=False, clearable=False ), dcc.Checklist( id='apply-log-transform', options=[{'label':' Apply log transform','value':'logtransform'} ]), ]), drc.NamedTextarea( id='series-characteristics', name='Series characteristics', cols='50', rows='2', readOnly='readOnly' ), ]), html.Div(id='apply-panel',children=[ html.Div(id='apply-sec1-panel',children=[ drc.NamedDropdown( id='fitted-distributions', name='Fitted distribution', options=[ {'label': ' '+ v[0], 'value': k} for k,v in dist_par_template.items() if k != 'native' and v[2] ], value='normal', searchable=False, clearable=False ), ]), # html.Div(id='apply-sec1b-panel',children=[ # drc.NamedDropdown( # id='plotting-distributions', # name='Probability scale', # options=[ # {'label': ' '+ v[0], 'value': k} # for k,v in dist_par_template.items() if v[2] # ], # value='native', # searchable=False, # clearable=False # ), # ]), html.Div(id='apply-sec2a-panel',children=[ html.Button('Fit',id='fit-button',n_clicks=0), ]), #dcc.Checklist( # id='show-y-log', # options=[{'label':' Show y-axis in log scale','value':'true'} #]), ]), html.Label(id='graph-refresh'), dcc.Store( id='graph-refresh-hidden', data=0 ), html.Div(id='message-panel',children=[""]), ]) #variable, distribution selection panel par_panel = html.Div(id='fitted-panel',children=[ html.Div(id='fitted-sec1-panel',children=[ drc.NamedTextarea( id='fitted-par', name='Estimated distribution parameters', readOnly='readOnly', cols= 40, rows= 3 ), drc.NamedTextarea( id='estimated-quantiles', name='Estimated quantiles', readOnly='readOnly', cols= 40, rows= 3 ), ]) ]) upload_panel = html.Div(id='last-card',children=[ dcc.Upload( id='upload-data', children=html.Div([ 'Drag and Drop or ', html.A('Select File') ]), style={ 'lineHeight': '60px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', } ), html.Label('''File upload limited to < %0.0f Kb, containing no more than %d rows and %d columns'''%(configs['max_file_size']/1024,configs['max_file_rows'],configs['max_file_cols'])), html.Label('',id='data-filename'), html.Label('',id='data-description'), html.Div(id='table-panel',children=[ dash_table.DataTable( id='attribute-table', columns=[], row_selectable='multi', editable=False, style_header={ 'textAlign': 'center', 'fontWeight': 'bold', 'color': 'black', }, style_cell={ 'padding': '2px', '--selected-background': 'grey', 'color': 'black', }, style_data_conditional=[ { 'if': {'row_index': 'odd'}, 'backgroundColor': 'rgb(248, 248, 248)' } ], #locale_format= '0.3', ) ],style={'visibility':'none','display':'none'}), ]) chart_panel = html.Div(id='chart-panel',children=[ dcc.Loading(id = "loading-icon", children=[ dcc.Graph( id='graph', figure={ }, responsive=True, config=graph_config, style={'display':'none'} ) ]), ], style={'visibility':'none'}) layout = html.Div( id="body", className="container scalable", children=[ visdcc.Run_js(id = 'chart-updated-js'), visdcc.Run_js(id = 'chart-unupdated-js'), visdcc.Run_js(id = 'error-display-js'), dcc.Store(id='error-display',data=''), html.Title(title=configs['title']), #hidden session id #row 1 for title html.Div(id='top-panel',children=[ html.H5(id='app-title',children= '''Distribution Fitting and Analysis Tool. This tool is only for demostration porpuses''', style={"margin-bottom": "0px"}, ), ],className="row flex-display"), #second row layout html.Div(id='main-panel',children=[ html.Div(id='left-panel',children=[ upload_panel ]), html.Div(id='output-panel',children=[ selection_panel, par_panel, chart_panel ],style={'visibility':'none','display':'none'}), ]), #row 4 is the footer html.Div(id='footer-panel',children=[ ''' A web application built on top of Dash (v%s) (framework for Python) by Exequiel Sepúlveda and Dmitri Kavetski.'''%(dash.__version__) ]), ], ) return layout
s = Store(location=location, keys=sl.sl._keys) return dbc.Alert(value + " created!"), s.tables() @app.callback(Output("content", "children"), [dash.dependencies.Input('location-drop-down', 'value')]) def update_output(value): print("selector says:", value) location.set(value) return PageStatus(location=location, sl=sl).get_layout() from .pages.navbar import navbar app.layout = html.Div(children=[ html.Title("Roomba"), navbar(), html.Div(id="selector", children=dbc.Row([ dbc.Col(dbc.Select( options=[{ "label": x, "value": x } for x in Store(keys=[]).tables()], value=location.get(), id="location-drop-down", ), width=4), dbc.Col(dbc.Button("new", outline=True, id="new-location-button",
"position": "fixed", "top": 0, "left": 0, "bottom": 0, "width": "16rem", "padding": "2rem 1rem", "background-color": "#f8f9fa", } # 主要内容的样式将其放置在侧边栏的右侧,然后添加一些填充 CONTENT_STYLE = { "margin-left": "18rem", "margin-right": "2rem", "padding": "2rem 1rem", } header = html.Header(html.Title('校校招')) sidebar = html.Div( [ html.H2("校校招", className="display-4", title='校校招,连接高校与企业的平台'), html.P("校校招轻量级分析平台", className="lead"), html.Hr(), dbc.Nav( [ dbc.NavItem(dbc.NavLink("首页", href="/", active="exact")), html.H3('用户端数据概览', className='lead', style={}), # 导航 dbc.NavItem( dbc.NavLink( "每日数据概览", href="/per/report", active="exact",
if len(response) == 0: break for item in response: category_id = item['id'] category_title = item['title'] if category_id is not None and category_title is not None: if db.session.query(JeopardyTable).filter(JeopardyTable.category_id == category_id).count() == 0: data = JeopardyTable(category_title, category_id) db.session.add(data) db.session.commit() offset += 100 # Layout for web app app.layout = html.Div(children=[ html.Title("Test"), dcc.Tabs(id="tabs", children=[ dcc.Tab(label='Search for Jeopardy Questions', children=[ html.Div(children=[ html.Div([ html.Br(), html.H2(children="Jeopardy Trivia Search Engine", style={ 'textAlign': 'center', }), html.Br(), html.Div(id='search', children=[ html.Div([ html.Div(children=[ html.H6(children="Search for a category by key word/phrase (required)", style={ 'margin-left': '1em' })
import dash import dash_html_components as html app = dash.Dash() server = app.server app.config.suppress_callback_exceptions = True app.scripts.config.serve_locally=True app.head = [ html.Title('Cards Acquisition') ] app.css.append_css({ 'external_url': 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css' }) # app.css.append_css({ # "external_url": "https://codepen.io/chriddyp/pen/dZVMbK.css" # })
import dash_html_components as html header = [ html.Title("xsplot.com material cross section plotting"), html.Iframe( src="https://ghbtns.com/github-btn.html?user=openmc-data-storage&repo=material_xs_plotter&type=star&count=true&size=large", width="170", height="30", title="GitHub", style={"border": 0, "scrolling": "0"}, ), html.H1( "XSPlot - Neutron cross section plotter for materials", # TODO find a nicer font # style={'font-family': 'Times New Roman, Times, serif'}, # style={'font-family': 'Georgia, serif'}, style={"text-align": "center"}, ), html.Div( html.Iframe( src="https://www.youtube.com/embed/Rhb0Oqm29B8", width="560", height="315", title="Tutorial video", # style={}, style={"text-align": "center", "border": 0, "scrolling": "0"}, ), style={"text-align": "center"}, ), ]
def title(self, page_title: str) -> html.Title: """Return a HTML title component which includes `page_title` and includes additional text to be included in all page titles. """ return html.Title(f'{page_title} - {APP_NAME}')
# amount of records per table page PAGE_SIZE = 15 # application object app = dash.Dash(__name__, server=server, static_folder='static') # init configuration, second param allow to make dynamic callbacks app.css.config.serve_locally = True app.scripts.config.serve_locally = True app.config['suppress_callback_exceptions'] = True # static layout app.layout = html.Div( [ html.Link(href='/static/undo-redo.css', rel='stylesheet'), html.Title("PricesCC trading web-interface"), html.H5("Pairs from prices RPC call:"), dcc.Dropdown(id='my-dropdown', options=options_arg, value='BTC_USD'), html.H5("User custom prices:"), dcc.Dropdown(id='user-dropdown', options=user_args, value=user_args[0]), dcc.Input(placeholder='Input synthetic for custom graph...', type='text', value='', id='graph_synthetic', style={ 'marginBottom': 15, 'marginTop': 10 }), html.Button('Build custom price', id='graph_build_button',
fig1.update_traces(marker=dict(color='#6D6194')) ######################## Update Scheduling ######################## # Define scheduler and add jobs for data refresh scheduler = BackgroundScheduler() # Cron style scheduling set to every day for S3 and every minute for DynamoDB as default scheduler.add_job(func=read_s3_data, trigger='cron', day='1') scheduler.add_job(func=read_dynamodb_data, trigger='cron', minute=1) # Start scheduling scheduler.start() ######################## App Head ######################## app.head = [html.Title('MTT Current Monitoring Dashboard')] ######################## App Layout ######################## app.layout = html.Div( id="big-app-container", children=[ # Banner with logo creation html.Div( id="banner", className="banner", children=[ html.Div( id="banner-text", children=[ html.H5("Machine Tool Technologies"),
stacked_complete_df = pd.concat([stacked_cases_df, stacked_deaths_df]) # Get information for sliders/radio buttons/etc. available_indicators_cases = stacked_cases_df['indicator'].unique() available_indicators_deaths = stacked_deaths_df['indicator'].unique() days = stacked_complete_df.Days.unique() continents = stacked_complete_df.Continent.unique() app.layout = html.Div(children=[ # Titles Div html.Div( [ html.Title(['Corona-virus Dashboard']), # Dashboard heading html.H1(children='Corona-virus Dashboard', style={ 'textAlign': 'center', }), # Dashboard sub-heading html.Div( children= f'A dashboard for visualising my analyses of the Johns Hopkins Univerisity\'s (JHUs)' f' corona-virus dataset.', style={ 'textAlign': 'center', }),
import dash import pandas as pd import numpy as np import plotly.offline as plt import plotly.graph_objs as go import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objs as go import plotly.figure_factory as ff pd.set_option('display.max_columns', 10) app = dash.Dash() app.layout = html.Div([ html.Title(children='KMC'), html.Div([ html.H1(children="K Mean Clustering", style={ 'text-align': 'center', 'color': '#7FDBFF' }), html.P(children='Seleccione el numero de cluster'), dcc.Input(id="opcion", type="number", placeholder="Ingrese", value=7, min=1), dcc.Graph(id='feature-graphic') ]) ])
def create_dashboard(server): dash_app = dash.Dash(routes_pathname_prefix='/', external_stylesheets=[dbc.themes.SLATE], server=server) dash_app.index_string = ''' <!DOCTYPE html> <html> <head> {%metas%} <title>{%title%}</title> {%favicon%} {%css%} <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-11302591-2"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-11302591-2'); </script> </head> <body> {%app_entry%} <footer> {%config%} {%scripts%} {%renderer%} </footer> </body> </html> ''' dash_app.title = 'Pi-chart.com' dash_app.layout = dbc.Container( [ html.Title("Pi-chart.com"), dcc.Store(id="localstorage", storage_type="local"), html.Div(id='tab-content'), html.Div(id='tabs'), dcc.Interval( id='interval-component', interval=1 * 60000, # in millisecond n_intervals=0) ], fluid=True) @dash_app.callback(Output('localstorage', 'data'), [Input('interval-component', 'n_intervals')]) def create_figure(n): graphs = {} brackets = {} marketData = [] fetch_tables = ps.fetch_tables() tables = list(fetch_tables) count = 0 for market in tables: fig = go.Figure() data = ps.query_bracket(market) graphs[market] = data return graphs @dash_app.callback( Output("tab-content", "children"), [Input("localstorage", "data")], ) def create_layout(graphs): figures = {} markets = graphs.keys() for market in markets: brackets = graphs[market].keys() fig = go.Figure() for bracket in brackets: prices = graphs[market][bracket][0] timeStamp = graphs[market][bracket][1] figure = fig.add_trace( go.Scattergl( x=timeStamp, y=prices, name=bracket, hovertemplate='<b>Bracket: ' + bracket + '</b>.<br>Price: %{y:$.2f}<extra></extra><br>' + '%{x}<br>')) figures.update({market: fig}) template = 'plotly_dark' fig.update_layout( template=template, xaxis=dict( autorange=True, showgrid=False, mirror=True, ticks='outside', showline=True, linecolor='#FFFFFF', rangeslider=dict(visible=True, thickness=0.08), ), yaxis=dict(showgrid=False), #height=768, #width=1070, title_text=market, showlegend=True, margin=dict(l=100, t=100, r=20, b=20), uirevision="uirevisionstring") fig.update_xaxes(tickformatstops=[ dict(dtickrange=[None, 1000], value='%-I:%M:%S%.%L%p ms'), dict(dtickrange=[1000, 60000], value='%-I:%M:%S%p s'), dict(dtickrange=[60000, 3600000], value='%-I:%M%p'), dict(dtickrange=[3600000, 86400000], value='%-a %-I:%M%p'), dict(dtickrange=[86400000, 604800000], value='%e. %b d'), dict(dtickrange=[604800000, 'M1'], value='%e. %b w'), dict(dtickrange=['M1', 'M12'], value="%b '%y M"), dict(dtickrange=['M12', None], value='%Y Y'), ]) graphs.update({market: fig}) tabscontent = [] for key in figures: tabscontent.append(dbc.Col(dcc.Graph(figure=figures[key]))) notice = "Dear tweets degens... We may have to move on, but we don't have to give up." return html.Div([ dbc.Row( dbc.Col([ dbc.NavbarSimple([ dbc.NavItem( dbc.NavLink( "Tweet Markets", href= "https://www.predictit.org/markets/search?query=poll", target="_blank")) ], brand="Pi-Chart", color="primary", dark=True, fluid=True) ])), dbc.Row(tabscontent, no_gutters=True), html.Div([ html.P(notice), html.P([ dcc.Link("Don't let this be the end. Join us on discord.", href='https://discord.gg/V7wmfd', target="_blank") ]) ]) ]) return dash_app.server
from PIL import Image from PIL import ImageDraw from PIL import ImageFont import textwrap df = pd.read_csv('all_tweets.csv') external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] from app import app # app = dash.Dash(__name__, external_stylesheets=external_stylesheets) # server = app.server # app.title='FAKENEWS' layout = html.Div([ html.Title("HELLO", id='tit'), dcc.Graph(id='score_map'), html.Img(id='tweet'), html.Button('Real', id='btn-nclicks-1', n_clicks=0), html.Button('Fake Good/Funny', id='btn-nclicks-3', n_clicks=0), html.Button('Fake Bad', id='btn-nclicks-2', n_clicks=0), html.Button('Fake ok but fix end', id='btn-nclicks-4', n_clicks=0), html.Div(id='container-button-timestamp'), dcc.Store(id='idx', storage_type='session'), dcc.Store(id='local', storage_type='session') #Output('intermediate-value', 'children') ]) @app.callback(Output('score_map', 'figure'), Input('local', 'modified_timestamp'), State('local', 'data'))
'name': 'SF' }], 'layout': { 'plot_bgcolor': colors['background'], 'paper_bgcolor': colors['background'], 'font': { 'color': colors['text'] } } } app.title = 'Reddit scraper' app.layout = html.Div(children=[ html.Title(children="Reddit Scraper"), html.Nav(className='navbar navbar-default'), html.H1(children='Welcome to a basic reddit scraper!'), html.Br(), html.Div(children=''' Hello there! This is a simple graphing applet that will graph for you the words that are most frequently appearing on a reddit post. All you have to do is enter the ID of the reddit post. THE ID is a 6 digit string in the URL of any reddit post. For example, in "https://www.reddit.com/r/aww/comments/7j44o0/just_two_best_friends/", the id is 7j44o0. ''', className='container'), html.Br(), dcc.Input(id='id-state', type='text', value=''), html.P(), html.Button(id='submit-button', n_clicks=0, children='Submit post ID',
import dash_table import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Output, Input, State from dash.exceptions import PreventUpdate import plotly.express as px import numpy as np import pandas as pd import flask server = flask.Flask(__name__) app = dash.Dash(__name__, server=server) app.layout = html.Div([ html.Title('Phebi数据分析'), html.Header(html.Meta(name="referrer", content="no-referrer")), html.Div( id='row_1', style={'display': 'flex'}, children=[ html.Div( id='上传数据', className='left_bar', children=[ html.Div( id='数据上传区域', children=[ html.H6('数据源'), dcc.Upload(id='stock_file', children=html.Div([html.A('选择库存文件')]),
# Dash init end # Read DataFrame, generate plot df = pd.read_csv('https://gist.githubusercontent.com/chriddyp/c78bf172206ce24f77d6363a2d754b59/raw/c353e8ef842413cae56ae3920b8fd78468aa4cb2/usa-agricultural-exports-2011.csv', index_col=0) # Read, generated plot end md_intro = ''' ## US states' agricultural exports You can filter which states are displayed using the first drop-down. You can also control the type of plot using the second dropdown. ''' # Generate app layout app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[ html.Title(children=['US agricultural exports']), dcc.Markdown(children=md_intro), html.Div(children=[ html.Label('Select state(s):'), dcc.Dropdown( id='state-selector', options=[ {'label': i, 'value': i} for i in df.state.unique() ], value=['All'], multi=True ), html.Label('Select plot type:'),
import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output from importlib import reload from app import app, server from apps import QKD_settings, QKD_status, detector_settings from navbar import Navbar app.layout = html.Div([ Navbar(), html.Title(id='dummy'), dcc.Location(id='url', refresh=False), html.Div(id='page-content') ]) @app.callback(Output('page-content', 'children'), [Input('url', 'pathname')]) def display_page(pathname): # print(pathname) if pathname == '/apps/QKD_settings': return QKD_settings.serve_layout() elif pathname == '/apps/QKD_status': return QKD_status.serve_layout() elif pathname == '/apps/detector_settings': return detector_settings.serve_layout() else: return QKD_status.serve_layout() if __name__ == '__main__':