Пример #1
0
def username_in_layout(id):
    oauth_token = flask.request.cookies['plotly_oauth_token']
    base_url = 'https://plotly.charleyferrari.com/v2'
    endpoint = '/users/current'
    headers = {
        'plotly-client-platform': 'dash-auth',
        'content-type': 'application/json',
        'Authorization': 'Bearer {}'.format(oauth_token)
    }
    r = requests.get(url=base_url + endpoint, headers=headers, verify=False)
    username = r.json()['username']
    return html.Div(className='container',
                    children=[
                        Header('Hello {}'.format(username)),
                        Row([
                            Column(width=4,
                                   children=[
                                       dcc.Dropdown(
                                           id='dropdown',
                                           options=[{
                                               'label': i,
                                               'value': i
                                           } for i in ['LA', 'NYC', 'MTL']],
                                           value='LA')
                                   ]),
                            Column(width=8, children=[dcc.Graph(id='graph')])
                        ])
                    ])
Пример #2
0
 def initiate_containers(self):
     for i in range(len(self.field)):
         self.squares.append(Square(i // 3 * 3,
                                    i % 3 * 3,
                                    self.field))
         self.rows.append(Row(i, self.field))
         self.columns.append(Column(i, self.field))
     self.update_all()
Пример #3
0
from components import Column, Header, Row

app = dash.Dash(__name__)

server = app.server  # Expose the server variable for deployments

# Standard Dash app code below
app.layout = html.Div(className='container',
                      children=[
                          Header('Sample App'),
                          Row([
                              Column(width=4,
                                     children=[
                                         dcc.Dropdown(
                                             id='dropdown',
                                             options=[{
                                                 'label': i,
                                                 'value': i
                                             } for i in ['LA', 'NYC', 'MTL']],
                                             value='LA')
                                     ]),
                              Column(width=8, children=[dcc.Graph(id='graph')])
                          ])
                      ])


@app.callback(Output('graph', 'figure'), [Input('dropdown', 'value')])
def update_graph(value):
    return {
        'data': [{
            'x': [1, 2, 3, 4, 5, 6],
            'y': [3, 1, 2, 3, 5, 6]
Пример #4
0
        Header('Arxiv Assistant', app),
        Row([
            dcc.Input(id='input-url',
                      placeholder='Enter URL...',
                      type='text',
                      value='',
                      style={
                          'width': '80%',
                          'margin-right': '20px'
                      }),
            html.Button('Submit', id='button-update')
        ]),
        Row([
            Column(width=6,
                   children=[
                       dcc.Markdown(id='markdown-article', style=card_style()),
                       dcc.Markdown(id='markdown-recommendations',
                                    style=card_style('#e5ecf6', '#626efa'))
                   ]),
            Column(width=6,
                   children=[
                       dcc.Graph(id='graph-topics', style={'height': '40%'}),
                       dcc.Markdown(id='markdown-topics-description')
                   ])
        ])
    ])


@app.callback(Output('markdown-article',
                     'children'), [Input('button-update', 'n_clicks')],
              [State('input-url', 'value')])
def update_article_description(n_clicks, url):
Пример #5
0
 Column(children=[html.Div(id='manhattan-control-tabs-1', className='control-tabs', children=[
     dcc.Tabs(id='', value='what-is', parent_className='custom-tabs', className='custom-tabs-container',
     children=[
         dcc.Tab(
             label='About',
             value='what-is',
             className='custom-tab',
             selected_className='custom-tab--selected',
             children=html.Div(className='control-tab', children=[
                 html.H2(className='what-is', style={'text-align': 'center'}, children='Which funds are not so super?'),
                 html.P( 'The challenge to compare fund performance is most acute for choice super products.'
                         ' Astoundingly, super funds aren’t required to provide simple, comparable information on the fees '
                         'and returns of choice products'),
                 html.P('This tool should be used by anyone who wants to check on their fund, '
                         'with the appropriate focus on long-term performance.'
                         'You can compare performance at the click of a mouse button.'),
                 html.P('You can adjust the products in the "Filters" tab, '
                        'and the ordering/ranking on the tables'),
                 html.P('So which funds really are super?'),
                 html.Br(),
                 html.P('The data in these tabs is drawn from the latest published information provided by'
                         'super funds to the Australian Prudential Regulation Authority (APRA).'),
                 dcc.Link('See APRAs Quarterly MySuper Statistics', href='https://www.apra.gov.au/publications/quarterly-superannuation-statistics')
             ])
         ),
         dcc.Tab(
             label='Filters',
             value='graph',
             className='custom-tab',
             selected_className='custom-tab--selected',
             children=html.Div(className='control-tab', children=[
                 html.Div(className='app-controls-block', children=[
                     html.Div(
                         className='app-controls-name',
                         children=[
                             'Fund Types'
                         ]
                     ),
                     dcc.Dropdown(
                                 id='fund-types-dropdown',
                                 value='All',
                                 multi=False,
                                 clearable=False,
                             ),
                 ]),
                 html.Div(
                     className='app-controls-block', children=[
                         html.Div(
                             className='app-controls-name',
                             children=[
                                 'Asset Classes',
                             ]
                         ),
                             dcc.Dropdown(
                                 id='asset-class-dropdown',
                                 value='All',
                                 multi=False,
                                 clearable=False,
                             ),
                     ]
                 ),
                 html.Div(
                     className='app-controls-block', children=[
                         html.Div(
                             className='app-controls-name',
                             children=[
                                 'Fund Access',
                             ]
                         ),
                         dcc.Checklist(
                             id='fund-access-checklist',
                             options=[
                                 {'label': 'Public', 'value': '1'},
                                 {'label': 'Private', 'value': '0'},
                             ],
                             value=['1', '0'],
                             labelStyle={'display': 'inline-block'}
                         )  
                     ]
                 ),
                 html.Div(
                     className='app-controls-block', children=[
                         html.Div(
                             className='app-controls-name',
                             children=[
                                 'Strategy',
                             ]
                         ),
                         dcc.Checklist(
                             id='strategy-checklist',
                             options=[
                                 {'label': 'Life Cycle', 'value': '1'},
                                 {'label': 'Single Diversified', 'value': '0'},
                             ],
                             value=['1', '0'],
                             labelStyle={'display': 'inline-block'}
                         )  
                     ]
                 ),
                 
                 html.Div(
                     className='app-controls-block', children=[
                         html.Div(
                             className='app-controls-name',
                             children=[
                                 'Name Search',
                             ]
                         ),
                             dcc.Dropdown(
                                 id='name-search',                                        
                                 multi=True,                                     
                                 placeholder="Search Investment Name"
                             ),
                     ]
                 ),
             ])
         )
     ])
 ]),], width=3),
Пример #6
0
)

server = app.server  # Expose the server variable for deployments

options = [{'label': i, 'value': i} for i in ['LA', 'NYC', 'MTL']]

# Standard Dash app code below
app.layout = html.Div(className='container', children=[

    Header('Sample App', app),

    Row([
        Column(width=4, children=[
            dcc.Dropdown(
                id='dropdown',
                options=options,
                value='LA'
            )
        ]),
        Column(width=8, children=[
            dcc.Graph(id='graph')
        ])
    ])
])


@app.callback(Output('title', 'children'), [Input('title', 'id')])
def give_name(title):
    username = auth.get_username()
    if username:
        return '{}\'s Sample App'.format(username)
Пример #7
0
 Header('Interactive Dashboard'),
 Row([
     Column(width=6,
            children=[
                dcc.Dropdown(id='dealer-dropdown',
                             options=[{
                                 'label': f"{name_map[i]} ({i})",
                                 'value': str(i)
                             } for i in dealer_list],
                             value=dealer_list[0]),
                dcc.DatePickerRange(
                    id='date-picker-range',
                    display_format='Y-M-D',
                    min_date_allowed=dt(2017, 1, 1),
                    max_date_allowed=dt(2020, 1, 1),
                    start_date=dt(2017, 1, 1),
                    end_date=dt(2020, 1, 1),
                ),
                dcc.RadioItems(id='lead-radio-items',
                               options=[{
                                   'label':
                                   i.replace('_', ' ').title(),
                                   'value':
                                   i
                               } for i in ['lead_type', 'lead_status']],
                               labelStyle={'display': 'inline-block'},
                               value='lead_type'),
                dcc.Graph(id='lead-graph')
            ]),
     Column(width=6,
            children=[