Commit 5ff1a23
feat(bifrost): Add projection bars to stats page bar charts (#5433)
* feat(bifrost): Add projection bars to stats page bar charts
Add semi-transparent gray projection bars to the last/current time bucket on
all bar charts in the Bifrost stats page. The projection is calculated using
a blend of:
1. Simple projection based on current progress through the time bucket
2. Historical average from previous buckets
This feature helps users understand what the final total is likely to be for
the in-progress time bucket.
Changes:
- Add projectionUtils.ts with calculation functions
- Update ModelUsageChart with projection bars
- Update MarketShareChart with projection bars (for token projections)
- Update ProviderUsageChart with projection bars
- Enhanced tooltips to show projected values for the last bar
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Connor Loi <loiconnor8@gmail.com>
* fix(bifrost): Improve projection algorithm and use Tailwind color
- Use linear regression for trend-based projection instead of simple averaging
- Take the max of trend projection and simple extrapolation, then blend
- This ensures projections follow growth trends rather than pulling toward average
- Move projection color to CHART_COLORS.projection using Tailwind muted-foreground hue
- Remove hardcoded PROJECTION_COLOR constants from individual chart files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(bifrost): Simplify projection algorithm
- Use linear regression on previous complete buckets for trend trajectory
- Only use pace-based projection if it's HIGHER than trend
- This accounts for 4-hour cache causing pace to typically be behind
- Removed complex blending logic in favor of simple max(trend, pace)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: Remove unnecessary comments from chartColors.ts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: Remove unnecessary comments from chart files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* rm unused
* refactor(bifrost): Remove shouldShowProjection function
Always show projection for the last bar. The shouldShowProjection
function was unnecessary - projection values should always be
calculated and displayed for the last bar.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: replicas-connector[bot] <replicas-connector[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Connor Loi <loiconnor8@gmail.com>1 parent af0976e commit 5ff1a23
File tree
5 files changed
+364
-50
lines changed- bifrost
- app/stats
- lib
- utils
5 files changed
+364
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
59 | 67 | | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | | - | |
| 71 | + | |
63 | 72 | | |
64 | 73 | | |
| 74 | + | |
| 75 | + | |
65 | 76 | | |
66 | 77 | | |
67 | 78 | | |
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
71 | 85 | | |
72 | 86 | | |
73 | 87 | | |
74 | | - | |
| 88 | + | |
| 89 | + | |
75 | 90 | | |
76 | | - | |
| 91 | + | |
77 | 92 | | |
78 | 93 | | |
79 | 94 | | |
| 95 | + | |
80 | 96 | | |
81 | 97 | | |
82 | 98 | | |
| |||
92 | 108 | | |
93 | 109 | | |
94 | 110 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
98 | 121 | | |
99 | 122 | | |
100 | 123 | | |
| |||
103 | 126 | | |
104 | 127 | | |
105 | 128 | | |
106 | | - | |
107 | | - | |
| 129 | + | |
| 130 | + | |
108 | 131 | | |
109 | 132 | | |
110 | 133 | | |
111 | 134 | | |
112 | 135 | | |
113 | 136 | | |
114 | | - | |
115 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
116 | 153 | | |
117 | 154 | | |
| 155 | + | |
118 | 156 | | |
119 | 157 | | |
120 | 158 | | |
121 | 159 | | |
122 | 160 | | |
123 | 161 | | |
124 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
125 | 171 | | |
126 | 172 | | |
127 | 173 | | |
128 | 174 | | |
129 | 175 | | |
130 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
131 | 185 | | |
132 | 186 | | |
133 | 187 | | |
| |||
138 | 192 | | |
139 | 193 | | |
140 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
141 | 199 | | |
142 | 200 | | |
143 | | - | |
144 | | - | |
| 201 | + | |
| 202 | + | |
145 | 203 | | |
146 | 204 | | |
147 | 205 | | |
| |||
184 | 242 | | |
185 | 243 | | |
186 | 244 | | |
187 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
188 | 252 | | |
189 | 253 | | |
190 | 254 | | |
| |||
195 | 259 | | |
196 | 260 | | |
197 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
198 | 271 | | |
199 | 272 | | |
200 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
61 | 89 | | |
62 | 90 | | |
63 | 91 | | |
64 | 92 | | |
65 | 93 | | |
66 | 94 | | |
67 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
68 | 99 | | |
69 | 100 | | |
70 | | - | |
| 101 | + | |
71 | 102 | | |
72 | | - | |
| 103 | + | |
73 | 104 | | |
74 | 105 | | |
75 | 106 | | |
76 | 107 | | |
77 | 108 | | |
78 | | - | |
| 109 | + | |
79 | 110 | | |
80 | 111 | | |
81 | | - | |
| 112 | + | |
82 | 113 | | |
83 | 114 | | |
84 | | - | |
85 | | - | |
86 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
87 | 125 | | |
88 | 126 | | |
89 | 127 | | |
90 | 128 | | |
91 | 129 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
95 | 140 | | |
96 | 141 | | |
97 | 142 | | |
98 | 143 | | |
99 | 144 | | |
| 145 | + | |
100 | 146 | | |
101 | 147 | | |
102 | 148 | | |
| |||
109 | 155 | | |
110 | 156 | | |
111 | 157 | | |
112 | | - | |
113 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
114 | 165 | | |
115 | 166 | | |
| 167 | + | |
116 | 168 | | |
117 | 169 | | |
118 | 170 | | |
119 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
120 | 184 | | |
121 | 185 | | |
122 | 186 | | |
| |||
127 | 191 | | |
128 | 192 | | |
129 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
130 | 198 | | |
131 | 199 | | |
132 | 200 | | |
| |||
181 | 249 | | |
182 | 250 | | |
183 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
184 | 261 | | |
185 | 262 | | |
186 | 263 | | |
| |||
0 commit comments