-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
54 lines (45 loc) · 1.17 KB
/
app.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
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]
}],
'layout': {
'title': value,
'margin': {
'l': 60,
'r': 10,
't': 40,
'b': 60
}
}
}
if __name__ == '__main__':
app.run_server(debug=True)