quoc-khanh commited on
Commit
5600ac4
·
verified ·
1 Parent(s): 81e889a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
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=df['Time (VN)'].dt.strftime('%H:%M')[::tick_every],
55
  title="Time (VN)"
56
  )
57
 
 
58
  # 6. LAYOUT
59
  fig.update_layout(
60
- title="AAPL Live Candlestick (gaps as blocks)",
61
  yaxis_title="Price (USD)",
62
  dragmode="pan",
63
- margin=dict(l=20, r=20, t=40, b=40),
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
  )