Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,21 +46,34 @@ for i in gaps:
|
|
46 |
line_width=0
|
47 |
)
|
48 |
|
49 |
-
# 5. TICK LABELS: show real times every N points
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
tick_every = max(1, len(df)//10)
|
|
|
|
|
|
|
|
|
51 |
fig.update_xaxes(
|
52 |
tickmode="array",
|
53 |
tickvals=df.index[::tick_every],
|
54 |
-
ticktext=
|
55 |
title="Time (VN)"
|
56 |
)
|
57 |
|
|
|
58 |
# 6. LAYOUT
|
59 |
fig.update_layout(
|
60 |
-
title="AAPL Live Candlestick
|
61 |
yaxis_title="Price (USD)",
|
62 |
dragmode="pan",
|
63 |
-
margin=dict(l=
|
64 |
width=1000,
|
65 |
height=500
|
66 |
)
|
|
|
46 |
line_width=0
|
47 |
)
|
48 |
|
49 |
+
# # 5. TICK LABELS: show real times every N points
|
50 |
+
# tick_every = max(1, len(df)//10)
|
51 |
+
# fig.update_xaxes(
|
52 |
+
# tickmode="array",
|
53 |
+
# tickvals=df.index[::tick_every],
|
54 |
+
# ticktext=df['Time (VN)'].dt.strftime('%H:%M')[::tick_every],
|
55 |
+
# title="Time (VN)"
|
56 |
+
# )
|
57 |
+
# 5. TICK LABELS: show real date + time every N points
|
58 |
tick_every = max(1, len(df)//10)
|
59 |
+
|
60 |
+
# format as “YYYY‑MM‑DD\nHH:MM”
|
61 |
+
ticktext = df['Time (VN)'].dt.strftime('%d-%m<br>%H:%M')
|
62 |
+
|
63 |
fig.update_xaxes(
|
64 |
tickmode="array",
|
65 |
tickvals=df.index[::tick_every],
|
66 |
+
ticktext=ticktext[::tick_every],
|
67 |
title="Time (VN)"
|
68 |
)
|
69 |
|
70 |
+
|
71 |
# 6. LAYOUT
|
72 |
fig.update_layout(
|
73 |
+
title="AAPL Live Candlestick",
|
74 |
yaxis_title="Price (USD)",
|
75 |
dragmode="pan",
|
76 |
+
margin=dict(l=0, r=0, t=20, b=20),
|
77 |
width=1000,
|
78 |
height=500
|
79 |
)
|