-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchart.py
40 lines (31 loc) · 889 Bytes
/
chart.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
import dash_html_components as html
import pandas as pd
import dash_core_components as dcc
import plotly.graph_objs as go
import dash
from plotly.subplots import make_subplots
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
df = pd.read_csv(f'history.csv')
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.add_trace(go.Scatter(
x=df.date,
y=df.value,
name="price",
), secondary_y=False)
fig.add_trace(go.Scatter(
x=df.date,
y=df.price,
name="total value",
yaxis="y2",
), secondary_y=True)
app.layout = html.Div(children=[
dcc.Graph(
id='price',
figure=fig,
style={'title': 'price vs supply', 'height': '1000px'}
),
],
)
if __name__ == '__main__':
app.run_server(host="0.0.0.0", debug=True, dev_tools_hot_reload=True)