コード例 #1
0
ファイル: app.py プロジェクト: sverchkov/emma
    dcc.Store(id='selected-concept'),

    html.H1(children='Explore MetaMap Annotations (EMMA)'),

    html.Div(children=['Database last updated March 12, 2019'], className='small-note'),

    html.Div(
        children=[
            html.H2(children='Background Query'),
            dcc.Dropdown(
                id='bg-query-selection',
                options=backend.bg_query_options_dict,
                value='0'
            ),
            html.P(children=['PubMed query string:']),
            html.Div(id='bg-query-details', className='verbatim-box'),
            html.H2(children='Foreground Query'),
            dcc.Dropdown(
                id='fg-query-selection',
                options=backend.fg_query_options_dict,
                value='1'
            ),
            html.P(children=['PubMed query string:']),
            html.Div(id='fg-query-details', className='verbatim-box'),
            html.H2('UMLS Concept'),
            html.P(id='selection-info'),
            dcc.Loading(
                children=[dash_table.DataTable(
                    id='table',
                    columns=[{'name': 'Concept', 'id': 'concept', 'type': 'text'},
コード例 #2
0
ファイル: app.py プロジェクト: loganbrand/bypassportal
                    className='columns',
                    style={
                        'margin-bottom': '10',
                        'margin-left': '0',
                        'width': '50%',
                        'float': 'left'
                    }),

                #######~~~~~~~~Specify Socio-demographic Indicators~~~~~~~~~########
                html.Div(
                    [
                        html.H5('Specify Socio-demographic Indicators'),

                        #~~~~---Select number of years electrified---~~~~
                        html.Div([
                            html.P('Select number of years electrified'),
                            html.Div([
                                dcc.RangeSlider(
                                    id='input-electrified',
                                    marks=list(range(0, 15, 1)) + ['+15'],
                                    min=0,
                                    max=15,
                                    included=True,
                                    value=[0, 15],
                                    updatemode='drag')
                            ],
                                     style={
                                         'margin-bottom': '50',
                                         'margin-left': '20'
                                     })
                        ],
                        "color": "white"
                    }
            else:
                return {
                    "height": "120px",
                    "width": "100%",
                    "border-color": "blanchedalmond",
                    "color": "white"
                }

    return component


genreSelectionLayout = html.Div([
    html.H3('Select Your five favourite genres', style={"padding": "20px"}),
    html.P('Please press F5 or refresh the page if you cannot select genre',
           style={"padding-left": "20px"}),
    html.Div([
        html.Div([GenerateDynamicGenres()]),
        html.Br(),
        dcc.Link("Next",
                 href='/Movies',
                 className="button u-pull-right",
                 id="btnNext",
                 style={"display": "none"})
    ],
             style={
                 "background-color": "#4ABDAC",
                 "height": "85vh"
             })
])
コード例 #4
0
                 )
             ],
             className="one-third column",
             id="button",
         ),
     ],
     id="header",
     className="row flex-display",
     style={"margin-bottom": "25px"},
 ),
 html.Div(
     [
         html.Div(
             [
                 html.P(
                     "Filter by construction date (or select range in histogram):",
                     className="control_label",
                 ),
                 dcc.RangeSlider(
                     id="year_slider",
                     min=1960,
                     max=2017,
                     value=[1990, 2010],
                     className="dcc_control",
                 ),
                 html.P("Filter by well status:",
                        className="control_label"),
                 dcc.RadioItems(
                     id="well_status_selector",
                     options=[
                         {
                             "label": "All ",
コード例 #5
0
ファイル: app_clv.py プロジェクト: Arlaf/deligreens_clv
def maj_P_details_methode2(start_date, end_date):
    # Correction du typage des inputs
    start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d').date()
    end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d').date()
    return html.P(f'''Tous les clients ayant passé leur première commande entre le {start_date.strftime('%d/%m/%y')} et le {end_date.strftime('%d/%m/%y')} ont été inclus dans cette méthode.''')
コード例 #6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 22 04:45:31 2019

@author: heba
"""

import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

from app import app

layout = html.Div([
    html.H2('Citation'),
    html.P([
        'If you have used data available through KDML-db.org in your work, please cite the following publication:'
    ]),
    html.P([
        'KDML: a machine-learning framework for inference of multi-scale gene functions from genetic perturbation screens'
    ]),
    html.P('Heba Sailem, Jens Rittscher, and Lucas Pelkmans'),
    html.P(['bioRxiv 761106, doi: https://doi.org/10.1101/761106']),
])


@app.callback(Output('citation', 'children'), [Input('citationn', 'value')])
def display_value(value):
    return 'You have selected "{}"'.format(value)
コード例 #7
0
ファイル: app.py プロジェクト: rajat-1994/DIF
from utils import read_files, new_df, save_df

external_stylesheets = [
    'https://codepen.io/chriddyp/pen/bWLwgP.css', dbc.themes.DARKLY]

SESSION_ID = 0

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.title = "DIF"

card1 = dbc.Card(
    [
        dbc.CardImg(id='img1', top=True),
        dbc.CardBody([
            dbc.Row(html.P(id='filename-1'),
                    justify="center"),
            dbc.Button('DELETE',
                       color="danger",
                       size='lg',
                       id="button1",
                       n_clicks=0,)
        ]),
    ],
    style={"width": "auto"},
)

card2 = dbc.Card(
    [
        dbc.CardImg(id='img2', top=True),
        dbc.CardBody([
コード例 #8
0
     id="header",
     className="row flex-display",
     style={"margin-bottom": "25px"},
 ),
 html.Div(
     [
         html.Div(
             [
                 #Esta seccion contiene todo lo que se muestra en la pestaña "Datos Sensores" del menu de opciones
                 dcc.Tabs([
                     dcc.Tab(
                         label='Datos Sensores',
                         children=[
                             html.P("Seleccione Tipo de Sensor",
                                    className="control_label",
                                    style={
                                        'textAlign': 'center',
                                        'font-size': '20px'
                                    }),
                             html.Div([
                                 dcc.Loading(
                                     id="carga-elegir-tipo-sen",
                                     children=[
                                         dcc.Dropdown(
                                             id="elegir-tipo-sensor",
                                             multi=False,
                                             options=[{
                                                 "label": key,
                                                 "value": value
                                             } for key, value in datos.
                                                      tipos_sensores(
                                                      ).items()],
コード例 #9
0
    return fig, fig2





footer_section=dbc.Container([
    dbc.Row([
        dbc.Col([
            html.H4('Data Source', className='mb-4', id='about'),
            html.Span("The data is primarily sourced from "),
            html.Span('Johns Hopkins CSSE',style={'fontWeight':'700','fontFamily':'campaign,sans-serif'}),
            html.Span(' repository: '),
            html.A('2019 nCoV data',href='https://github.com/CSSEGISandData/COVID-19',
                   target='_blank'),
            html.P(" "),
            html.Span("Where possible, the data has been cross-checked and manually corrected looking at various Wikipedia pages: "),
            html.A('Italy Example Page',href='https://en.wikipedia.org/wiki/2020_coronavirus_pandemic_in_Italy',
                   target='_blank'),
            html.P(' '),
            html.Span('Worth noting is the current number of recovered cases for the US & Canada not being allocated to each state / province.'),
            html.P(' '),
            html.Span('The population data is based on the United Nations Population 2020 estimates: '),
            html.A('UN download page', href='https://population.un.org/wpp/Download/Standard/Population/',
                   target='_blank'),
            html.P(' '),
            html.Span('Latest data extract as of: '),
            html.Span(str(end_date.strftime('%d %b %Y')),style={'fontWeight':'700','fontFamily':'campaign,sans-serif'}),
            html.Div([
            html.A([
                html.Img(src=app.get_asset_url("linkedin logo.png"),className='position-relative',
コード例 #10
0
            html.Ol([
                html.
                Li("Start from first developing the 6 plots in Jupyter Notebook,"
                   ),
                html.Li("Once plots are ready post them into the Dash app,"),
                html.Li("Add HTML components (website heading etc.),"),
                html.Li("Structure the layout of the dashboard.")
            ],
                    style={
                        "padding-left": "20",
                    })
        ],
                 className="four columns"),
        html.Div([
            html.P("Graph 1", style={
                "font-weight": "bold",
            }),
            html.
            P("The graph on the right hand side is showing correlations of different variables (call them from x1 to x8) with employee churn. Data is artificial, manually inputted by the developer. Recreate the graph. Small coloring or corelation value differences will be neglected."
              ),
        ],
                 className="three columns"),
        html.Div([dcc.Graph(id="Graph1", figure=figure1)],
                 className="five columns")
    ],
             className="row"),

    #Part2
    html.Div([
        html.Div([
            html.P("Graph 2", style={
コード例 #11
0
def get_device_tab_layout(mac_addresses):
    device_tab_layout = html.Div(
        className='row',
        children=[
            html.Div(children=[
                html.Div(children=[
                    html.P("Device"),
                    generate_mac_address_dropdown('dropdown-device',
                                                  mac_addresses)
                ],
                         className='two columns'),
                html.Div(children=[
                    html.P("EcoNet Object", ),
                    generate_control_dropdown(),
                ],
                         className='two columns'),
                html.Div(children=[
                    html.P("Date Range"),
                    dcc.DatePickerRange(
                        min_date_allowed=datetime.today() - timedelta(days=42),
                        max_date_allowed=datetime.today() + timedelta(days=1),
                        start_date=datetime.today() - timedelta(days=42),
                        end_date=datetime.today() + timedelta(days=1),
                        updatemode='bothdates',
                        id='datepicker-range')
                ],
                         className="five columns")
            ],
                     className="row"),
            html.Div(
                className='row',
                children=[
                    html.Div(children=[
                        html.Div(
                            dcc.Loading(
                                dcc.Graph(
                                    id="econet-controls-graph",
                                    config={
                                        "displaylogo":
                                        False,
                                        "modeBarButtonsToRemove":
                                        ['toImage', 'zoomIn2d', 'zoomOut2d']
                                    })),
                            className="four columns",
                        ),
                        dcc.Graph(id='horizontal-boxplot',
                                  className="one column",
                                  config={
                                      "displaylogo": False,
                                      "displayModeBar": False
                                  }),
                        html.Div(dcc.Loading(
                            dcc.Graph(id='counter-plot',
                                      config={
                                          "displaylogo": False,
                                          "displayModeBar": False
                                      })),
                                 className='two columns')
                    ],
                             className="row"),
                    html.Div(children=[
                        html.Div(dcc.Loading(
                            dcc.Graph(id='multiplot',
                                      config={
                                          "displaylogo":
                                          False,
                                          "modeBarButtonsToRemove":
                                          ['toImage', 'zoomIn2d', 'zoomOut2d']
                                      })),
                                 className='seven columns'),
                    ],
                             className="row")
                ])
        ])
    return device_tab_layout
コード例 #12
0
gdf2 = gpd.read_file('data/pov_emissionsFresno_0.shp')

markdown_text = '.'

app.layout = html.Div(
    className="everything",
    style={'backgroundColor': colors['background']},
    children=[
        html.H1(children='Reduction of Pollutant Health Damages in California',
                style={
                    'textAlign': 'center',
                    'color': colors['gray']
                }),
        html.P(children='By FLORIN LANGER | Reporting from Berkeley, Calif.',
               style={
                   'textAlign': 'center',
                   'color': colors['gray']
               }),
        html.Div(
            className="article",
            children=[
                html.Div(
                    className="row",
                    children=[
                        html.Div(
                            className="six columns",
                            children=[
                                html.Div(children=[
                                    html.
                                    H4(children=
                                       'Poverty Percentile to PM2.5 Emissions Scatter Plot over Blockgroups',
コード例 #13
0
    [

        # title
        html.Div([
            html.H1('Intra-EU Trade'),
            html.
            P('A little project for practicing Plotly Dash (work-in-progress)'
              ),
        ],
                 style={'textAlign': 'center'}),

        # filter
        html.Div([
            html.Div(
                [
                    html.P('Select Reporting Country'),
                    dcc.Dropdown(id='reporter-selector',
                                 options=reporter_options,
                                 value='Austria')
                ],
                style={
                    'width': '15%',
                    'display': 'inline-block',
                    'margin': 10,
                    'paddingRight': 50
                }),
            html.Div([
                html.P('Select Year'),
                dcc.RangeSlider(id='year-selector',
                                min=min(year_options.keys()),
                                max=max(year_options.keys()),
コード例 #14
0
ファイル: app.py プロジェクト: json724/dash_ICFES
            ],
            id="header",
            className="row flex-display",
            style={"margin-bottom": "25px"},
        ),
        html.Div(
            [
                 
                html.Div(
                    [
                        html.H5(
                            "Filters:",
                            className="control_label",
                        ),
                        html.P(
                            "Date:",
                            className="control_label",
                        ),
                        dcc.RangeSlider(
                            id="year_slider",
                            min=2000,
                            max=2018,
                            value=[2005, 2007],
                            marks = y_marks,
                            className="dcc_control",
                        ),

                        html.Br(),
                        html.Br(),
                        

                        html.P("Geographic:", className="control_label"),
コード例 #15
0
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output, State

fade = html.Div([
    dbc.Button("Toggle fade", id="fade-button", className="mb-3"),
    dbc.Fade(
        dbc.Card(
            dbc.CardBody(
                html.P("This content fades in and out",
                       className="card-text"))),
        id="fade",
        is_in=True,
        appear=False,
    ),
])


@app.callback(
    Output("fade", "is_in"),
    [Input("fade-button", "n_clicks")],
    [State("fade", "is_in")],
)
def toggle_fade(n, is_in):
    if not n:
        # Button has never been clicked
        return True
    return not is_in
コード例 #16
0
ファイル: MA-0000.py プロジェクト: ailever/openapi
]
page_layouts['page'] = dbc.Tabs([
    dbc.Tab(dbc.Card(dbc.CardBody(contents['page']['tab'])),
            label="PAGE1",
            disabled=False)
])
main = html.Div([
    html.H2(html.A('ARIMA', href="/")),
    html.H6('Promulgate values for a better tomorrow'),
    html.Div([
        dbc.Button("Ailever",
                   color="secondary",
                   href='https://github.com/ailever/ailever/wiki'),
        dbc.Button("Rstudio",
                   color="secondary",
                   href=config['R-server'] + ':' + config['R-port']),
        dbc.Button("Real-Time Analysis",
                   id='real-time',
                   color="secondary",
                   href=config['visdom-server'] + ':' + config['visdom-port'])
    ]),
    html.P(id='visdom-server'),
    html.Br()
])
app.layout = html.Div([main, page_layouts['page']])
if __name__ == '__main__':
    app.run_server(host=config['dash-server'],
                   port=config['dash-port'],
                   debug=True)
################################## DASHBOARD ##################################
コード例 #17
0
                                                                    stylesheet=my_stylesheet,
                                                                    elements=nodes + edges,
                                                                    style={
                                                                            'width': '400px', 'height': '400px',
                                                                            'margin-left': "auto",
                                                                            'margin-right': "auto",
                                                                            'zoomingEnabled': "False",
                                                                            'userZoomingEnabled': "False",
                                                                            'panningEnabled': "False",
                                                                            'userPanningEnabled': "False",
                                                                            'fit': "True",
                                                                            'border': 'line'
                                                                    }
                                                            ),

                                                             html.P(id='cytoscape-tapNodeData-output'),
                                                             html.P(id='output-container-button'),
                                                             html.Div(html.Button('Clear', id='clear_button'),
                                                                              style={
                                                                                  'position': 'relative',
                                                                                  'margin-left': "auto",
                                                                                  "margin-right": "auto",
                                                                                  'margin-top': "auto",
                                                                                  "text-align": "center"
                                                                              }
                                                                      )


                                                    ], style={
                                                                'position': 'relative',
                                                                'margin-left': "auto",
コード例 #18
0
                    'padding-top': 0,
                    'padding-right': 0
                },
            ),
            html.Div(children='''
                        Each Community Mobility Report dataset is presented by location and highlights the percent change in
visits to places like grocery stores and parks within a geographic area.

                        ''',
                     className='nine columns')
        ],
                 className="row"),
        html.Div([
            html.Div(
                [
                    html.P('Choose Country:'),
                    dcc.Dropdown(id='CountryRegion',
                                 options=[{
                                     'label': i,
                                     'value': i
                                 } for i in country_region],
                                 value='United States'),
                ],
                style={
                    'margin-top': '10',
                    'width': '24%',
                    'display': 'inline-block'
                },
                className="three columns",
            ),
            html.Div(
コード例 #19
0
ファイル: index.py プロジェクト: Jordan-Ireland/Unit2-Sprint4
    if (i == 6):
        list_col1_inputs.append(html.H2("Enter Enemy Usernames"))
    temp = html.Div(className="container",
                    children=[
                        dcc.Input(id='username-' + str(i),
                                  className='userinput',
                                  placeholder='Enter Username',
                                  type='text',
                                  value='')
                    ])

    list_col1_inputs.append(temp)

list_col1_inputs.extend(
    [html.Button('Submit', id='submit'),
     html.P(id='username_out')])

column1 = dbc.Col(
    list_col1_inputs,
    md=5,
)

list_col2_inputs = [html.H2('Select Teammates')]

for i in range(amount):
    if (i == 6):
        list_col2_inputs.append(html.H2("Select Enemies"))
    list_col2_inputs.append(html.Div(id='listofusernames' + str(i)))
list_col2_inputs.append(html.Button("Complete", id='complete'))

column2 = dbc.Col(list_col2_inputs)
コード例 #20
0
import dash_table
import dash_html_components as html
import dash_core_components as dcc

import plotly.graph_objs as go
import pandas as pd

tracks = pd.read_csv('./data/top_by_year_unmodified.csv')
features = pd.read_csv('./data/audio_feature.csv')
data = tracks.merge(features, on=['id', 'year', 'rank'], how='left')
years = data['year'].unique()
table_header = ['Rank', 'Artists', 'Song']

layout = [
    html.Div([
        html.Div([html.P('Audio Features by Song')],
                 style={
                     'text-align': 'center',
                     'font-size': 20
                 }),
        html.Div([
            html.Label('Year: '),
            dcc.Dropdown(id='year-features',
                         options=[{
                             'label': i,
                             'value': i
                         } for i in years],
                         value=years[0])
        ],
                 style={
                     'width': '30%',
コード例 #21
0
ファイル: statepop.py プロジェクト: TomBatroney/statepop
######

app = dash.Dash(__name__,
                external_stylesheets=[dbc.themes.BOOTSTRAP],
                meta_tags=[{
                    'name': 'viewport',
                    'content': 'width=device-width, initial-scale=1.0'
                }])
# App layout
app.layout = dbc.Container([
    dbc.Row(dbc.Col(html.Br(), width=12), ),
    dbc.Row([
        dbc.Col(html.H1("US State Population Dashboard",
                        className='text center text-primary mb-4'),
                width=9),
        dbc.Col(html.P("Created by Tom Batroney Twitter: @TomBatroney",
                       className='text right text-primary mb-4'),
                width=3)
    ]),
    dbc.Row(dbc.Col(html.Br(), width=12), ),
    dbc.Row(
        dbc.Col(dcc.Slider(id="slct_year",
                           min=1564,
                           max=2019,
                           step=1,
                           value=1564),
                width=12), ),
    dbc.Row(dbc.Col(id='output_container', children=[], width=12), ),
    dbc.Row(dbc.Col(html.Br(), width=12), ),
    dbc.Row(dbc.Col(dcc.Graph(
        id='my_pop_map',
        figure={},
コード例 #22
0
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

server = app.server

boroughs = trees_summary['boroname'].unique()
species = trees_summary['spc_common'].unique()
stewards = trees_summary['steward'].unique()

app.layout = html.Div([
    html.H1(children='NYC Street Tree Health'),
    html.
    P('These graphics display the overall health of trees along city streets in NYC.'
      ),
    html.H2(children='NYC Street Tree Health Proportion By Borough & Species'),
    html.P('Please select a Borough and a Species: '),
    html.Div([
        dcc.Dropdown(id='boro-selector',
                     options=[{
                         'label': i,
                         'value': i
                     } for i in boroughs],
                     value='Bronx'),
        dcc.Dropdown(id='species-selector',
                     options=[{
                         'label': i,
                         'value': i
                     } for i in species],
                     value='American beech')
    ],
             style={
コード例 #23
0
ファイル: app_clv.py プロジェクト: Arlaf/deligreens_clv
def maj_P_details_methode1(start_date):
    # Correction du typage des inputs
    start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d').date()
    return html.P(f'''Tous les clients ayant passé au moins une commandes après le {start_date.strftime('%d/%m/%y')} ont été inclus dans cette méthode.''')
コード例 #24
0
ファイル: gender.py プロジェクト: tascha/DA2I-Dashboards
          A(rel="license",
            href=
            "http://creativecommons.org/licenses/by-nc/4.0/",
            children=[
                html.Img(
                    alt="Creative Commons License",
                    src=
                    "https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg"
                )
            ]),
          html.P(children=[
              html.Span(
                  children="This work is licensed under a "),
              html.
              A(rel="license",
                href=
                "http://creativecommons.org/licenses/by-nc/4.0/",
                children=
                "Creative Commons Attribution-NonCommercial 4.0 International License"
                )
          ]),
          html.P(children=[
              html.Br(),
              html.Span(
                  children=
                  "Dashboard development and support by  "),
              html.A(rel="license",
                     href="https://danielrekshan.com",
                     children="Daniel Rekshan")
          ])))
 ]),
コード例 #25
0
def main():
    start_time = datetime.now()
    assets_dir = write_css()
    print('write css duration: {}'.format(datetime.now() - start_time))

    start_time = datetime.now()
    activity_metric = GC.activityMetrics()
    act = GC.activity()
    activity = pd.DataFrame(act, index=act['seconds'])
    intervals = pd.DataFrame(GC.activityIntervals())

    # all pmc data
    pmc_dict = GC.seasonPmc(all=True, metric="BikeStress")
    pmc = pd.DataFrame(pmc_dict)

    zone = GC.athleteZones(date=activity_metric["date"], sport="bike")
    zones_low = zone['zoneslow'][0]
    zone_colors = zone['zonescolor'][0]
    cp = zone['cp'][0]

    season_peaks = pd.DataFrame(GC.seasonMetrics(all=True, filter='Data contains "P"'))
    print('Gathering data duration: {}'.format(datetime.now() - start_time))

    # Possible to override colors
    # zone_colors = ["rgb(127, 127, 127)",
    #                "rgb(255, 85, 255)",
    #                "rgb(51, 140, 255)",
    #                "rgb(89, 191, 89)",
    #                "rgb(255, 204, 63)",
    #                "rgb(255, 102, 57)",
    #                "rgb(255, 51, 12)"]

    interval_type_options = []
    for interval_type in intervals.type.unique().tolist():
        interval_type_options.append({"label": interval_type, "value": interval_type})

    app = dash.Dash(assets_folder=assets_dir)
    # cache = Cache(app.server, config={
    # 'CACHE_TYPE': 'simple'
    # })
    # cache.clear()

    app.layout = html.Div([
        html.Div([
            get_title_html(activity_metric),
            html.Div([
                html.P("Medals Power"),
                html.P(get_medals_html(activity, activity_metric, season_peaks, HR=False)),
            ], className="medals_power"),
            html.Div([
                html.P("Medals Heart Rate"),
                html.P(get_medals_html(activity, activity_metric, season_peaks, HR=True)),
            ], className="medals_hr")
        ], className='top'),
        html.Div([
            html.Div(["Select which intervals to show on the map: ",
                      dcc.Dropdown(id="interval-type", value=(
                          "USER" if "USER" in intervals.type.unique().tolist() else intervals.type.unique().tolist()[
                              0]),
                                   options=interval_type_options, style={'width': '200px'})],
                     className="row",
                     style={"display": "block", "margin-left": "0px"}),
            html.P(dcc.Graph(id="map-graph")),
        ], className="map"),
        html.Div([
            html.Div([
                html.P(dcc.Graph(figure=tiz_fig(activity, activity_metric, zone, metric_type="L"))),
            ], className="tiz_power"),
            html.Div([
                html.P(dcc.Graph(figure=tiz_fig(activity, activity_metric, zone, metric_type="H"))),
            ], className="tiz_hr"),
        ], className="tiz"),
        html.Div([html.P(dcc.Graph(figure=tsb_if_fig(activity, activity_metric, pmc)))], className="tsb_if"),
        html.Div([
            dcc.Tabs(id="tabs-example", value='structured', children=[
                dcc.Tab(label='Structured', value="structured", children=[
                    html.Div([
                        "Choose Interval Type for structured overview: ",
                        dcc.Dropdown(id="interval-type-ride-plot", value=(
                            "USER" if "USER" in intervals.type.unique().tolist() else
                            intervals.type.unique().tolist()[0]),
                                     options=interval_type_options, style={'width': '200px'})],
                        className="row",
                        style={"display": "block", "margin-left": "0px"}),
                    html.P(dcc.Graph(id="ride-plot-graph-structured")),
                ]),
                dcc.Tab(label='Smooth', value='smooth', children=[
                    html.Div([
                        "Choose smoothness value (lower value needs longer loading time): ",
                        dcc.Slider(
                            id='smooth-value-ride-plot',
                            min=5,
                            max=200,
                            step=5,
                            value=20,
                        )
                    ], className="row",
                        style={"display": "block", "margin-left": "0px", "width": "500px"}),
                    html.P(dcc.Graph(id="ride-plot-graph-smooth")),
                ]),
            ]),
            # html.Div([
            #     "Structured or Smooth: ",
            #     dcc.Dropdown(id="view-type", value="Structured",
            #                  options=[{"label": "Structured", "value": "Structured"},
            #                           {"label": "Smooth", "value": "Smooth"}],
            #                  style={'width': '200px'})],
            #     className="row",
            #     style={"display": "block", "margin-left": "0px"}),
            # html.P(dcc.Graph(id="ride-plot-graph")),
        ], className="ride_plot"),
    ], className='container')

    @app.callback(
        Output('map-graph', 'figure'),
        [Input('interval-type', 'value')])
    def update_map_figure(value_type):
        return geo_plot_fig(activity, intervals, value_type)

    @app.callback(
        Output('ride-plot-graph-structured', 'figure'),
        [Input('interval-type-ride-plot', 'value')])
    def update_structured_ride_plot(selected_interval_type):
        before = datetime.now()
        if 'power' in activity and 'latitude' in activity:
            fig = ride_plot_structured_fig(activity, intervals, zone_colors, zones_low, cp, selected_interval_type)
        else:
            fig = go.Figure()
            fig.update_layout(title="Unable to draw activities ride plot (no power data)")
            fig.update_layout(empty_chart_dict)
        print('Create ride plot duration: {}'.format(datetime.now() - before))
        return fig

    @app.callback(
        Output('ride-plot-graph-smooth', 'figure'),
        [Input('smooth-value-ride-plot', 'value')])
    def update_smooth_ride_plot(smooth_value):
        before = datetime.now()
        if 'power' in activity and 'latitude' in activity:
            fig = ride_plot_smooth(activity, zone_colors, zones_low, smooth_value=int(smooth_value))
        else:
            fig = go.Figure()
            fig.update_layout(title="Unable to draw activities ride plot (no power data)")
            fig.update_layout(empty_chart_dict)
        print('Create ride plot duration: {}'.format(datetime.now() - before))
        return fig

    return app
コード例 #26
0
    ],
    className="cover")

# App Layout

app.layout = html.Div([
    get_navbar(), jumbotron,
    html.Div([
        dbc.Row(dbc.Col(tabs, width=12)),
    ],
             id="mainContainer",
             style={
                 "display": "flex",
                 "flex-direction": "column"
             }),
    html.P("Developed by Badisa Mosesane", className="footer")
], )

# Callbacks


@app.callback(
    Output("categorical_bar_graph", "figure"),
    [
        Input("categorical_dropdown", "value"),
    ],
)
def bar_categorical(feature):

    time.sleep(0.2)
コード例 #27
0
     html.
     P("La incidencia acumulada (IA) se define como la proporción de individuos sanos que desarrollan la enfermedad a lo largo de un periodo determinado. La incidencia acumulada proporciona una estimación de la probabilidad o el riesgo de que un individuo libre de una determinada enfermedad la desarrolle durante un período especificado de tiempo."
       ),
 ]),
 dbc.FormGroup([
     dbc.Label("Elige municipio o zona básica de salud:"),
     dcc.Dropdown(
         id="in-municipio",
         options=opciones_municipios,
         value=["Fuenlabrada", "Getafe", "Alcobendas"],
         multi=True,
     ),
 ]),
 dbc.FormGroup([
     html.Br(),
     html.P("Desarrollado por:"),
     html.A(
         "@DavidTweid",
         href="https://www.twitter.com/DavidTweid",
         target="_blank",
     ),
     html.Br(),
     html.A(
         "Github",
         href="https://github.com/DavidTorresP5/covid19madrid",
         target="_blank",
     ),
     html.Br(),
     html.A(
         "Datos Abiertos CAM",
         href=
コード例 #28
0
# Type_options = [{'label':'Type1','value':0},{'label':'Type2','value':1}]
# ----------------------------------------------------------------------------------------------------------

app = dash.Dash()
server = app.server

# auth = dash_auth.BasicAuth(app,password)

# style={'margin-top':'100px'}
app.layout = html.Div([
    html.Div([html.H1('Chulalongkorn Central Library')], style={'margin-bottom': '30px', 'textAlign': 'center','backgroundColor':background}),
    html.Div([
        dcc.Tabs([
            dcc.Tab(label='Overview Data', children=[
                html.Div([
                    html.P(),
                    html.Div([
                        html.Div(
                            [dcc.Dropdown(id='type-picker2', options=Type_options, value=Type_options[0]['value'])],
                            style={'width': '50%', 'margin-left': '350px','backgroundColor':background}),
                        html.Div([dcc.Graph(id='useronly_Pie')])
                    ], style={'width': '40%', 'display': 'inline-block'}),
                    html.Div([dcc.Graph(id='books-bar',
                                        figure={'data': [
                                            go.Bar(x=n_book_cate['Book Category'], y=n_book_cate['Number of Books'],
                                                   textposition='auto',marker_color=color[0])],
                                                'layout': go.Layout(title='Total Number of Books by Category',
                                                                    xaxis={'title': 'Book Category'},
                                                                    yaxis={'title': 'Number of Books'},
                                                                    height=500,plot_bgcolor=background,paper_bgcolor=background)}
                                        )], style={'width': '55%', 'display': 'inline-block', 'margin-left': '30px'}),
コード例 #29
0
def DynamicRecommendedMovies(dfRecoMovies, lstDirectorMovies=None):
    lstContent = list()
    count = 0
    for index, movie in dfRecoMovies.iterrows():
        lstContent.append(
            html.Div([
                html.Div([movie.movieId],
                         id="hdmid-{}".format(count),
                         style={"display": "none"}),
                html.Div([
                    html.P(movie.title, style={"color": "#3bace1"}),
                    html.P("Genre: " + movie.genres),
                    html.P("Average user rating: " +
                           str(round(movie.mean_ratings, 2)))
                ],
                         className="movietgr"),
                dcc.Slider(
                    min=0,
                    max=5,
                    step=0.5,
                    marks={
                        i: '{}'.format(i)
                        for i in [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
                    },
                    value=0,
                    id='sl-{}'.format(count))
            ],
                     className="moviethumbn"))
        count += 1

    if (dfRecoMovies.size is None or dfRecoMovies.size <= 0):

        @app.callback(
            Output('intermUserID', 'children'),
            [Input("txtUserID", "value"),
             Input("spanClose", "n_clicks")] +
            [Input('sl-{}'.format(count), 'value')
             for count in range(25)], [State('intermUserID', 'children')] + [
                 State('hdmid-{}'.format(count), 'children')
                 for count in range(25)
             ])
        def UpdateNewUserID(signInUserID, n_clickC, *values):
            valRatings = list(values)[:25]
            userID = list(values)[25]
            userID = str(list(values)[25]).split(
                ",")[1] if userID is not None and userID != "" else ""
            valMovieID = list(values)[26:]

            if (signInUserID is not None and signInUserID != ""):
                return "userID," + str(signInUserID)
            elif n_clickC is None and len([
                    t for t in valRatings if t is not None and t > 0
            ]) == 1 and (userID is None or userID == ""):
                newUserID = int(recoClass.ratings_df.userId.max()) + 1
                i_r = [(i, r) for i, r in enumerate(valRatings)
                       if r is not None and r > 0][0]
                dfToAppend = pd.DataFrame(
                    [[
                        int(newUserID), valMovieID[i_r[0]][0], i_r[1],
                        time.time()
                    ]],
                    columns=['userId', 'movieId', 'rating', 'timestamp'])
                recoClass.ratings_df = recoClass.ratings_df.append(
                    dfToAppend, ignore_index=True)
                recoClass.ratings_df.to_csv("ml-latest-small\\ratings.csv",
                                            index=False)
                recoClass.update_mean()
                return "newUserID," + str(newUserID)
            elif (userID is not None and userID != ""):
                for r_index, r in enumerate(valRatings):
                    if r is not None and r != "" and float(r) > 0:
                        dfTemp = recoClass.ratings_df[
                            (recoClass.ratings_df.userId != int(userID)) |
                            (recoClass.ratings_df.
                             movieId != int(valMovieID[r_index][0]))]
                        dfToAppend = pd.DataFrame([[
                            int(userID), valMovieID[r_index][0], r,
                            time.time()
                        ]],
                                                  columns=[
                                                      'userId', 'movieId',
                                                      'rating', 'timestamp'
                                                  ])
                        dfTemp = dfTemp.append(dfToAppend, ignore_index=True)
                        dfTemp.to_csv("ml-latest-small\\ratings.csv",
                                      index=False)
                        recoClass.ratings_df = dfTemp
                        recoClass.update_mean()
                return "userID," + str(userID)
            else:
                return ""

        @app.callback(Output('modalBody', 'children'),
                      [Input("intermUserID", "children")])
        def UpdateUserCreatedMsg(userID):
            if userID is not None and userID != "":
                userID = str(userID).split(",")
                if userID[0].strip() == "newUserID":
                    return "Your account has been created. Your User ID is " + str(
                        userID[1])
                else:
                    return ""
            else:
                return ""

        @app.callback(Output('newIDModal', 'style'),
                      [Input("modalBody", "children")])
        def UpdateModalVisible(msg):
            if msg is not None and msg != "":
                return {"display": "block"}
            else:
                return {"display": "none"}
    else:
        recommendedMoviesLayout = html.Div([
            html.Div([
                dcc.Input(id='txtUserID', type="text"),
                dcc.Link('Sign In',
                         href='/Movies',
                         className="button u-pull-right",
                         style={"background-color": "forestgreen"})
            ],
                     style={"display": "none"}),
            html.Div([
                html.H3('Recommended Movies',
                        style={
                            "width": "75%",
                            "float": "left"
                        }),
                html.Div([
                    dcc.Link('Refresh',
                             href="/Movies",
                             id="btnRefresh",
                             className="button u-pull-right",
                             style={"color": "black"})
                ],
                         style={"text=align": "center"})
            ]),
            html.Div(style={"clear": "both"}),
            html.Div([
                html.Div(lstContent),
                html.Div([
                    html.H3('Movies from Director you may like',
                            style={"padding": "20px"})
                ] + [
                    html.Div([
                        html.Div([
                            html.P(recoClass.movies_df[
                                recoClass.movies_df.movieId ==
                                dMovieId].title.values[0],
                                   style={"color": "#3bace1"}),
                            html.P("Genre: " + recoClass.movies_df[
                                recoClass.movies_df.movieId ==
                                dMovieId].genres.values[0])
                        ],
                                 className="movietgr")
                    ],
                             className="moviethumbn")
                    for dMovieId in lstDirectorMovies
                ] if lstDirectorMovies is not None else [])
            ],
                     style={"background-color": "#4ABDAC"})
        ])

        return recommendedMoviesLayout
コード例 #30
0
ファイル: dash_report.py プロジェクト: beterlou2/dash_report
def create_layout(app):
    return html.Div(
        [
            #header(app),
            html.Div(
                [
                    "证券研究报告"
                ],
                className = "header",
            ),
    
            html.Div(
                [
                    html.Div(
                        [
                            html.Div(["公司研究/公告点评"], id = "title_part1",),
                            html.Div(["2020年06月07日"], id = "title_part2",),
                        ],
                        id = "title_left",
                    ),
                    html.Div(
                        [
                            html.Div(
                                [
                                    html.Div(["交运设备/汽车整车 II"], id = "title_part3",),
                                ],
                                id = "category",
                            ),
                        ],
                        id = "title_right",
                    ),
                ],
                className = "title",
            ),
            html.Div(
                [
                    html.Div(
                        [
                            html.Div(
                                [
                                   
                                    html.Div(
                                        [
                                           "投资评级:买入(维持评级)"
                                        ],
                                        className = "section_title",
                                    ),
                                    html.Div(
                                        [
                                        
                                            html.Div(
                                                [
                                                    html.P(["当前价格(元):"]),
                                                    html.P(["合理价格区间(元): "]),
                                                ],
                                                id = "subsect1_left",
                                            ),
                                            html.Div(
                                                [
                                                    html.P(["18.23"]),
                                                    html.P(["24.64~26.40"]),
                                                ],
                                                id = "subsect1_right",
                                            ),
                                            html.Div([], id = "border_bot"),
                                            html.Div(
                                                [
                                                    html.Div(["林志轩"], className = "staff_name"),
                                                    html.Div(["研究员"], className = "staff_position"),
                                                    html.Div(["刘千琳"], className = "staff_name"),
                                                    html.Div(["研究员"], className = "staff_position"),
                                                    html.Div(["王涛"], className = "staff_name"),
                                                    html.Div(["研究员"], className = "staff_position"),
                                                    html.Div(["邢重阳"], className = "staff_name"),
                                                    html.Div(["联系人"], className = "staff_position"),
                                                ],
                                                id = "staff_info",
                                            ),
                                            html.Div(
                                                [
                                                    html.Div(
                                                        [
                                                            "执业证书编号:S0570519060005", 
                                                            html.Br(),
                                                            "021-28972090 ",
                                                            html.Br(),
                                                            "*****@*****.**",
                                                        ], 
                                                        className = "contact_info",
                                                    ),
                                                    html.Div(
                                                        [
                                                            "执业证书编号:S0570518060004",
                                                            html.Br(),
                                                            "021-28972076",
                                                            html.Br(),
                                                            "*****@*****.**",
                                                        ], 
                                                        className = "contact_info",
                                                    ),
                                                    html.Div(
                                                        [
                                                            "执业证书编号:S0570519110001",
                                                            html.Br(),
                                                            "021-28972053",
                                                            html.Br(),
                                                            "*****@*****.**",
                                                        ], 
                                                        className = "contact_info",
                                                    ),
                                                    html.Div(
                                                        [
                                                            "021-38476205 ",
                                                            html.Br(),
                                                            "*****@*****.**"
                                                        ], 
                                                        className = "contact_info",
                                                    ),
                                                ],
                                                id = "staff_contact",
                                            ),
                                        ],
                                        id = "subsect1",
                                    ),
                                ],
                                className = "block1",
                            ),
                           
                            html.Div(
                                [
                                    html.Div(
                                        [
                                            "相关研究"
                                        ],
                                        className = "section_title",
                                    ),
                                    html.Div(
                                        [
                                            "1《上汽集团(600104 SH,买入): 19 盈利下滑 29%,龙头整装再出发》2020.01"
                                        ],
                                        className = "study_details",
                                    ),
                                    html.Div(
                                        [
                                            "2《上汽集团(600104 SH,买入): 产量同比提 升,批发销量跌幅收窄》2019.09"
                                        ],
                                        className = "study_details",
                                    ),
                                    html.Div(
                                        [
                                            "3《上汽集团(600104 SH,买入): Q2 终端折扣 大,业绩略低于预期》2019.08"
                                        ],
                                        className = "study_details",
                                    ),
                                ],
                                className = "block2",
                            ),
                            html.Div(
                                [
                                    html.Div(
                                        [
                                            "一年股价走势图"
                                        ],
                                        className = "section_title",
                                    ),
                                    
                                    html.Div(
                                        [
                                            html.Img(src=app.get_asset_url('stocks.png')),
                                        ],
                                        className = "stocks_graph",
                                    ),
                                ],
                                className = "block3",
                            ),
                        ],
                        className = "col_left",
                    ),
                    html.Div(
                        [
                            html.Div(
                                [
                                "5月国内销量转正,上汽大众待改善"
                                   
                                ],
                                className = "cr_title",
                            ),
                            html.Div(
                                [
                                    "上汽集团(600104)"
                                ],
                                className = "cr_title2",
                            ),
                            html.Div(
                                [
                                    "5月国内销量增速转正,批发销量增速或弱于行业"
                                ],
                                className = "para_title",
                            ),
                            html.Div(
                                [
                                    "6月5日,公司发布5月销量情况。5月公司实现批发销量47.3万台,同比-1.6%,其中国内销量45.6万台,同比+0.3%。根据中汽协预测,5月汽车 销量同比+11%,上汽销量增速弱于行业,主要原因是受海外疫情影响,出口销量大幅下滑,同时上汽大众销量下滑。我们认为随着疫情结束,汽车需 求有望逐步恢复,Q2 汽车行业批发销量有望转正。随着行业恢复和公司战 略调整进一步深入,公司销量和归母净利润有望逐季恢复,预计 20-22 年 EPS 分别为 1.76、1.98、2.17 元,维持“买入”评级。"
                                ],
                                className = "para_body",
                            ),
                            html.P(),
                            html.Div(
                                [
                                    "上汽通用五菱销量改善明显,上汽通用、自主跌幅收窄"
                                ],
                                className = "para_title",
                            ),
                            html.Div(
                                [
                                    "5 月,上汽大众批发销量 13 万台,同比-15%,上汽通用批发销量 13.6 万 台,同比-3.6%,上汽自主批发销量 5.2 万台,同比-5%,上汽通用五菱批 发销量 12 万台,同比+11%;上汽大通销量 1.6 万台,同比+61%;上汽红 岩销量 10109 台,同比+110%。上汽集团开展了“五五”购物节促销活动, 商用车销量增长迅速,国内批发销量转正。上汽通用五菱战略转型后推出 了较多新车型,销量情况有明显改善。上汽通用三缸机车型逐步转回四缸 机,销量跌幅收窄。上汽自主新车 RX5 Plus 新车上市,销量跌幅收窄。细 分市场竞争激烈,上汽大众销量仍有下滑。"
                                ],
                                className = "para_body",
                            ),
                            html.P(),
                            html.Div(
                                [
                                    "上汽通用三缸机逐步转回四缸机,上汽自主 RX5 Plus 开启预售"
                                ],
                                className = "para_title",
                            ),
                            html.Div(
                                [
                                    "2019 年上汽通用批发销量同比-19%,其中一个原因是三缸机车型不受国 内消费者欢迎,上汽通用英朗、威朗等 13 个车型有三缸机版本。从 2020 年 4 月开始,上汽通用逐步将三缸机车型转回四缸,英朗和科鲁泽已经转 为四缸车型。5 月 4 日,RX5 Plus 开启预售,该车型是上汽自主主力车型 rx5 中期改款,新车共推出三个版本,官方预售价 12.28~13.98 万元。我 们认为新车在前脸设计、内饰设计和智能网联配置上有较大改善,RX5 Plus 有望帮助上汽自主提升 10~15 万紧凑型 SUV 细分领域市占率,上汽自主 销量有望逐季改善。"
                                ],
                                className = "para_body",
                            ),
                            html.P(),
                            html.Div(
                                [
                                    "销量和利润有望逐季改善,维持“买入”评级"
                                ],
                                className = "para_title",
                            ),
                            html.Div(
                                [
                                    "上汽通用和上汽通用五菱销量情况正在逐步改善。2020 年 Q4 上汽大众 MEB 工厂有望投产,上汽大众有望在新能源汽车领域取得突破。2021 年 上汽奥迪投产在望,公司进一步布局豪华车领域,未来发展值得期待。我 们预计公司 2020-22 年分别实现归母净利 205、231、254 亿元,EPS 分 别为 1.76、1.98、2.17 元,同行业可比公司 20 年平均估值 16.8XPE, 考虑到公司业绩弹性略弱于可比公司,维持公司 20 年 14~15XPE 估值, 维持目标价 24.64~26.4 元,维持“买入”评级。 "
                                ],
                                className = "para_body",
                            ),
                            html.P(),
                            html.Div(
                                [
                                    "风险提示:我国汽车销量增速不及预期,公司海外市场拓展不及预期。"
                                ],
                                className = "para_body",
                            ),
                        ],
                        className = "col_right",
                    ),
                    html.Div(
                        [
                            
                            html.Div(
                                [   
                                    html.Div(
                                        [
                                            "公司基本资料"
                                        ],
                                        className = "section_title",
                                    ),
                                    
                                    html.Div(
                                        [
                                            html.Table(make_dash_table(stocks_asset)),
                                        ],
                                        id = "table1",
                                    ),
                                ],
                                id = "block4",
                            ),
                            
                            html.Div(
                                [
                                    html.Div(
                                        [
                                            "经营预测指标与估值"
                                        ],
                                        className = "section_title",
                                    ),
                                    html.Table(make_dash_table(accounting)),
                                ],
                                id = "block5",
                            ),
                        ],
                        className = "col_bot",
                    ),
                ],
                className = "body",
            ),
        ],
        className = "page",
    )