コード例 #1
0
# assigning df to object variable data
data_object = db()

region_country, country_city, state_city = data_object.get_dict()

external_stylesheets = [
    'https://stackpath.bootstrapcdn.com/bootswatch/4.5.0/cyborg/bootstrap.min.css'
]

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.title = 'Temperature Data'
server = app.server

navbar = dbc.NavbarSimple(
    children=[
        dbc.NavItem(dbc.NavLink('About', href='#vis')),
        dbc.DropdownMenu(
            children=[
                dbc.DropdownMenuItem(
                    [html.I(className='linkedin'), ' LinkedIn'],
                    href='https://www.linkedin.com/in/patrick-wilky/',
                    target='_blank'),
                dbc.DropdownMenuItem(
                    [html.I(className='github'), ' GitHub'],
                    href='https://github.com/PWalis/city_temp',
                    target='_blank'),
            ],
            nav=True,
            in_navbar=True,
            label="Links",
        ),
コード例 #2
0
ファイル: app_modules.py プロジェクト: adrianmt18/ADUniverse
import adusql as ads
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import pandas as pd

from constant import SEATTLE, INIT_ZOOM
from dash_daq import ToggleSwitch  # requires dash_daq version 0.1.0
from folium import Map

# Navigation Bar
NavigationBar = dbc.NavbarSimple(
    children=[
        #dbc.NavItem(dbc.NavLink("Home", href="/")),
        dbc.NavItem(dbc.NavLink("Map", href="/")),
        dbc.NavItem(dbc.NavLink("Financial Feasibility", href="/finances")),
        dbc.NavItem(dbc.NavLink("FAQ", href="/faq")),
        #dbc.NavItem(dbc.NavLink("Transparency", href="/transparency")),
    ],
    brand="Seattle ADU Feasibility",
    brand_href=
    "http://www.seattle.gov/services-and-information/city-planning-and-development",
    brand_external_link=True,
    color="primary",
    dark=True,
    fluid=True,
    id="navbar",
    style={})

# Address addressDropdown
adunit = ads.Connection()
コード例 #3
0
import dash_table

server = Flask(__name__)
app = dash.Dash(__name__,
                server=server,
                external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server

NAVBAR = dbc.Navbar(
    children=[
        dbc.NavbarBrand(html.Img(
            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 Selector Dashboard", href="#")),
        ],
                navbar=True)
    ],
    color="light",
    dark=False,
    sticky="top",
)

DASHBOARD = [
    dbc.CardHeader(html.H5("GNPS FBMN Group Selector 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'),
コード例 #4
0
                                  title='Customers',
                                  range=[0, 350]),
                       yaxis=dict(showline=True,
                                  linecolor='rgb(100, 100, 100)',
                                  tickfont_color='rgb(100, 100, 100)',
                                  title='Rate(stars)'),
                       paper_bgcolor='white',
                       plot_bgcolor='white')

####################################################################################################
#   Site

HOME_LOGO = "https://www.nicepng.com/png/full/420-4209725_smart-homes-wifi-sign.png"

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
nav_item1 = dbc.NavItem(
    dbc.NavLink("GitHub", href='https://github.com/Diana-Doe/homework'))
nav_item2 = dbc.NavItem(
    dbc.NavLink("Database", href='https://www.smarthomedb.com/products'))
nav_item = dbc.NavItem(
    dbc.NavLink(
        "Dash Udemy Course",
        href=
        "https://www.udemy.com/course/plotly-dash/?referralCode=16FC11D8981E0863E557"
    ))
navbar = dbc.Navbar(
    dbc.Container([
        html.A(
            # Use row and col to control vertical alignment of logo / brand
            dbc.Row(
                [
                    dbc.Col(html.Img(src=HOME_LOGO, height="30px")),
コード例 #5
0
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.exceptions import PreventUpdate
import pandas as pd
import os

from apps import app_db, app_cosmos, app_map

### ---------------------------- NAV BAR ------------------------------- ###

# Nav Bar
LOGO = app.get_asset_url('logo.png')  # update logo.png in assets/

# nav item links
nav_items = dbc.Container([
    dbc.NavItem(dbc.NavLink('Cosmos', href='/')),
    dbc.NavItem(dbc.NavLink('Database', href='/db')),
    dbc.NavItem(dbc.NavLink('Map', href='/map'))
])

# navbar with logo
navbar = dbc.Navbar(
    dbc.Container([
        html.A(
            # Use row and col to control vertical alignment of logo/brand
            dbc.Row(
                [
                    dbc.Col(html.Img(src=LOGO, height="30px")),
                    dbc.Col(dbc.NavbarBrand("DWR Sidewinder",
                                            className="ml-2")),
                ],
コード例 #6
0
# Read the CSV file with the data of the cameras and transform it to Pandas dataframe
cameras_df = pd.read_excel(path_data, sheet_name='cameras')
cameras_df = cameras_df.set_index('id_district', drop=True)
cameras_df = cameras_df[cameras_df['readable'] == 1]

# Malaga's university logo
UMA_LOGO = "https://www.uma.es/servicio-comunicacion/navegador_de_ficheros/Marcas-UMA/descargar/Marca%20Universidad%20de%20M%C3%A1laga/marcauniversidaddemalagaVERTICAL.png"

# ==============================================================================
# Forms menus
# ==============================================================================

# Make a reuseable navitem for the different examples
nav_items = dbc.Nav([
    dbc.NavItem(dbc.NavLink("Real-time traffic", href="/real-traffic")),
    dbc.NavItem(dbc.NavLink("Data search", href="/data-search")),
    dbc.NavItem(dbc.NavLink("Cameras location", href="/camera-location")),
    dbc.NavItem(
        dbc.NavLink("GitHub", href="https://github.com/jrcaro/Rehoboam")),
    dbc.NavItem(dbc.NavLink("About me", href="/about"))
],
                    className="ml-auto",
                    navbar=True,
                    style={
                        'font-weight': 'bold',
                        'font-size': '18px',
                    })

# Logo to the navbar brand
logo = dbc.Navbar(dbc.Container([
コード例 #7
0
ファイル: index.py プロジェクト: zyngielg/sgi-pokemon
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_bootstrap_components as dbc

from app import app, server
from apps import home, pokemon_episode, pokemon_routes, sentiment_analysis

navbar = html.Div(children=[
        dbc.NavbarSimple(
        children=[
            dbc.NavItem(dbc.NavLink("Pokemon-episodes graph", href="/pokemon_episode")),
            dbc.NavItem(dbc.NavLink("Sentiment analysis", href="/sentiment_analysis")),
            dbc.NavItem(dbc.NavLink("Pokemon-routes graph", href="/pokemon_routes"))
        ],
        brand="Pokemon graphs and analysis",
        brand_href="/",
        brand_style={'fontSize': '2.5rem'},
        color="dark",
        dark=True
        )],
        style={'fontSize': '2rem'}
)


app.layout = html.Div([
    navbar,
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content')
])
コード例 #8
0
def render_navbar():
    """Make Navbar"""
    apps_dict = {
        'converter': {
            'render': app.config['NWB_GUI_RENDER_CONVERTER'],
            'id': 'nav_nwb_converter',
            'children': 'NWB Converter',
            'href': '/converter'
        },
        'viewer': {
            'render': app.config['NWB_GUI_RENDER_VIEWER'],
            'id': 'nav_nwb_viewer',
            'children': 'NWB Viewer',
            'href': '/viewer'
        },
        'dashboard': {
            'render': app.config['NWB_GUI_RENDER_DASHBOARD'],
            'id': 'nav_nwb_dashboard',
            'children': 'Dashboard',
            'href': '/dashboard'
        },
        "close_gui": {
            "render": True,
            'id': "close_gui",
            "children": "Close GUI",
            "href": '/shutdown'
        }
    }

    navchildren = []
    for k, v in apps_dict.items():
        if v['render']:
            item = dbc.NavItem(
                html.A(id=v['id'],
                       children=v['children'],
                       href=v['href'],
                       style={
                           "font-size": "120%",
                           "font-weight": "normal"
                       },
                       className='nav-link'))
            navchildren.append(item)

    navbar = dbc.Navbar(
        [
            html.A(
                dbc.Row(
                    [
                        dbc.Col(html.Img(src=NAV_LOGO, height="60px")),
                        # dbc.Col(dbc.NavbarBrand("Navbar", className="ml-2")),
                    ],
                    align="center",
                    no_gutters=True,
                ),
                href="/",
                id="nav_brand"),
            dbc.Nav([dbc.Container(navchildren)],
                    horizontal='end',
                    className="ml-auto flex-nowrap mt-3 mt-md-0")
        ],
        color="dark",
        dark=True)

    return navbar
コード例 #9
0

df = import_data()

plot_df = bin_data(df)

geo = "https://raw.githubusercontent.com/jacPeach/covid-movement-map/master/uk_subdivisions.geojson"

slider_map = {
    i: date
    for i, date in enumerate(sorted(plot_df["date"].unique()))
}

navbar = dbc.NavbarSimple(children=[
    dbc.NavItem(
        dbc.NavLink("Data Source",
                    href="https://www.google.com/covid19/mobility/")),
    dbc.NavItem(
        dbc.NavLink("Source Code",
                    href="https://github.com/jacPeach/covid-movement-map"))
],
                          brand="Covid-19: UK Travel Changes",
                          brand_href="#",
                          color="dark",
                          dark=True)

app_layout = dbc.Container(children=[
    dbc.Row(
        dcc.Markdown("""
        -----  
        This dashboard uses data sourced from the Google Community Mobility Reports.  
コード例 #10
0
import dash_bootstrap_components as dbc

navbar = dbc.NavbarSimple(
    children=[
        dbc.NavItem(dbc.NavLink("Data 1", href="/data1")),
        dbc.NavItem(dbc.NavLink("Data 2", href="/data2")),
        dbc.NavItem(dbc.NavLink("Data 3", href="/data3")),
        dbc.NavItem(dbc.NavLink("Data 4", href="/data4")),
        dbc.NavItem(dbc.NavLink("Live Data", href="/live")),  
    ],
    brand="AdaRel",
    brand_href="/",
    color="secondary",
    dark=True,
)
コード例 #11
0
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

# Imports from this application
from app import app, server
from pages import index, predictions, insights, process

navbar = dbc.NavbarSimple(
    brand='BTCUSD Predictor',
    brand_href='/',
    children=[
        dbc.NavItem(dcc.Link('About', href='/about', className='nav-link')),
    ],
    sticky='top',
    color="#082255",
    dark=True,
    fluid=True,
    className='h1',
)
"""

navbar = dbc.Navbar(
	dbc.Container(
		[
			html.A(
				dbc.Row(
					[
コード例 #12
0
from scripts.leagueAnalysis import league_analysis
from app import app

# league_analysis_df = league_analysis(year=2020, leagueid=22328189)
# categories = list(league_analysis_df['variable'].unique())
# team_list = list(league_analysis_df['team_name'].unique())

layout = html.Div([
    html.H3('Fantasy Team Analysis'),
    # dcc.Link('Go to player table', href='/'),
    # html.Br(),
    # dcc.Link('Go to salary calculator', href='/salaryCalculator'),
    # html.Br(),
    # dcc.Link('Go to team optimizer', href='/optimalTeam'),
    dbc.Nav([
        dbc.NavItem(dbc.NavLink('Go to player table', href='/')),
        dbc.NavItem(
            dbc.NavLink('Go to salary calculator', href='/salaryCalculator')),
        dbc.NavItem(dbc.NavLink('Go to team optimizer', href='/optimalTeam'))
    ],
            horizontal='center'),
    html.Div([
        html.Div(dcc.Dropdown(
            id='your-team', options=[], placeholder='Your Team'),
                 style={'width': '20%'}),
        html.Div(dcc.Dropdown(id='league-picker',
                              options=[{
                                  'label': 'Javale McGeenomes',
                                  'value': '22328189'
                              }, {
                                  'label': 'Losses Pool',
コード例 #13
0
# Data inicial
capital_inicial = 1000
capital_meta = 2000
capital_actual = 0

app.layout = html.Div([
    # Barra de Navegación
    dbc.NavbarSimple(
        children=[
            # Boton subir archivo CSV
            dbc.NavItem(
                html.Div([
                    dcc.Input(id='username',
                              value='Ingresa la URL...',
                              type='text'),
                    html.Button(id='submit-button',
                                type='submit',
                                children='Subir archivo'),
                    html.Div(id='output_div')
                ])),
            # Lista de submenu
            dbc.DropdownMenu(children=[
                dbc.DropdownMenuItem("Análisis", header=True),
                dbc.DropdownMenuItem("Análisis de gráficos",
                                     href="https://tradingview.com"),
                dbc.DropdownMenuItem(
                    "Noticias económicas",
                    href="https://mx.investing.com/news/latest-news"),
            ],
                             nav=True,
                             in_navbar=True,
コード例 #14
0
import requests

server = Flask(__name__)
app = dash.Dash(__name__,
                server=server,
                external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server

NAVBAR = dbc.Navbar(
    children=[
        dbc.NavbarBrand(html.Img(
            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 Workflow URL Formatter", href="#")),
        ],
                navbar=True)
    ],
    color="light",
    dark=False,
    sticky="top",
)

DASHBOARD = [
    dbc.CardHeader(html.H5("GNPS URL Formatter Dashboard")),
    dbc.CardBody([
        html.Div(id='version', children="Version - Release_1"),
        html.Br(),
        html.Div(children="Workflow Name"),
        dcc.Dropdown(id="workflowname",
コード例 #15
0
Requires dash-bootstrap-components 0.3.0 or later
"""
import dash
import dash_bootstrap_components as dbc
from dash import Input, Output, State, html

PLOTLY_LOGO = "https://images.plot.ly/logo/new-branding/plotly-logomark.png"

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
# try running the app with one of the Bootswatch themes e.g.
# app = dash.Dash(external_stylesheets=[dbc.themes.JOURNAL])
# app = dash.Dash(external_stylesheets=[dbc.themes.SKETCHY])

# make a reuseable navitem for the different examples
nav_item = dbc.NavItem(dbc.NavLink("Link", href="#"))

# make a reuseable dropdown for the different examples
dropdown = dbc.DropdownMenu(
    children=[
        dbc.DropdownMenuItem("Entry 1"),
        dbc.DropdownMenuItem("Entry 2"),
        dbc.DropdownMenuItem(divider=True),
        dbc.DropdownMenuItem("Entry 3"),
    ],
    nav=True,
    in_navbar=True,
    label="Menu",
)

# this is the default navbar style created by the NavbarSimple component
コード例 #16
0
## Sidebars

search_bar = dbc.Row(
    [
        dbc.Col(dbc.Input(type="search", placeholder="Search")),
        dbc.Col(
            dbc.Button("Search", color="primary", className="ml-2"),
            width="100%",
        ),
    ],
    no_gutters=True,
    className="ml-auto flex-nowrap mt-3 mt-md-0",
    align="center",
)

nav_item = dbc.NavItem(dbc.NavLink("Home", href="/", external_link=True))
nav_item1 = dbc.NavItem(dbc.NavLink("Ticker Info", href="/dashboard1", external_link=True))
nav_item2 = dbc.NavItem(dbc.NavLink("Ticker Trends", href="/dashboard2", external_link=True, disabled=True))
nav_item3 = dbc.NavItem(dbc.NavLink("My Blog", href="https://nelsonljs.github.io/myblog/"),
                        style = {"background-color": "#fffbe0"})
# dropdown = dbc.DropdownMenu(
#     children=[
#         dbc.DropdownMenuItem("Ticker Info", href = "/dashboard1", external_link=True),
#         dbc.DropdownMenuItem("Ticker Trends", href = "https://github.com"),
#         dbc.DropdownMenuItem(divider=True),
#         dbc.DropdownMenuItem("Home", href = "/", external_link=True),
#     ],
#     nav=True,
#     in_navbar=True,
#     label="Menu",
# )
コード例 #17
0
def Comparer_Base_layout(app):

    app.title = "KBO analysis"
    team_name = [
        'SSG', 'SK', 'KIA', '두산', '한화', 'LG', '삼성', '키움', '롯데', 'NC', 'KT'
    ]
    year = count_year()
    batter_name = []
    pitcher_name = []

    app.layout = html.Div([
        baselayout,
        # 그래프
        dbc.Container(
            [
                dbc.Row(
                    dbc.Col(
                        dbc.Alert(
                            "해당 분석은 한국프로야구단 공식 홈페이지인 KBO에서 스크래핑한 데이터를 바탕으로 진행되었습니다.",
                            color="secondary",
                            style={
                                'margin-top': 80,
                                'margin-right': 10,
                                'margin-left': 10
                            }))),
                dbc.Row([
                    dbc.Col(children=[
                        dbc.Card(
                            [
                                dbc.CardHeader("팀별 분석 비교"),
                                dbc.CardBody(
                                    dcc.Checklist(id='team_name_select',
                                                  value='',
                                                  options=[{
                                                      'label': i,
                                                      'value': i
                                                  } for i in team_name],
                                                  inputStyle={
                                                      'margin-right': '2px',
                                                      'margin-left': '2px'
                                                  },
                                                  labelStyle={
                                                      'margin-right': '7px',
                                                      'margin-left': '7px'
                                                  })),
                            ],
                            color="light",
                            style={
                                'width': "auto",
                                'margin-top': 20,
                                'margin-left': 10,
                                'margin-right': 10,
                                'margin-bottom': 20
                            }),
                        dbc.CardColumns([
                            dbc.Card(
                                [
                                    dbc.CardHeader("연도별 승리 추세선"),
                                    dbc.CardBody(
                                        dcc.Graph(id='team_win_graph',
                                                  hoverData={
                                                      'points': [{
                                                          'year':
                                                          'record'
                                                      }]
                                                  })),
                                ],
                                style={
                                    'width': "auto",
                                    'margin-top': 20,
                                    'margin-left': 10,
                                    'margin-right': 10,
                                    'margin-bottom': 20
                                }),
                            dbc.Card(
                                [
                                    dbc.CardHeader("누적 월별 승률(%)"),
                                    dbc.CardBody(
                                        dcc.Graph(id='month_winprop_graph',
                                                  hoverData={
                                                      'points': [{
                                                          'year': 'prop'
                                                      }]
                                                  })),
                                ],
                                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(children=[
                        dbc.Card(
                            [
                                dbc.CardHeader("선수별 분석 비교"),
                                dbc.CardBody(
                                    dcc.RadioItems(
                                        id="player",
                                        options=[{
                                            'label': '타자(Batter)',
                                            'value': 'batter'
                                        }, {
                                            'label': '투수(Pitcher)',
                                            'value': 'pitcher'
                                        }],
                                        value='batter',
                                        inputStyle={'margin-right': '10px'},
                                        labelStyle={'margin-right': '20px'}))
                            ],
                            color="light",
                            style={
                                'width': "auto",
                                'margin-top': 20,
                                'margin-left': 10,
                                'margin-right': 10,
                                'margin-bottom': 20
                            }),
                        dbc.Card(
                            [
                                dbc.CardBody(
                                    html.Div(
                                        [
                                            dcc.Dropdown(id='name_list',
                                                         options=[{
                                                             'label': i,
                                                             'value': i
                                                         } for i in batter_name
                                                                  ],
                                                         value=[''],
                                                         placeholder=
                                                         "Typing player name",
                                                         multi=True),
                                            dcc.Graph(id='graph2')
                                        ],
                                        style={
                                            'width': '100%',
                                            'display': 'inline-block',
                                            'font-size': '80%',
                                            'margin-bottom': 80,
                                            'margin-top': 5
                                        }))
                            ],
                            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-balance-scale fa-2x",
                                        style={
                                            'color': '#FFFFFF',
                                            '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": "#FFFFFF",
                                                    'margin-left': -30
                                                }))),
                                    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/comparer/")
                                    ),
                                            width=3)
                                ])),
                            html.Br(),
                            html.Br(),
                            html.Br(),
                            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-table fa-2x",
                                        style={
                                            'color': '#7E8083',
                                            '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": "#7E8083",
                                                    'margin-left': -28
                                                }))),
                                    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/pitchers/")
                                    ),
                                            width=3)
                                ])),
                        ],
                                vertical="md",
                                horizontal='start',
                                className="ml-auto"),
                    ],
                    id="sidebar",
                    style={
                        "position": "fixed",
                        "top": 55,
                        "left": "-13rem",
                        "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": 0,
                "background-color": "rgba(0, 0, 0, 0.5)",
                "transition": "left .2s",
            })
    ])

    @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'] == "-13rem" and style2['margin-left'] == 0:
            style1['left'] = 0
            style2['margin-left'] = 210
            style3['width'] = "100%"
            return style1, style2, style3
        else:
            style1['left'] = "-13rem"
            style2['margin-left'] = 0
            style3['width'] = 0
            return style1, style2, style3

    @app.callback(Output('team_win_graph', 'figure'),
                  Output('month_winprop_graph', 'figure'),
                  Input('team_name_select', 'value'))
    def update_output(value):
        fig1 = go.Figure()
        fig2 = go.Figure()
        for i in range(len(value)):
            year, prop, pred = team_win_table(value[i])
            prop1 = month_win_prop(value[i])
            fig1.add_trace(go.Scatter(x=year, y=prop, name=value[i]))
            fig2.add_trace(
                go.Bar(x=[3, 4, 5, 6, 7, 8, 9, 10],
                       y=prop1,
                       name=value[i],
                       text=prop1))
            fig2.update_traces(texttemplate='%{text:.2f}',
                               textposition='outside')
        fig1.update_layout(margin=dict(l=0, r=0, t=0, b=0),
                           template='plotly_white',
                           height=300,
                           xaxis=dict(tickmode='linear', dtick=1),
                           legend=dict(orientation="h",
                                       yanchor="bottom",
                                       xanchor="center",
                                       x=0.5,
                                       y=-0.2))
        fig2.update_layout(margin=dict(l=0, r=0, t=0, b=0),
                           template='plotly_white',
                           height=300,
                           xaxis=dict(tickmode='linear', dtick=1),
                           legend=dict(orientation="h",
                                       yanchor="bottom",
                                       xanchor="center",
                                       x=0.5,
                                       y=-0.2))
        return fig1, fig2

    @app.callback(Output('name_list', "options"), Output('name_list', "value"),
                  Input('player', "value"))
    def batter_name_list(value):
        if value == 'pitcher':
            pitcher_name = pitcher_names()
            value = ['']
            options = [{'label': i, 'value': i} for i in pitcher_name]
            return options, value
        else:
            batter_name = batter_names()
            value = ['']
            options = [{'label': i, 'value': i} for i in batter_name]
            return options, value

    @app.callback(Output('graph2', "figure"), Input('name_list', "value"),
                  Input('player', "value"))
    def batter_graph(value, value2):
        if value2 == 'batter':
            fig = make_subplots(rows=2,
                                cols=1,
                                vertical_spacing=0.1,
                                specs=[[{
                                    "type": "scatterpolar"
                                }], [{
                                    "type": "table"
                                }]])
            df = pd.DataFrame(
                columns=['NAME', 'AVG', 'OBP', 'SLG', 'ISO', 'EOBP'])
            if len(value) == 0: value = ['']
            for i in range(len(value)):
                scores = c_batter_yearly_base(value[i])
                df.loc[i] = scores[-1]
                df.replace(scores[-1][0], value[i], inplace=True)
                fig.add_trace(
                    go.Scatterpolar(r=list(scores[-1][1:]),
                                    opacity=0.7,
                                    theta=[
                                        ' 평균타율(AVG) ', ' 출루율(OBP) ',
                                        ' 장타율(SGL) ', ' 순장타율(ISO) ',
                                        ' 순출루율(EOBP) '
                                    ],
                                    fill='toself',
                                    name=value[i]), 1, 1)
            fig.add_trace(
                go.Table(header=dict(values=df.columns,
                                     height=32,
                                     fill_color='#6E757C',
                                     line_color='#6E757C',
                                     align='center',
                                     font=dict(color='white')),
                         cells=dict(values=[
                             df.NAME, df.AVG, df.OBP, df.SLG, df.ISO, df.EOBP
                         ],
                                    fill_color='white',
                                    line_color='#6E757C',
                                    font=dict(color='black'),
                                    align='center',
                                    height=32)), 2, 1)
            fig.update_layout(height=610,
                              margin=dict(l=0, r=0, t=35, b=0),
                              template=None,
                              polar=dict(radialaxis=dict(visible=True,
                                                         showticklabels=False,
                                                         ticks=''),
                                         angularaxis=dict(showticklabels=True,
                                                          ticks='',
                                                          tickfont_size=13)),
                              yaxis=dict(anchor="free",
                                         side="left",
                                         position=0.015),
                              xaxis=dict(tickmode='linear', dtick=1),
                              legend=dict(orientation="h",
                                          yanchor="bottom",
                                          y=1.05,
                                          xanchor="center",
                                          x=0.5))
        else:
            fig = make_subplots(rows=2,
                                cols=1,
                                vertical_spacing=0.1,
                                specs=[[{
                                    "type": "scatterpolar"
                                }], [{
                                    "type": "table"
                                }]])
            df = pd.DataFrame(
                columns=['NAME', 'AVG', 'OBP', 'RA9', 'ERA', 'FIP'])
            if len(value) == 0: value = ['']
            for i in range(len(value)):
                scores, temp = c_pitcher_yearly_base(value[i])
                df.loc[i] = scores[-1]
                df.replace(scores[-1][0], value[i], inplace=True)
                df.replace(float('inf'), 0, inplace=True)
                df = df.fillna(0)
                fig.add_trace(
                    go.Scatterpolar(r=list(scores[-1][1:]),
                                    opacity=0.7,
                                    theta=[
                                        ' 피안타율(AVG) ', ' 피출루율(OBP) ',
                                        ' 평균실점(RA9) ', ' 평균자책점(ERA) ',
                                        ' 수비무관투구(FIP) '
                                    ],
                                    fill='toself',
                                    name=value[i]), 1, 1)
                fig.add_trace(
                    go.Table(header=dict(values=df.columns,
                                         height=32,
                                         fill_color='#6E757C',
                                         line_color='#6E757C',
                                         align='center',
                                         font=dict(color='white')),
                             cells=dict(values=[
                                 df.NAME, df.AVG, df.OBP, df.RA9, df.ERA,
                                 df.FIP
                             ],
                                        fill_color='white',
                                        line_color='#6E757C',
                                        font=dict(color='black'),
                                        align='center',
                                        height=32)), 2, 1)
            fig.update_layout(height=610,
                              margin=dict(l=0, r=0, t=35, b=0),
                              template=None,
                              polar=dict(radialaxis=dict(visible=True,
                                                         showticklabels=False,
                                                         ticks=''),
                                         angularaxis=dict(showticklabels=True,
                                                          ticks='',
                                                          tickfont_size=13)),
                              yaxis=dict(anchor="free",
                                         side="left",
                                         position=0.015),
                              xaxis=dict(tickmode='linear', dtick=1),
                              legend=dict(orientation="h",
                                          yanchor="bottom",
                                          y=1.05,
                                          xanchor="center",
                                          x=0.5))
        return fig

    return app
コード例 #18
0
                 children=dbc.Button(id="return-start",
                                     color="primary",
                                     className="mr-1",
                                     children="Return to start",
                                     n_clicks=0))
    ])
### Specify initial layout ###
app.layout = html.Div(
    id="main-body",
    children=[
        dbc.NavbarSimple(
            children=[
                dbc.DropdownMenu(children=[
                    dbc.NavItem(
                        dbc.NavLink("Basic",
                                    id="basic-link",
                                    href="http://localhost:8050",
                                    n_clicks=0)),
                    dbc.NavItem(
                        dbc.NavLink("Anti Spoofing",
                                    id="anti-spoofing-link",
                                    href="/",
                                    n_clicks=0))
                ],
                                 nav=True,
                                 in_navbar=True,
                                 label="Select demo",
                                 id="dropdown-menu")
            ],
            brand="Group 5 Demo",
            color="dark",
コード例 #19
0
from app import server
from app import app
from apps import shells, attractors, more_attractors, home, style_transfer, rick_gen
import base64

image_filename = 'me.png'  # logo
encoded_image = base64.b64encode(open(image_filename, 'rb').read())
#'data:image/png;base64,{}'.format(encoded_image.decode())

#app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
# try running the app with one of the Bootswatch themes e.g.
# app = dash.Dash(external_stylesheets=[dbc.themes.JOURNAL])
# app = dash.Dash(external_stylesheets=[dbc.themes.SKETCHY])

# make a reuseable navitem for the different examples
nav_item = dbc.NavItem(dbc.NavLink("Home", href="/home"))

# make a reuseable dropdown for the different examples
dropdown = dbc.DropdownMenu(
    children=[
        dbc.DropdownMenuItem("Sea Shells", href="/shell"),
        dbc.DropdownMenuItem("Lorenz Attractors", href="/lorenz"),
        dbc.DropdownMenuItem("More Attractors", href="/attractors"),
        dbc.DropdownMenuItem("Style Transfer", href="/style_transfer"),
        dbc.DropdownMenuItem(divider=True),
        dbc.DropdownMenuItem("Coming soon"),
        dbc.DropdownMenuItem("Rick & Morty Generator", href='/rick_gen'),
    ],
    nav=True,
    in_navbar=True,
    label="Menu",
コード例 #20
0
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server

db = get_db()
df_ag = find_df('df_ag', db)

##########
### UI ###
##########

navbar = dbc.Navbar(
    brand="Demo App",
    brand_href="#",
    sticky="top",
    children=[
        dbc.NavItem(dbc.NavLink("Page 1", href="#")),
        dbc.NavItem(dbc.NavLink("Page 2", href="#")),
        dbc.NavItem(dbc.NavLink("Page 3", href="#")),
        dbc.NavItem(dbc.NavLink("About", href="#")),
        # dbc.DropdownMenu(
        #     nav=True,
        #     in_navbar=True,
        #     label="Menu",
        #     children=[
        #         dbc.DropdownMenuItem("Entry 1"),
        #         dbc.DropdownMenuItem("Entry 2"),
        #         dbc.DropdownMenuItem(divider=True),
        #         dbc.DropdownMenuItem("Entry 3"),
        #     ],
        # ),
    ],
コード例 #21
0
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

# Imports from this application
from app import app, server
from pages import index, predictions, insights, process

# Navbar docs: https://dash-bootstrap-components.opensource.faculty.ai/l/components/navbar
navbar = dbc.NavbarSimple(
    brand='Hotel Check-Out',
    brand_href='/',
    children=[
        dbc.NavItem(
            dcc.Link('Predictions', href='/predictions',
                     className='nav-link')),
        #dbc.NavItem(dcc.Link('Insights', href='/insights', className='nav-link')),
        dbc.NavItem(dcc.Link('Process', href='/process',
                             className='nav-link')),
    ],
    sticky='top',
    color='dark',
    light=True,
    dark=True)

# Footer docs:
# dbc.Container, dbc.Row, dbc.Col: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout
# html.P: https://dash.plot.ly/dash-html-components
# fa (font awesome) : https://fontawesome.com/icons/github-square?style=brands
# mr (margin right) : https://getbootstrap.com/docs/4.3/utilities/spacing/
コード例 #22
0
wohntypen = df['Wohntyp'].unique()
wohntypendf = pd.DataFrame(wohntypen, columns=['c'])
wohntypendf = wohntypendf.dropna().sort_values('c')

regions = df['region'].unique()
regiondf = pd.DataFrame(regions, columns=['c'])
regiondf = regiondf.dropna().sort_values('c')

dev_states = df['dev_status'].unique()
dev_statesdf = pd.DataFrame(dev_states, columns=['c'])
dev_statesdf = dev_statesdf.dropna().sort_values('c')

# navbar
navbar = dbc.NavbarSimple(
    children=[
        dbc.NavItem(dbc.NavLink("Dashboard", href="#")),
        dbc.DropdownMenu(
            children=[
                dbc.DropdownMenuItem("Service 1", href="#"),
                dbc.DropdownMenuItem("Service 2", href="#"),
            ],
            nav=True,
            in_navbar=True,
            label="Services",
        ),
        dbc.NavItem(dbc.NavLink("Profile", href="#")),
        # dd space between links an logout button
        dbc.NavItem(dbc.NavLink(" ")),
        dbc.NavItem(dbc.NavLink(" ")),
        dbc.NavItem(dbc.NavLink(" ")),
        dbc.NavItem(dbc.NavLink(" ")),
コード例 #23
0
agri = pd.read_csv("data_csv/crops.csv")
quan_vul = pd.read_csv("data_csv/qntify_vulnerability_192.csv")
read_vul = pd.read_csv("data_csv/readiness_ec_social_gov_192.csv")
antarc_mass = pd.read_csv("data_csv/antarctica_mass.csv")
green_mass = pd.read_csv("data_csv/greenland_mass.csv")
dice_model = pd.read_csv("data_csv/DICE_model.csv")
gsl_merged = pd.read_csv("data_csv/sl_merged.csv")

weather = pd.read_csv("data_csv/weather-events-US-1980-2017.csv")
weather['Year'] = weather['Begin Date'].astype(str)
weather['Year'] = weather['Year'].str.slice(0,4)
weather['Year'] = weather['Year'].astype(int)

nav_menu = dbc.Nav(
    [
        dbc.NavItem(dbc.NavLink("Home", href="/", id = "home-link", style={"color":"white", "fontWeight":"bold"})),
        dbc.DropdownMenu(
            children=[
                dbc.DropdownMenuItem("Carbon Dioxide Concentration", href='/co2', id = "co2-link"),
                dbc.DropdownMenuItem("Carbon Dioxide Emission", href='/co2_emission', id = "co2-emiss-link"),
                dbc.DropdownMenuItem("Surface Temperature", href='/temp', id = "temp-link"),
                dbc.DropdownMenuItem("Antarctica Ice Sheet Mass", href='/antarc', id = "antarc-link"),
                dbc.DropdownMenuItem("Sea Level Rise", href='/sea', id = "sea-link"),
                dbc.DropdownMenuItem("Social Cost of Carbon", href='/scc', id = "scc-link")
            ],
            nav=True,
            in_navbar=True,
            label='Climate Change Charts',
            style={"color":"white", "fontWeight":"bold"}
        ),
        dbc.DropdownMenu(
コード例 #24
0
                       'Penthouse', 'Serviceflat', 'Studio', 'Tussenwoning',
                       'Twee onder kap', 'Villa', 'Vrijstaande woning',
                       'Woon-/winkelpand', 'Woonboerderij', 'Woonboot']

#Todo: ook gemiddelde prijs berekenen per gemeente
#Todo: Met 80, 90, 95% zekerheid confidence intervals gebaseerd op quantiles van average error
#Todo: multiple callbacks
#Todo: checken of perceeloppervlakte niet de m2 verpest

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.title = 'Huurprijs Indicator'
server = app.server

navbar = dbc.NavbarSimple(
    children=[
        dbc.NavItem(dbc.NavLink("Page 1", href="#")),
        dbc.DropdownMenu(
            children=[
                dbc.DropdownMenuItem("More pages", header=True),
                dbc.DropdownMenuItem("Page 2", href="#"),
                dbc.DropdownMenuItem("Page 3", href="#"),
            ],
            nav=True,
            in_navbar=True,
            label="More",
        ),
    ],
    brand="Point Forecast Consultancy",
    brand_href="http://www.pointforecastconsultancy.nl",
    color="info",
    dark=True,
コード例 #25
0
ファイル: app.py プロジェクト: pavlinb/dash-sample-apps
                             height="30px",
                         ),
                         href="https://plotly.com/dash/",
                     )),
                 dbc.Col(dbc.NavbarBrand("Object Properties App")),
                 modal_overlay,
             ],
             align="center",
         ),
         dbc.Row(
             dbc.Col([
                 dbc.NavbarToggler(id="navbar-toggler"),
                 dbc.Collapse(
                     dbc.Nav(
                         [
                             dbc.NavItem(button_howto),
                             dbc.NavItem(button_gh)
                         ],
                         className="ml-auto",
                         navbar=True,
                     ),
                     id="navbar-collapse",
                     navbar=True,
                 ),
             ]),
             align="center",
         ),
     ],
     fluid=True,
 ),
 color="dark",
コード例 #26
0
                             nav=True,
                             in_navbar=True,
                             style={
                                 'text-decoration': 'none',
                                 'padding': '0',
                                 'color': '#FFF'
                             })

nav = dbc.Nav(children=[
    dbc.NavItem(children=[
        dbc.NavLink(children=[
            html.Img(
                src=
                'https://emojis.slackmojis.com/emojis/images/1450822151/257/github.png',
                style={'width': '15px'}), ' GitHub Repo'
        ],
                    href=
                    'https://github.com/RodolfoFerro/psychopathology-fer-assistant/',
                    className='nav-link btn btn-light text-dark',
                    style={'margin-top': '9px'})
    ],
                className='nav-item mr-sm-2'),
    dbc.NavItem(children=[dbc.NavLink(children=[dropdowns], )],
                className='nav-item dropdown my-2 my-sm-0',
                style={
                    'text-decoration': 'none',
                    'padding': '0'
                })
],
              className=
              'navbar-nav navbar-expand-lg ml-auto flex-nowrap mt-3 mt-md-0',
コード例 #27
0
SIDEBAR_STYLE = {
    "position": "fluid",
}

# the styles for the main content position it to the right of the sidebar and
# add some padding.
CONTENT_STYLE = {
    "position": "fixed",
    "margin-left": "4rem",
    "margin-right": "4rem",
    "padding": "2rem 2rem",
}

navbar = dbc.NavbarSimple(
    children=[
        dbc.NavItem(dbc.NavLink("Summary", href="/page-1", id="page-1-link")),
        dbc.NavItem(dbc.NavLink("Portfolio Composition", href="/page-2", id="page-2-link")),
        dbc.NavItem(dbc.NavLink("PNL", href="/page-3", id="page-3-link")),
        dbc.NavItem(dbc.NavLink("Stock Charts", href="/page-4", id="page-4-link")),
        dbc.NavItem(dbc.NavLink("Transactions", href="/page-5", id="page-5-link")),
        dbc.NavItem(dbc.NavLink("Risk Analysis", href="/page-6", id="page-6-link")),
    ],
    brand="STOCKAPP",
    brand_href="/page-1",
    color="primary",
    dark=True,
    className="mb-4 containter-flex",
    style=SIDEBAR_STYLE,

)
コード例 #28
0
ファイル: layout.py プロジェクト: ABlack-git/501
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import map_component as mc

from inputs import inputs

navbar = dbc.NavbarSimple(
    children=[
        dbc.NavItem(
            dbc.NavLink(
                "501 team GitHub",
                href="https://github.com/coding-competition-2019/501")),
    ],
    brand="501 Activities APP",
    brand_href="#",
    sticky="top",
)

body = html.Div(
    [
        dbc.Row([
            dbc.Col(
                [
                    html.H2("There is always time for sport..."),
                    html.P(""),
                ],
                md=3,
            ),
        ]),
        dbc.Row([
コード例 #29
0
# _*_ coding: utf-8 _*_
"""
导航栏
"""

import dash_html_components as html
import dash_bootstrap_components as dbc

PLOTLY_LOGO = "https://images.plot.ly/logo/new-branding/plotly-logomark.png"

# 通用组件
nav_item1 = dbc.NavItem(children=dbc.NavLink("首页", href="/"))
nav_item2 = dbc.NavItem(children=dbc.NavLink("Link2", href="#"))
drop_down = dbc.DropdownMenu(children=[
    dbc.DropdownMenuItem("More", header=True),
    dbc.DropdownMenuItem("Entry app1", href="/app1"),
    dbc.DropdownMenuItem("Entry app2", href="/app2"),
    dbc.DropdownMenuItem(divider=True),
    dbc.DropdownMenuItem("Entry app3", href="/app3"),
    dbc.DropdownMenuItem("Entry app4", href="/app4"),
],
                             nav=True,
                             in_navbar=True,
                             label="Menu")

# 定义不同的导航栏
navbar_default = dbc.NavbarSimple(children=[nav_item1, nav_item2, drop_down],
                                  brand="Dash",
                                  brand_href="#",
                                  sticky="top")
コード例 #30
0
    </body>
</html>"""

NAVBAR = dbc.Navbar(
    children=[
        dbc.NavbarBrand(
            html.Img(
                src="https://gnps-cytoscape.ucsd.edu/static/img/GNPS_logo.png",
                width="120px",
            ),
            href="https://gnps.ucsd.edu",
        ),
        dbc.Nav(
            [
                dbc.NavItem(
                    dbc.NavLink(
                        "Metabolomics USI", href="/", className="nav-link")),
            ],
            navbar=True,
        ),
    ],
    color="light",
    dark=False,
    sticky="top",
)

DATASELECTION_CARD = [
    dbc.CardHeader(
        dbc.Row([
            dbc.Col(html.H5("USI Data Selection")),
            dbc.Col(