Beispiel #1
0
def render_html_layout():
    """ Rendering della pagina completa"""
    return html.Div([
        html.Meta(name='viewport',
                  content='width=device-width, initial-scale=1.0'),
        html.Meta(
            name='description',
            content=
            ('Security Dashboard '
             'A dashboard that shows the status of security features on .gov.it websites'
             )),
        header_layout(),
        html.Div(
            [
                html.Div(dcc.Tabs(tabs=[
                    {
                        'label': 'Introduzione',
                        'value': 1
                    },
                    {
                        'label': 'Cerca',
                        'value': 2
                    },
                    {
                        'label': 'Esplora',
                        'value': 3
                    },
                ],
                                  value=1,
                                  id='tabs',
                                  vertical=True,
                                  style={
                                      'height': '100vh',
                                      'borderRight': 'thin lightgrey solid',
                                      'textAlign': 'left'
                                  }),
                         style={
                             'width': '20%',
                             'float': 'left'
                         }),
                html.Div(html.Div(id='tab-output'),
                         style={
                             'width': '80%',
                             'float': 'right'
                         })
            ],
            style={
                'fontFamily': 'Sans-Serif',
                'margin-left': 'auto',
                'margin-right': 'auto',
            })
    ])
Beispiel #2
0
    def _set_layout(self):
        layout = html.Div(
            [
                html.Div(
                    [
                        html.Link(rel="stylesheet", href="/static/css/data_story.css"),
                        html.Link(
                            href="https://fonts.googleapis.com/css2?family=Lato&display=swap",
                            rel="stylesheet",
                        ),
                        html.Link(
                            href="https://fonts.googleapis.com/icon?family=Material+Icons",
                            rel="stylesheet",
                        ),
                        html.Meta(
                            name="viewport",
                            content="width=device-width, initial-scale=1.0",
                        ),
                        dcc.Location(id="url", refresh=False),
                    ],
                    id="meta",
                ),
                html.Div(
                    [el.layout for el in self.ind_elements], id="independent-elements"
                ),
                html.Div(self.get_container(), id="ds-paginator"),
            ],
            id="ds-wrapper",
        )

        self.app.layout = layout
Beispiel #3
0
    def update_figure(value, clickData):
        tweetData = json.dumps(clickData, indent=2)
        dictData = json.loads(tweetData)
        #Print dictData if the indices of full_text or source_url or bias ever get messed up
        # print(dictData)
        try:
            full_text = dictData['points'][0]['customdata'][cfg.getProperty(
                "dash_app.dash_text.tweetMeta.full_text_id")]
            source_url = dictData['points'][0]['customdata'][cfg.getProperty(
                "dash_app.dash_text.tweetMeta.source_url_id")]
            bias = dictData['points'][0]['customdata'][cfg.getProperty(
                "dash_app.dash_text.tweetMeta.bias_id")]
        except:
            full_text = "Not available"
            source_url = "Not available"
            bias = "Not available"

        if value == 'showMeta':

            return html.Div(children=[
                html.Meta(charSet='UTF-8'),
                html.H4(cfg.getProperty("dash_app.dash_text.tweetMeta.title")),
                html.P(cfg.getProperty(
                    "dash_app.dash_text.tweetMeta.intro_P")),
                #Show Full_text
                dcc.Markdown('''**Text:**'''),
                html.P(full_text),
                #Show URL Link (aka source)
                dcc.Markdown('''**Source:**'''),
                dcc.Markdown(source_url),
                #Show political bias
                dcc.Markdown('''**Political Bias**'''),
                html.P(bias)
            ])
Beispiel #4
0
def get_ecu_hist():
    ecu_hist = html.Div([
        html.Meta(name='viewport',
                  content='width=device-width, initial-scale=1.0'),
        html.Link(rel='shortcut icon', href='static/favicon.ico'),
        html.Div([
            dcc.Link(html.Img(src='static/mechPandaProfile.png',
                              height='40',
                              width='40',
                              className='accountPic'),
                     href='/'),
            html.P('Mechanic Panda', className='accountName'),
            html.Img(src='static/user.png',
                     height='40',
                     width='40',
                     className='userPic'),
            html.P('Adam Smith', className='userName'),
        ],
                 className="account"),
        html.Div([
            html.Div([
                html.P('Time Range'),
                dcc.RangeSlider(count=1,
                                min=-60,
                                max=0,
                                step=1.0,
                                marks={
                                    -60: '-60 Days',
                                    -40: '-40 Days',
                                    -20: '-20 Days',
                                    0: 'today'
                                },
                                value=[-5, 0])
            ],
                     className='slider'),
            html.Div(dcc.Input(placeholder='Search (VIN, Brand, etc.)',
                               type='text',
                               value=''),
                     className='search'),
        ],
                 className='header'),
        ehc.get_hist(ecu_temperature_gadget)
    ])
    return ecu_hist
def init_dashboard(server):
    #TODO: Implement the web scrapping logic here
    #1.Allocate a small amount of memory for the graph arguments inside the CatDataHandler
    #2.Implement callbacks to update the graphs as soon as the argument values change
    #3.Implement some indication on the UI to highlight when a new scrapping session is taking place
    #4.Store scrapped values into a database (Redis?)

    dash_app = dash.Dash(server=server,
                         routes_pathname_prefix='/dashapp/',
                         external_stylesheets=[
                             '/static/styles.css',
                         ])

    #Instance caterpillar data handling object and start scrapping for sale listings
    cat_data = CatDataHandler()
    cat_data.prepare_data()
    cat_data.draw_map()

    #Import Map HTML file
    #map_html = open('flask_app/dash/map.html', 'r').read()
    map_html = open('map.html', 'r').read()

    #Dashboard Markdown description text
    desc_text = '''
    Desglose de indicadores estadísticos acerca de la oferta de venta de equipos de la marca Caterpillar en mercados virtuales de la República Dominicana. La data es adquirida mediante el proceso de web-scrapping de listings en sitios de venta como [corotos.com.do](https://www.corotos.com.do/k/caterpillar) y [mercadolibre.com.do](https://vehiculos.mercadolibre.com.do/caterpillar). 
    '''

    font_settings = dict(
        family="Courier New, monospace",
        size=14,
        #color="Orange",
    )
    #fig_width = 350
    #fig_height = 350

    #Figure 1
    fig1 = go.Figure(
        data=go.Histogram(x=cat_data.prices,
                          histnorm='probability',
                          xbins=dict(start=0, end=5000000, size=750000)))
    fig1.update_layout(
        title={
            'text': 'Distribución de precios',
            'y': 0.85,
            'x': 0.5,
            'xanchor': 'center',
            'yanchor': 'top'
        },
        xaxis_title_text='Precio de venta (DOP)',
        yaxis_title_text='Probabilidad',
        bargap=0.1,
        font=font_settings,
        #width=fig_width,
        height=350)

    #Figure 2
    fig2 = go.Figure(data=[
        go.Pie(labels=cat_data.unique_currencies,
               values=cat_data.currencies_counts)
    ])
    fig2.update_traces(hoverinfo='label+percent',
                       textinfo='percent',
                       textfont_size=20,
                       marker=dict(colors=['mediumturquoise', 'gold'],
                                   line=dict(color='#000000', width=2)))
    fig2.update_layout(
        title={
            'text': 'Distribución de monedas',
            'y': 0.85,
            'x': 0.5,
            'xanchor': 'center',
            'yanchor': 'top'
        },
        font=font_settings,
        #width=fig_width,
        height=350)

    #Figure 3
    fig3 = go.Figure(data=go.Bar(x=cat_data.unique_models,
                                 y=cat_data.avg_model_prices,
                                 marker_color='green'))
    fig3.update_layout(
        title={
            'text': 'Precio de venta promedio por modelo',
            'y': 0.85,
            'x': 0.5,
            'xanchor': 'center',
            'yanchor': 'top'
        },
        xaxis_title_text='Modelo Caterpillar',
        yaxis_title_text='Precio de venta (DOP)',
        font=font_settings,
        #width=fig_width,
        height=400)

    #Figure 4
    fig4 = go.Figure(data=go.Bar(x=cat_data.unique_provs,
                                 y=cat_data.unique_provs_counts,
                                 marker_color='lightsalmon',
                                 text=cat_data.unique_provs_counts,
                                 textposition='auto'))
    fig4.update_layout(
        title={
            'text': 'Número de ofertas por provincia',
            'y': 0.85,
            'x': 0.5,
            'xanchor': 'center',
            'yanchor': 'top'
        },
        #title_text='Número de ofertas por provincia',
        xaxis_title_text='Provincia',
        yaxis_title_text='Vehículos ofertados',
        xaxis_tickangle=45,
        font=font_settings)

    #Dash HTML layout
    dash_app.layout = html.Div(
        className='dash-container',
        children=[
            html.Meta(name='viewport',
                      content='width=device-width, initial-scale'),
            #html.Link(rel='stylesheet', href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"),
            html.Div(
                className='title-div',
                children=[
                    html.H1(children=[
                        'Análisis de la oferta de productos ',
                        html.Span(className='cat-span', children='Caterpillar'
                                  ), ' en el mercado de ventas por internet.'
                    ])
                ]),
            html.Div(
                className='cred-div',
                children=[
                    html.Div(className='author-div',
                             children=[
                                 html.Span(className='author-text',
                                           children=[
                                               'Creado por: Gilson A. Frías P.'
                                           ])
                             ]),
                    html.Div(
                        className='social-media-div',
                        children=[
                            html.Div(
                                className='github-div',
                                children=[
                                    html.Img(
                                        className='github-img',
                                        src=dash_app.get_asset_url(
                                            'github.png')),
                                    html.A(
                                        className='social-media-url',
                                        href='https://github.com/GilsonFrias',
                                        children=[
                                            'https://github.com/GilsonFrias'
                                        ])
                                ]),
                            html.Div(
                                className='linkedin-div',
                                children=[
                                    html.Img(
                                        className='linkedin-img',
                                        src=dash_app.get_asset_url(
                                            'linkedin.png')),
                                    html.A(
                                        className='social-media-url',
                                        href='www.linkedin.com/in/gilsonfrias',
                                        children=[
                                            'www.linkedin.com/in/gilsonfrias'
                                        ])
                                ])
                        ]),
                    html.Div(className='date-div',
                             children=[
                                 html.Span(
                                     className='date-text',
                                     children=[
                                         'Última actualización: ',
                                         html.Span(
                                             className='date-span',
                                             children=[cat_data.today_date])
                                     ])
                             ])
                ]),
            html.Div(className='desc-div',
                     children=[dcc.Markdown(children=desc_text)]),
            html.Div(
                className='fig1-container',
                children=[
                    html.Div(
                        className='fig1-div',
                        children=[
                            dcc.Graph(id='prices-dist-hist', figure=(fig1))
                        ]),
                    html.Div(
                        className='fig1-div',
                        children=[
                            html.Ul(
                                className='fig1-metrics-ul',
                                children=[
                                    html.Li(
                                        className='header-li',
                                        children=[
                                            'Volumen total ofertado (DOP):'
                                        ]),
                                    html.Li(
                                        id='total-sales-li',
                                        className='field-li',
                                        children=[
                                            format(cat_data.total_sale_price,
                                                   ',d')
                                        ]),
                                    html.Li(className='header-li',
                                            children=[
                                                'Total vehículos ofertados:'
                                            ]),
                                    html.Li(id='total-listings-li',
                                            className='field-li',
                                            children=[
                                                format(cat_data.total_listings,
                                                       ',d')
                                            ]),
                                    html.Li(
                                        className='header-li',
                                        children=[
                                            'Precio de venta promedio (DOP):'
                                        ]),
                                    html.Li(id='avg-price-li',
                                            className='field-li',
                                            children=[
                                                format(cat_data.avg_price,
                                                       ',d')
                                            ])
                                ])
                        ]),
                    html.Div(className='fig1-div',
                             children=[
                                 dcc.Graph(id='currencies-pie',
                                           className='fig2-fig',
                                           figure=(fig2))
                             ])
                ]),
            html.Div(className='prov-div',
                     children=[
                         html.Iframe(className='map-div', srcDoc=map_html),
                         html.Div(className='map-div',
                                  children=[
                                      dcc.Graph(id='provinces-bar',
                                                className='fig4-fig',
                                                figure=(fig4))
                                  ])
                     ]),
            #html.H2(children='Análisis de ofertas de venta de acuerdo a modelo'),
            html.Div(className='fig3-container',
                     children=[
                         html.Div(className='fig3-div',
                                  children=[
                                      dcc.Graph(id='prices-per-model',
                                                className='fig3-fig',
                                                figure=(fig3))
                                  ])
                     ]),
            html.Div(
                className='models-title',
                children=[html.H2(children='Top 3 modelos más ofertados')]),
            html.Div(
                className='models-container',
                children=[
                    html.Div(
                        className='models-div',
                        children=[
                            html.Div(
                                className='models-fig-div',
                                children=[
                                    html.Img(
                                        className='models-fig',
                                        src=cat_data.images_urls[
                                            cat_data.top_models[n][0]])
                                ]),
                            html.Div(
                                className='models-text-div',
                                children=[
                                    html.
                                    Ul(className='models-ul',
                                       children=[
                                           html.
                                           Li(className='models-li-header',
                                              children=[
                                                  cat_data.top_models[n][0]
                                              ]),
                                           html.
                                           Li(className='models-li',
                                              children=[
                                                  'Precio promedio (DOP): {}'.
                                                  format(
                                                      format(
                                                          int(cat_data.
                                                              top_models[n]
                                                              [1]), ',d'))
                                              ]
                                              ),
                                           html.
                                           Li(className='models-li',
                                              children=[
                                                  'Cantidad en oferta: {} ({}%)'
                                                  .
                                                  format(
                                                      cat_data.
                                                      unique_models_counts[
                                                          cat_data.
                                                          unique_models ==
                                                          cat_data.
                                                          top_models[n][0]][0],
                                                      '{0:.2f}'.format(
                                                          cat_data.
                                                          unique_models_counts[
                                                              cat_data.
                                                              unique_models ==
                                                              cat_data.
                                                              top_models[n][0]]
                                                          [0] / cat_data.
                                                          unique_models_counts.
                                                          sum() * 100))
                                              ])
                                       ])
                                ])
                        ]) for n in range(3)
                ]),
        ])

    return dash_app.server
Beispiel #6
0
    style = {'padding': '5px', 'fontSize': '16px'}
    time = d.get('emailtime','-')
    return [
        html.Span('Packets received: {}'.format(n), style=style),
        html.Span('Last packet received: {}'.format(time), style=style),
        html.Span('Current Longitude: {0:.2f}'.format(d.get('lon', 0.0)), style=style),
        html.Span('Current Latitude: {0:.2f}'.format(d.get('lat', 0.0)), style=style),
        html.Span('Current Altitude: {0:.2f}'.format(d.get('alt', 0.0)), style=style),
        html.Span('Bias Voltage: {0:.2f}'.format(d.get('volts', 0.0)), style=style),
        html.Span('ASIC Status: {}'.format(d.get('asicstate', 0.0)), style=style),
        html.Span('SIPHRA Status: {}'.format(d.get('siphrastate', 0.0)), style=style),
        html.Span('Flight Status: {}'.format(d.get('flightstate', 0.0)), style=style),]

app.layout=html.Div(id='container', className='background',
    children=[
        html.Meta(name='viewport', content='width=device-width, initial-scale=1.0'),
        html.Meta(
            name='description',
            content=('GMoDem 2018 Flight Dashboard')
        ),
        header,
        html.Div(className='content-container', children=[
            html.Div(className='section-container', children=[
                html.Div(id='summary_div', children=make_summary_data(), className='container-width',
                ),
            ]),
            html.Hr(),
            html.Div(className='section-container', children=[
                html.Div(id='map_div',
                    children=dcc.Graph(id='map-graph', figure=init_map(), config=plotly_config),
                ),
Beispiel #7
0
import dash_bootstrap_components as dbc
from random import randint
import os
import dash_html_components as html
import dash
import flask
#server = app.server
server = flask.Flask(__name__)
server.secret_key = os.environ.get('secret_key', str(randint(0, 1000000)))
app = dash.Dash(__name__,external_stylesheets=[dbc.themes.DARKLY], assets_folder='assets',server=server)
app.config['suppress_callback_exceptions'] = True
app.head=[
     html.Meta(charSet="UTF-8",name="viewport",content="width=device-width, initial-scale=1.0, maximum-scale=1.0,shrink-to-fit=yes, user-scalable=no")
]
Beispiel #8
0
            ]),
        html.Div(className='container form-check',
                 children=[
                     html.H5('Active sessions'),
                     html.Ul(id='active-sessions', children=[])
                 ]),
    ])

# Main content area
content = html.Div(className='col-sm-9 offset-sm-3 col-md-10 offset-md-2 pt-3',
                   id='main',
                   children=[])

# Layout
app.layout = html.Div([
    html.Meta(name='viewport',
              content='width=device-width, initial-scale=1.0'),
    html.Meta(
        name='description',
        content=
        ('Dashboard for viewing the (live) results of your reinforcement learning session.'
         )), navbar,
    html.Div(className='container-fluid row', children=[sidebar, content]),
    dcc.Interval(id='interval-component', interval=update_interval * 1000),
    html.Div(id='null', children=[])
])

app.title = 'DRL Dashboard'


@app.callback(Output('main', 'children'), [Input('toc', 'value')])
def display_content(selected_chapter):
Beispiel #9
0
    return [
        html.Div([
            html.H1('Example'),
            html.Div(divs, id='model-k2-divs'),
        ],
                 style={
                     'maxWidth': '720px',
                     'margin': '0 auto'
                 },
                 id='example')
    ]


app.layout = html.Div(children=[
    html.Meta(name='viewport',
              content='width=device-width, initial-scale=1.0'),
    html.Div([
        html.Div([
            html.Div(html.Div(id="page", className="content"),
                     className="content-container"),
        ],
                 className="container-width")
    ],
             className="background"),
    dcc.Location(id='location', refresh=False),
],
                      style={
                          'width': '70%',
                          'margin': '0 auto'
                      })
Beispiel #10
0
    "https://fonts.googleapis.com/css2?family=Lato&display=swap"
]

app = dash.Dash(__name__,
                external_stylesheets=external_stylesheets,
                meta_tags=[{
                    "name":
                    "viewport",
                    "content":
                    "maximum-scale=1.0, initial-scale=1.0, width=device-width"
                }])
app.title = "Covid-19 Exposure Risk"
server = app.server
app.head = [
    html.Meta(
        content="maximum-scale=1.0, initial-scale=1.0, width=device-width",
        name="viewport")
]


def get_county_info():
    # Get a dict of Calif. counties and their respective populations from the US Census
    url = "https://api.census.gov/data/2019/pep/population"
    params = {
        "get": "NAME,POP",
        "for": "county:*",
        "in": "state:06"  # 06 == California
    }
    resp = requests.get(url, params=params)
    #status = resp.status_code
    data = resp.json()
Beispiel #11
0
                title='DayaData',
                update_title='Memuat...')
server = app.server
# assume you have a "long-form" data frame
# see https://plotly.com/python/px-arguments/ for more options

#df_selected = pd.DataFrame({
#            "Status": ["Fullfiled", "Unfullfiled"],
#            "Point": [df_value.sum(), CONST_ALL.stop*5-df_value.sum()]
#        })
#
#print(df_selected)
#fig = px.pie(df_selected, values='Point', names='Status',title='IDM Semua Bidang')

app.layout = html.Div(children=[
    html.Meta(charSet="utf-8"),
    html.Meta(name="viewport", content="width=device-width, initial-scale=1"),
    html.Section(
        id="nav-bar",
        children=[
            html.Nav(
                className="navbar navbar-expand-lg navbar-light",
                children=[
                    html.A(className="navbar-brand", children=['''DayaData'''
                                                               ]),
                    html.Div(
                        id="navbarNav",
                        className="collapse navbar-collapse",
                        children=[
                            html.Ul(
                                className="navbar-nav ml-auto",
Beispiel #12
0
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('选择库存文件')]),
                                       className='my_upload',
Beispiel #13
0
def init_dasboard(server):
    dash_app = dash.Dash(server=server,
                         routes_pathname_prefix='/dashapp/',
                         external_stylesheets=[dbc.themes.BOOTSTRAP])

    df = pd.DataFrame({
        'month': ['Enero', 'Febrero', 'Marzo'],
        'day': [[
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
            20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
        ],
                [
                    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
                    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
                ],
                [
                    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
                    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
                ]],
        'users': [[
            325, 324, 405, 400, 424, 404, 417, 432, 419, 394, 410, 426, 413,
            419, 404, 408, 401, 377, 368, 361, 234, 356, 345, 354, 345, 345,
            378, 344, 342, 412, 453
        ],
                  [
                      432, 419, 394, 410, 426, 413, 419, 404, 408, 401, 377,
                      368, 361, 234, 356, 345, 354, 345, 345, 378, 344, 342,
                      412, 453, 324, 405, 400, 424
                  ],
                  [
                      408, 401, 377, 368, 361, 234, 356, 345, 354, 345, 345,
                      378, 344, 342, 412, 453, 324, 405, 400, 424, 432, 419,
                      394, 410, 426, 413, 419, 404, 408, 401, 377
                  ]]
    })

    df2 = pd.read_csv(
        'https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv'
    )

    dash_app.layout = html.Div(children=[
        html.Meta(httpEquiv='X-UA-Compatible', content='IE=edge'),
        html.Meta(
            name='viewport',
            content=
            'width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, minimum-scale=1, user-scalable=0'
        ),
        html.Div(style={'border-bottom': '2px solid black'},
                 className='d-flex flex-column justify-content-between',
                 children=[
                     dbc.Container(
                         className="d-flex justify-content-around",
                         children=[
                             dbc.RadioItems(
                                 id='option-group',
                                 className='mt-5 mr-5',
                                 value='mensual',
                                 options=[{
                                     'label': 'Mensual',
                                     'value': 'mensual',
                                     'class': 'pt-5'
                                 }, {
                                     'label': 'Diario',
                                     'value': 'diario'
                                 }],
                             ),
                             dbc.Select(id='option-month',
                                        className='mt-5',
                                        value=0,
                                        options=[{
                                            'label': df['month'][i],
                                            'value': i
                                        } for i in range(len(df['month']))]),
                         ]),
                     dcc.Graph(id='graph-1', config={'displayModeBar': False}),
                     dcc.Graph(id='graph-2'),
                 ]),

        #html.Div(style={'height': '100vh', 'border-bottom': '2px solid black'}, className='p-4 d-flex flex-column justify-content-between', children=[
        #    dash_table.DataTable(
        #        id='datatable',
        #        columns=[{'name': i, 'id': i, 'selectable': True} for i in df2.columns],
        #        data=df2.to_dict('records'),
        #        filter_action='native',
        #        sort_action='native',
        #        sort_mode='multi',
        #        row_selectable='multi',
        #        selected_columns=[],
        #        selected_rows=[],
        #        page_action='native',
        #        page_current=0,
        #        page_size=20
        #    ),
        #    html.Div(id='datatable-graph', style={'overflowY': 'scroll'})
        #]),
    ])

    #@dash_app.callback(
    #    Output('datatable', 'style_data_conditional'),
    #    Input('datatable', 'selected_columns')
    #)
    #def update_styles(selected_columns):
    #    return [{
    #        'if': {'column_id': i},
    #        'background_color': '#D2F3FF',
    #    } for i in selected_columns]

    #@dash_app.callback(
    #    Output('datatable-graph', 'children'),
    #    Input('datatable', 'derived_virtual_data'),
    #    Input('datatable', 'derived_virtual_selected_rows')
    #)
    #def update_graphs(rows, derived_virtual_selected_rows):
    #    if derived_virtual_selected_rows is None:
    #        derived_virtual_selected_rows = []

    #    dff = df2 if rows is None else pd.DataFrame(rows)
    #    colors = ['#7FDBFF' if i in derived_virtual_selected_rows else '#0074D9'
    #                for i in range(len(dff))]

    #    return [
    #        dcc.Graph(
    #            id=column,
    #            figure={
    #                'data': [
    #                    {
    #                        'x': dff['country'],
    #                        'y': dff[column],
    #                        'type': 'bar',
    #                        'marker': {'color': colors}
    #                    }
    #                ],
    #                'layout': {
    #                    'xaxis': {'automargin': True},
    #                    'yaxis': {
    #                        'automargin': True,
    #                        'title': {'text': column}
    #                    },
    #                    'height': 700,
    #                    'margin': {'t': 10, 'l': 10, 'r': 10}
    #                }
    #            }
    #        ) for column in ['pop', 'lifeExp', 'gdpPercap'] if column in dff
    #    ]

    @dash_app.callback(Output('graph-1', 'figure'),
                       Output('graph-2', 'figure'),
                       Input('option-month', 'value'),
                       Input('option-group', 'value'))
    def change_month(pos, group):
        pos = int(pos)
        fig1 = None

        if group == 'mensual':
            if pos == 0:
                fig1 = go.Figure(
                    go.Indicator(mode="number+delta",
                                 value=sum(df['users'][pos]),
                                 delta={
                                     'reference': sum(df['users'][pos]),
                                     'valueformat': '.0f'
                                 },
                                 title={
                                     "text":
                                     "Usuarios mensuales en {}".format(
                                         df['month'][pos])
                                 },
                                 align='center',
                                 domain={
                                     'y': [0, 1],
                                     'x': [0, 1]
                                 }))
            else:
                fig1 = go.Figure(
                    go.Indicator(mode="number+delta",
                                 value=sum(df['users'][pos]),
                                 delta={
                                     'reference': sum(df['users'][pos - 1]),
                                     'valueformat': '.0f'
                                 },
                                 title={
                                     "text":
                                     "Usuarios mensuales en {}".format(
                                         df['month'][pos])
                                 },
                                 align='center',
                                 domain={
                                     'y': [0, 1],
                                     'x': [0, 1]
                                 }))
        else:
            fig1 = go.Figure(
                go.Indicator(mode='number+delta',
                             value=df['users'][pos][len(df['users'][pos]) - 1],
                             delta={
                                 'reference':
                                 df['users'][pos][len(df['users'][pos]) - 2],
                                 'valueformat':
                                 '.0f'
                             },
                             title={
                                 'text':
                                 'Usuarios el último día de {}'.format(
                                     df['month'][pos])
                             },
                             align='center',
                             domain={
                                 'y': [0, 1],
                                 'x': [0, 1]
                             }))

        fig2 = go.Figure(
            go.Scatter(y=df['users'][pos], x=df['day'][pos], fill='tonexty'))

        fig2.update_layout(plot_bgcolor='white')

        return fig1, fig2
Beispiel #14
0
def init_dasboard(server):
    dash_app = dash.Dash(server=server,
                         routes_pathname_prefix='/dashapp/',
                         external_stylesheets=[dbc.themes.FLATLY])

    df = pd.DataFrame({
        'month': ['Enero', 'Febrero', 'Marzo', 'Todos'],
        'day': [[
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
            20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
        ],
                [
                    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
                    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
                ],
                [
                    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
                    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
                ], []],
        'users': [[
            325, 324, 405, 400, 424, 404, 417, 432, 419, 394, 410, 426, 413,
            419, 404, 408, 401, 377, 368, 361, 234, 356, 345, 354, 345, 345,
            378, 344, 342, 412, 453
        ],
                  [
                      432, 419, 394, 410, 426, 413, 419, 404, 408, 401, 377,
                      368, 361, 234, 356, 345, 354, 345, 345, 378, 344, 342,
                      412, 453, 324, 405, 400, 424
                  ],
                  [
                      408, 401, 377, 368, 361, 234, 356, 345, 354, 345, 345,
                      378, 344, 342, 412, 453, 324, 405, 400, 424, 432, 419,
                      394, 410, 426, 413, 419, 404, 408, 401, 377
                  ], []]
    })

    # --------- GRID --------- #

    grid = dui.Grid(_id="grid-1", num_rows=12, num_cols=12, grid_padding=0)

    # BOTÓN FILTROS
    grid.add_element(col=1,
                     row=1,
                     width=12,
                     height=1,
                     element=dbc.Button('FILTROS',
                                        id='filtros-1',
                                        style={
                                            'width': '100%',
                                            'heigth': '100%'
                                        },
                                        className='bg-primary text-white'))

    # MODAL
    grid.add_element(
        col=1,
        row=1,
        width=12,
        height=12,
        element=dbc.Modal(
            id='modal-filtros-1',
            children=[
                dbc.ModalHeader('Filtros'),
                dbc.ModalBody([
                    dbc.Label('Agrupar por'),
                    dbc.RadioItems(id='option-group',
                                   className='d-flex justify-content-around',
                                   value='mensual',
                                   options=[{
                                       'label': 'Mensual',
                                       'value': 'mensual'
                                   }, {
                                       'label': 'Diario',
                                       'value': 'diario'
                                   }]),
                    dbc.Label('Seleccionar mes'),
                    dbc.Select(
                        id='option-month',
                        className=
                        'class="col-sm-10 align-self-center custom-select"',
                        value=0,
                        options=[{
                            'label': df.month[i],
                            'value': i
                        } for i in range(len(df.month))])
                ]),
                dbc.ModalFooter(
                    dbc.Button('CERRAR',
                               id='close-filtros-1',
                               style={'width': '100%'},
                               className='bg-primary text-white'))
            ],
            is_open=False,
            style={'height': '80%'},
            className='p-3',
            size='lg',
            scrollable=True))

    # GRÁFICO 1
    grid.add_graph(col=1, row=2, width=12, height=3, graph_id='graph-1')

    # GRÁFICO 2
    grid.add_graph(col=1, row=5, width=6, height=4, graph_id='graph-2')

    # GRÁFICO 3
    grid.add_graph(col=8, row=5, width=5, height=4, graph_id='graph-3')

    # --------------------------- #

    dash_app.layout = html.Div(children=[
        html.Meta(
            name='viewport',
            content='width=device-width, initial-scale=1, shrink-to-fit=no, \
                maximum-scale=1, minimum-scale=1, user-scalable=0'),
        dui.Layout(grid=grid),
        dcc.Interval(id='interval-users', interval=1 * 5000, n_intervals=0)
    ],
                               style={
                                   'height': '100vh',
                                   'width': '100vw'
                               })

    # --------- EVENTOS --------- #

    @dash_app.callback(Output('graph-1',
                              'figure'), Output('graph-2', 'figure'),
                       Output('graph-3', 'figure'),
                       Input('option-month', 'value'),
                       Input('option-group', 'value'),
                       Input('interval-users', 'n_intervals'))
    def change_month(pos, group, n):
        update_users = randrange(20)
        month_pos = randrange(len(df.month[:-1]))
        day_pos = randrange(len(df.users[month_pos]))

        df.users[month_pos][day_pos] += update_users

        pos = int(pos)
        fig1 = go.Figure()
        fig2 = go.Figure()

        if pos == len(df.month[:-1]):
            total = 0
            for i in range(len(df.month[:-1])):
                total += int(sum(df.users[i]))

            fig1.add_trace(
                go.Indicator(mode='number',
                             value=total,
                             title={'text': 'Usuarios totales'},
                             domain={
                                 'y': [0, 1],
                                 'x': [0, 1]
                             }))

            for i in range(len(df.month[:-1])):
                fig2.add_trace(
                    go.Scatter(x=df.day[i],
                               y=df.users[i],
                               name=df.month[i][:3]))

        else:
            if group == 'mensual':
                if pos == 0:
                    fig1.add_trace(
                        go.Indicator(mode="number+delta",
                                     value=sum(df['users'][pos]),
                                     delta={
                                         'reference': 0,
                                         'valueformat': '.0f'
                                     },
                                     title={
                                         "text":
                                         "Usuarios mensuales en {}".format(
                                             df.month[pos])
                                     },
                                     align='center',
                                     domain={
                                         'y': [0, 1],
                                         'x': [0, 1]
                                     }))
                else:
                    fig1.add_trace(
                        go.Indicator(mode="number+delta",
                                     value=sum(df.users[pos]),
                                     delta={
                                         'reference': sum(df.users[pos - 1]),
                                         'valueformat': '.0f'
                                     },
                                     title={
                                         "text":
                                         "Usuarios mensuales en {}".format(
                                             df.month[pos])
                                     },
                                     align='center',
                                     domain={
                                         'y': [0, 1],
                                         'x': [0, 1]
                                     }))
            else:
                fig1.add_trace(
                    go.Indicator(mode='number+delta',
                                 value=df.users[pos][len(df.users[pos][:-1])],
                                 delta={
                                     'reference':
                                     df.users[pos][len(df.users[pos][:-2])],
                                     'valueformat':
                                     '.0f'
                                 },
                                 title={
                                     'text':
                                     'Usuarios el último día de {}'.format(
                                         df.month[pos])
                                 },
                                 align='center',
                                 domain={
                                     'y': [0, 1],
                                     'x': [0, 1]
                                 }))

            fig2.add_trace(go.Scatter(y=df.users[pos], x=df.day[pos]), )

        fig2.update_layout(plot_bgcolor='white',
                           margin={
                               'l': 0,
                               'r': 30,
                               'b': 50,
                               't': 0,
                               'pad': 0
                           },
                           legend={
                               'orientation': 'h',
                               'yanchor': 'bottom',
                               'y': 1,
                               'xanchor': 'left',
                               'x': 0
                           },
                           modebar={'orientation': 'v'})

        values_pie = []
        labels_pie = []
        for m in range(len(df.month[:-1])):
            values_pie.append(sum(df.users[m]))
            labels_pie.append(df.month[m][:3])

        fig3 = go.Figure(go.Pie(labels=labels_pie, values=values_pie))

        fig3.update_layout(margin={
            'l': 0,
            'r': 0,
            'b': 0,
            't': 0,
            'pad': 0
        },
                           legend={
                               'orientation': 'h',
                               'yanchor': 'bottom',
                               'y': 1.02,
                               'xanchor': 'left',
                               'x': 0
                           },
                           modebar={'orientation': 'v'})

        return fig1, fig2, fig3

    @dash_app.callback(
        Output("modal-filtros-1", "is_open"),
        Input("filtros-1", "n_clicks"),
        Input("close-filtros-1", "n_clicks"),
        State("modal-filtros-1", "is_open"),
    )
    def open_filtros_1(open, close, is_open):
        if open or close:
            return not is_open
        return is_open
Beispiel #15
0
        <footer>
            <script type="javascript" src="/static/my-custom-javascript-bundle.js">
            {dash_renderer_javascript_bundle}
            {dash_component_javascript_bundles}
            <script type="javascript" src="/static/my-custom-javascript-override.js">
        </footer>

    </html>
    '''


app = dash.Dash(__name__, external_scripts=external_scripts)
app.index = custom_index()

app.layout = html.Div([
    html.Meta(charSet='utf-8'),
    html.Meta(name='viewport',
              content='width=device-width, initial-scale=1, shrink-to-fit=no'),
    html.Meta(name='theme-color', content='#000000'),
    html.Div(
        [
            html.
            H2(children='ENCODE Comparison Tool',
               style={
                   'margin':
                   '0',
                   'padding-top':
                   '10px',
                   'font-family':
                   '"Open Sans", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif'
               }),
Beispiel #16
0
                className="logo"
            ), href='https://plot.ly/products/dash', className="logo-link"),

            html.Div(className="links", children=[
                html.A('pricing', className="link", href="https://plot.ly/products/on-premise"),
                html.A('user guide', className="link active", href="https://plot.ly/dash/"),
                html.A('plotly', className="link", href="https://plot.ly/")
            ])
        ]
    )
)

app.title = 'Dash User Guide and Documentation - Dash by Plotly'

app.layout = html.Div([
    html.Meta(name='viewport', content='width=device-width, initial-scale=1.0'),
    html.Meta(
        name='description',
        content=('Dash User Guide and Documentation. '
                 'Dash is a Python framework for building '
                 'reactive web apps developed by Plotly.')
    ),
    header,
    html.Div([
        html.Div([
            html.Div([
                dcc.RadioItems(options=[
                    {'label': i, 'value': i} for i in chapters.keys()
                ], value='index', id='toc', labelStyle={'fontWeight': 400})
            ], style={'display': 'none'}),
            html.Div(
Beispiel #17
0
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output

from app import app, server
import maps

app.title = "Custom Metro Map"

# we suppress callback exceptions in order to separate callbacks into their own files
app.config.suppress_callback_exceptions = True
#Render the page at the width of the device, dont scale:
#https://stackoverflow.com/questions/4472891/how-can-i-disable-zoom-on-a-mobile-web-page
app.layout = html.Div([
    html.Meta(name="viewport", content="width=device-width, initial-scale=1.0"), 
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content')
])

@app.callback(Output('page-content', 'children'),
              [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/':
        return maps.make_layout()
    elif pathname=="/maps":
        return maps.make_layout()
    else:
        return '404'

if __name__=="__main__":
    app.run_server(debug=False, host="0.0.0.0", port="8000")
Beispiel #18
0
                html.P('. Website and documentation licensed under', style={'display': 'inline-block', 'margin-right': '3px'}), 
                html.A('CC BY 4.0', href='https://creativecommons.org/licenses/by/4.0/', target='_blank', style={'display': 'inline-block'}),
            ], style={'display': 'inline-block', 'margin-top': '5px'}),
            dbc.Col(logogit, width='auto'),
        ]),
    ]),
], className='navbar footer footerbottom')

# title in tab browser
app.title = 'SailPy'

# meta data and favicon
app.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    html.Meta(name='viewport', 
        content='width=device-width, initial-scale=1.0',
        title='SailPy - Developed by Diogo Kramel in 2019'),
    html.Link(href='/assets/static/favicon.ico'),
    html.Div(id='landing-application'),
])

# pages called when moving between tabs
@app.callback(Output('page-content', 'children'), [Input('tabs-styled-with-inline', 'value')])
def display_page(tab):
    space = html.Div([html.Br(), html.Br(), html.Br(), html.Br(), html.Br()])
    if tab == 'tab-1':
        return html.Br(), introduction.introduction, space, footer
    elif tab == 'tab-2':
        return html.Br(), dimensionshull.hull, space, footer
    elif tab == 'tab-3':
        return html.Br(), optimizationhull.optimizationhull, space, footer
Beispiel #19
0
def init_layout():
    return html.Div([
        html.Meta(charSet='utf-8'),
        html.Meta(name='viewport',
                  content='width=device-width, \
                           initial-scale=1,\
                           shrink-to-fit=no'),
        html.H1(children='Restaurant Hygiene Predictions'),

        html.Div(children='''
            Enter restaurant reviews(if there are multiple reviews then seperate them with space)
        '''),
        dcc.Textarea(
            placeholder='Enter a value...',
            style={'width': '50%'},
            id= 'doc',
            value = 'I live up the street from Betty. &#160;When my sister was in town for Spring Break, we made an effort to hit several little places we had never been to before.BETTY WAS PRETTY SWEET!The service was lively. &#160;We made a reservation (via Yelp of course) and were seated right away by the window for a group of four. &#160;I love sitting by the window because I want to be seen when I\'m out. &#160;It was really a pleasant evening.Three of us had the Betty Burger, which was substantially larger than I expected. &#160;My sister had the pan roasted chicken, which was also generously portioned.For those of you who would be traveling to Queen Anne from elsewhere, FREE PARKING ON QUEEN ANNE AVE, WHOOOHOOO! :) Wow.. Came here for Happy Hour and never knew this place had a back room. I highly recommend coming here for Happy Hour. The place is classy with just enough dark ambiance to make this place sexy. The food was great! We went small place style and got the following items. Happy Hour Clams were amazing. The broth was interesting with just enough kick to it. Hour Hour Frites - Yummy fries. How can you go wrong with frieds.Happy Hour Lemon Drop - Tasty, tasty, tasty!Happy Hour Oysters - YUM!Happy Hour Wine by the glassMix GreenYes.. Betty. I heart you! I recently tried Betty for the first time and boy, am I ever a fan. The ambiance was fantastic. We were slightly surprised at how short the menu was. At first it put us off a little bit, but we both found something that sounded like it could be ok.When the food came, our choices were validated. I had the lamb ragout. It had plenty of meat, fresh peas, rich sauce and freshly made noodles. It was a huge amount of food but the flavors were so amazing that I managed to eat the entire thing.Be sure to get reservations (http://opentable.com makes it easy.) Not bad BettyWent here for dinner with friends. Don\'t be confused by the velvet curtain as you walk through the door. Weird way to keep the cold out. They can seat about 8 at most. The server was friendly. Tried the Betty burger and beer. Burger was huge and not as flavorful as I hoped. The fries were burnt and not that great. I tried my friend\'s dishes and I\'ll have to get the chicken next time. No one tried the rib eye steak and frites and I\'m curious about that one. The menu is already changing, but never let\'s me down. I\'ve been here at least 10 times and have never been served a mediocre meal --everything here is delicious.The service is exceptional and very friendly. The setting is casual, and conveniently located on Queen Anne Ave.It can be a little pricey, but certainly worth it. I wouldn\'t say that I was a fan, but this is an okay place to go. &#160;I\'d say it\'s a seven of ten more than a three of five, but I round halves down.Mom was up visiting from Alabama. &#160;I don\'t know why she ever agrees to go out with us, because it is always the same: &#160;too slow, too expensive, too salty, one dollar should be enough tip.This time she didn\'t grouse about the tip, although she\'d been skipped on the water service (as I had), but she remarked on the friendliness of the people there. &#160;Service was timely. &#160;I also ordered a to-go meal for my wife who wasn\'t with us, they timed it perfectly. &#160;On a separate check, in fact, which they had no problem doing.They got us in during Seattle Restaurant Week, which was awesome.I had the Wild Boar spaghetti (I think they had a fancier name for it, but that\'s what it was), which my brother also had. &#160;He didn\'t like it at first, but liked it at the end. &#160;I noticed no improvement, but I liked it from the get-go. &#160;Brother had a point though, he would have had no problem making any of those dishes at home, except the scrumptious desserts.The food was oversalted. &#160;The salt was pretty pervasive, and that\'s really my only knock on the joint.Takeaway: &#160;I recommend that you try it. &#160;I can see why some people have it as a favorite, it\'s just not one of mine. The only reason I wouldn\'t go back here is because your clothing always smells like bacon grease or something when you leave. &#160;It takes a few washes to get the smell out. &#160;Other than that, the wine pours are nice, the staff is great and their tapas is delish. &#160;Wear an old coat when you go there though, you\'ve been forewarned. This is my go-to restaurant for happy hour in Queen Anne! The menu is amazingly delicous, both for HH and the regular menu. The HH menu is priced really well and the five dollar wine pours are too tempting to not pass up! The frites are delicious with just the right amount of salt. They always have either clams or mussels, and both are my favorite thing to get off of the HH menu! The pulled pork mole tacos are tasty, too, and my husband always orders them when we go.Service is friendly, helpful and relaxed. They aim at letting you have a great time in the restarant, with no pressure about getting you in and out quickly, which is appreciated.Oh - and about two years ago I got a savory stinging nettle risotto that I still dream about to this day. It was THAT good. And right now I\'m waiting for the right time to go and have their halibut... oh it should be heavenly!Definitely go to Betty if you\'re around the top of QA. And by \'definitely go\', I mean, \'go all the time!\'PS: In the summertime they open up their back patio - woohoo!! Sunshine AND great food!! (Excellent time to get the prosecco and some salami + olives on a Friday evening!) The original dinner plan was Lloyd Martin, then suddenly the place was on fire. And by that I mean it included fire trucks. So, I met Peter and Ron at Betty instead. NEVER have I waited so long for a burger. The servers were incredibly good but the kitchen was as devastatingly slow as drowning in ice water in Hell. The drinks were weak and overly expensive.The food was average but sorta pretty.I rank Betty high for service only. My boyfriend and I were looking for a casual place to eat in Upper Queen Anne and have always wanted to try Betty. &#160;I was very surprised to see bottles of wine in ice buckets on customer\'s tables, but I was very pleased to see that we were in for a treat. &#160;We shared an order of Sauteed Squid and Green Olives, which was absolutely delicious as a starter. &#160;It was also pretty plentiful for an app. &#160;We both then shared a Ribeye Steak and also substituted the fries (after seeing a HEAPING load of fries on another customer\'s plate) with some mixed organic greens (yum!!). &#160;The ribeye steak was very plentiful, it would\'ve been too much for one person. &#160;It was SO GOOD. are you too lazy to marinate a chicken and pan roast it to perfection in a cast iron skillet for dinner tonight?not to worry, betty has got you covered. the meat will be succulent and well seasoned. heck, they will even through in some roasted potatoes and vegetables. who needs to order sides?i\'m afraid I won\'t order anything else here now. Found this place when our first choice in Queen Anne couldn\'t guarantee our reservation. Overall, we were quite pleased with the food and the ambience. Unlike some places nearby, you can actually have a conversation and it has a nice feel to it. &#160;The food is good,although the wine list leaves a bit to be desired.Service is OK. They are pleasant, but you get a lot of "no"\'s from them. Simple requests are greeted with a "no". &#160;We had a birthday, and while I really don\'t mind paying for my own dessert, an acknowledgement would at least be nice. &#160;Why else would you ask? This is a place that does things right. We went to Betty\'s for happy hour after walking y it so many times. All items were very reasonably priced, we tried several different things and we were pleased with all of them. The menu might be a bit too traditional if you will, but the food was cooked right. Also if you sit at the counter you can see the chefs cook your food which is a definite plus, I like to see what goes into my plate and I like it when the kitchen is kept in a proper manner and they are not afraid of showing it to the customers. Could be the nicest staff I\'ve ever encountered. &#160;And the food was excellent. &#160;I\'ll be back... Pretty good if you are looking for pub/bistro fare. But don\'t expect great things if you order a steak or anything "fancy." Delicious. Tthere are so many tempting things on their menu it\'s hard to know where to begin. &#160;The parmesan tarte is like a cloud--not quiche, not custard with the flavor of fresh parmesan, it defies words. &#160;The homemade pea soup equally fine--tasted the fresh herbs and split peas soft but still holding their shape, and not too heavily flavored with ham--perfect for this extended winter weather. &#160;Several entrees on the menu--fragrant chicken, a vegetarian tangine among others. I ordered the braised/stewed lamb shank. &#160;Betty\'s version is superb--marvelous lamb that has been slow cooked so that the meat falls off the bone served with a rich vegetable-enhanced tomato-based sauce and a bed of creamy polenta. &#160;Never had lamb that tasted as good as this. &#160;Usually declining dessert, on the fabulous $30 deal this month I indulged. Either of the homemade ice creams are sublime--one with a Guiness caramel sauce and the other, a homemade wedge of Neopolitan ice cream (the strawberry layer tasted like FRESH strawberries!) rests in a shallow pool of dark chocolate fudge sauce. &#160;And three thin dark chocolate shortbread coins hail invitingly from the top of the ice cream wedge daring you to dip them into the fudge sauce too! &#160;Strongly recommend Betty for anyone who knows the difference between ordinarily good and extraordinary! &#160;Betty is in that extra-excellent category. &#160; I found service to be wonderful--fast, warm, not intrusive and I liked the modern feel of the place. &#160;Lighting that was just right for regular meal or romance! Not pretentious, very welcoming, elegant enough to feel like you have dined well. This has become our "go-to" place for great food. &#160;It gets better every time we go. &#160;The burger is great, the chicken is great, and the cassoulet was amazing when we went. &#160;You can\'t go wrong with anything on the menu - check it out! The menu is small and simple and the atmosphere is exactly what you\'d expect in upper Queen Anne, a great date night spot. &#160;We were a little confused by the entrance which appears to be an entrance to nowhere, but once we passed through the curtain and took our seats everything was great. &#160;We both ended up with the roast chicken, partly because of an ordering gaffe on my part, but I couldn\'t have been happier. &#160;The chicken was moist and tender and had a delicious crispy skin and the portion size was perfect. &#160;Betty definitely found a spot in the regular rotation for me and the girlfriend. Never been here before or heard of the place. &#160;Went here for the $30 prix fixe menu..this was really a great neighborhood restaurant. &#160;Service was very very slow though...first course was parmesan pudding and grapefruit vinigrette...$12 and $14 respectively...very tasty, the grapefruit added a nice kick..the melted parmesan on crostini was very tasty and it had a pesto add in to round it off...entree was roast chicken and pork loin atop savoy cabbage..the pork was really good and the sauce with the cabbage was very peppery...almost too peppery but I like spicy...The roast chicken was really good too, the breast was moist. &#160;mid $20 range for both..dessert was $8 for any dessert, got the guiness ice cream with brownie bites without the shot of alcohol and the panna cotta...never had panna cotta before, it was with grapefruit....unusual gelatin consistency..not bad but not really good, the candied grapefruit rind was too intense...the ice cream was fine, just ice cream with brownies...can\'t go wrong with that... Don\'t think you can go wrong with Betty. Unpretentious, good food and service. Happy hour is especially nice, impressed with their wine by the glass selections and generous pours! Very comfortable, from making reservations the day of for a business dinner , to greeting us, to the ease of the menu. &#160; the Queen Anne area is a very busy place and parking is crazy. I had the duck confit with a lamb sausage, swiss chard. &#160;good comfort food for a california person eating in the "cold (not yet) NorthWest.'

        ),
        html.Div(children='''
            Enter average ratings
        '''),
        dcc.Input(
            placeholder='Enter a average rating...',
            type='number',
            id = 'average_ratings',
            value='4'
        ) ,
        html.Div(children='''
            Enter total reviews
        '''),
        dcc.Input(
            placeholder='Enter total reviews...',
            type='number',
            id = 'total_reviews',
            value='10'
        ) ,
        # html.Div(children='''
        #     Enter zipcode
        # '''),
        # dcc.Input(
        #     placeholder='Enter a zipcode...',
        #     type='number',
        #     id = 'zipcode',
        #     value='07003'
        # ) ,
        html.Div(children='''
            Choose restuarant cuisine
        '''),
        #replace this is dynamic callback that reads classes from MultiLabelBinarizer
        dcc.Dropdown(
            options=[
                {'label': i, 'value': i} for i in ['Afghan', 'African', 'American (New)', 'American (Traditional)',
               'Asian Fusion', 'Australian', 'Barbeque', 'Basque', 'Belgian',
               'Brazilian', 'Breakfast & Brunch', 'British', 'Buffets', 'Burgers',
               'Cafes', 'Cajun/Creole', 'Cambodian', 'Cantonese', 'Caribbean',
               'Cheesesteaks', 'Chicken Wings', 'Chinese', 'Colombian',
               'Comfort Food', 'Creperies', 'Cuban', 'Delis', 'Dim Sum', 'Diners',
               'Egyptian', 'Ethiopian', 'Fast Food', 'Filipino', 'Fish & Chips',
               'Fondue', 'Food Court', 'Food Stands', 'French', 'Gastropubs',
               'German', 'Gluten-Free', 'Greek', 'Haitian', 'Halal', 'Hawaiian',
               'Himalayan/Nepalese', 'Hot Dogs', 'Hot Pot', 'Indian',
               'Indonesian', 'Irish', 'Italian', 'Japanese', 'Korean', 'Kosher',
               'Laotian', 'Latin American', 'Lebanese', 'Live/Raw Food',
               'Malaysian', 'Mediterranean', 'Mexican', 'Middle Eastern',
               'Modern European', 'Mongolian', 'Moroccan', 'Pakistani',
               'Persian/Iranian', 'Pizza', 'Polish', 'Puerto Rican',
               'Restaurants', 'Russian', 'Salad', 'Salvadoran', 'Sandwiches',
               'Scandinavian', 'Scottish', 'Seafood', 'Senegalese',
               'Shanghainese', 'Soul Food', 'Soup', 'Southern', 'Spanish',
               'Steakhouses', 'Sushi Bars', 'Szechuan', 'Taiwanese', 'Tapas Bars',
               'Tapas/Small Plates', 'Tex-Mex', 'Thai', 'Trinidadian', 'Turkish',
               'Vegan', 'Vegetarian', 'Venezuelan', 'Vietnamese']
            ],
            style={'width': '70%'},
            multi=True,
            id = "cuisine",
            value=["Delis"]
        ),
        html.Button(id='submit-button', n_clicks=0, children='Submit'),
        html.Div(id='output-state')



    ])
                dbc.NavItem(dbc.NavLink('')),
                dbc.NavItem(dbc.NavLink('')),
                dbc.NavItem(dbc.NavLink('')),
                dbc.NavItem(dbc.NavLink('')),
                dbc.NavItem(dbc.NavLink('')),
                dbc.NavItem(dbc.NavLink('')),
                dbc.NavItem(html.A(html.Img(src="/static/TNP.png", width="60", height="28", alt=""), 
                                        href="https://www.tnpconsultants.com", target="_blank"))
            ], pills=True, justified=True, navbar=True)
        ],
        brand="Social Media Analytics",
        color='#D0E49F',
        sticky="top")

app.layout = html.Div([
    html.Meta(name="viewport", content="width=device-width, initial-scale=1, shrink-to-fit=no"),
    dcc.Location(id='url', pathname=None, refresh=False),
    navbar,
    html.Div(id='body')
])

@app.callback(Output('body', 'children'),
              [Input('url', 'pathname')])
def display_page(pathname):
    print(pathname)
    if pathname is None or pathname == '/':
        return overview.body
    if pathname.rstrip('/') == '/competitors':
        return competitors.body
    elif pathname.rstrip('/') == '/recommendations':
        return recommendations.body
Beispiel #21
0
            # 0.35は加速度によるカメラ位置変更を認める閾値
            if x_accel > 0.35:
                camX = camX + x_accel
            if x_accel > 0.35:
                camY = camY + y_accel
            if x_accel > 0.35:
                camY = camY + z_accel

    return [camX, camY, camZ]


'''
ページの描写関連
'''
app.title = 'Nagasaka Lab'
app.layout = html.Div([html.Meta(
    content='width=device-width, initial-scale=1.0'),
    html.Div([
        html.Div('センサ値',
                 style={'color': 'red',
                        'fontsize': 16,
                        'font-weight': 'bold'}),
        html.Div(id='live-update-text'),
        html.Div(
            '3Dモデル切り替え',
            style={'color': 'blue',
                   'fontsize': 16,
                   'font-weight': 'bold'}
        ),
        dcc.RadioItems(
            id='type-dropdown',
            options=[{'label': k, 'value': k}