Commit 6849018
Add time range filter buttons to historical data graph
Implemented time range selection buttons (5D, 1M, 3M, 6M, 1Y, 5Y, All) for the stock historical data view. The buttons are positioned on the same line as the Back button, aligned to the right side.
Changes:
- Add TimeRange enum with conversion methods to days and display labels
- Add selected_time_range field to track current filter (defaults to 3M)
- Update load_plot_data to respect selected time range
- Add change_time_range method to switch filters and reload data
- Implement plot_needs_reset flag to fully reset graph view on mode change
- Add UI buttons with visual highlight for selected range
- Use Plot.reset() to clear zoom/pan state when switching ranges
The graph now completely resets (axes, data, zoom, pan) when:
- Clicking any time range button
- Switching between stocks
- Returning to a previously selected time range
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 53c3b78 commit 6849018
2 files changed
Lines changed: 109 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 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 | + | |
16 | 53 | | |
17 | 54 | | |
18 | 55 | | |
| |||
35 | 72 | | |
36 | 73 | | |
37 | 74 | | |
| 75 | + | |
| 76 | + | |
38 | 77 | | |
39 | 78 | | |
40 | 79 | | |
| |||
86 | 125 | | |
87 | 126 | | |
88 | 127 | | |
| 128 | + | |
| 129 | + | |
89 | 130 | | |
90 | 131 | | |
91 | 132 | | |
| |||
127 | 168 | | |
128 | 169 | | |
129 | 170 | | |
| 171 | + | |
130 | 172 | | |
131 | 173 | | |
132 | 174 | | |
| |||
165 | 207 | | |
166 | 208 | | |
167 | 209 | | |
168 | | - | |
169 | | - | |
170 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
171 | 218 | | |
172 | 219 | | |
173 | 220 | | |
| |||
242 | 289 | | |
243 | 290 | | |
244 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
245 | 308 | | |
246 | 309 | | |
247 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
| |||
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
105 | 141 | | |
106 | 142 | | |
107 | 143 | | |
| |||
0 commit comments