-
Notifications
You must be signed in to change notification settings - Fork 1
/
09_dash_01.py
51 lines (46 loc) · 1.02 KB
/
09_dash_01.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
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
app = dash.Dash()
app.layout = html.Div([
html.H1('Stock Ticker Dashboard'),
html.H3('Enter a stock symbol:'),
dcc.Input(
id='my_stock_picker',
value='TSLA'
),
dcc.Graph(
id='my_graph',
figure = dict(
data=[
dict(
x=[1,2],
y=[3,1]
)
],
layout=dict(
title="Stock Ticker"
),
)
)
])
@app.callback(
Output('my_graph', 'figure'),
[Input('my_stock_picker', 'value')]
)
def update_graph(stock_ticker):
fig = dict(
data=[
dict(
x=[1,2],
y=[3,1]
)
],
layout=dict(
title=stock_ticker
),
)
return fig
if __name__ == '__main__':
app.run_server()