(durationMs: number)
| 200 | } |
| 201 | |
| 202 | export function formatDurationForAxis(durationMs: number): string { |
| 203 | // Cap at 24 hours (86,400,000 ms) |
| 204 | const cappedMs = Math.min(durationMs, MAX_LAG_MS); |
| 205 | |
| 206 | if (cappedMs < 1000) { |
| 207 | return `${Math.round(cappedMs)}ms`; |
| 208 | } else if (cappedMs < 60000) { |
| 209 | return `${cappedMs / 1000}s`; |
| 210 | } else if (cappedMs < 3600000) { |
| 211 | return `${Math.round(cappedMs / 60000)}m`; |
| 212 | } else { |
| 213 | const hours = cappedMs / 3600000; |
| 214 | return `${hours.toFixed(1)}h`; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | export const formatPercentage = (percentage: number) => |
| 219 | `${(percentage * 100).toFixed(2)}%`; |
no test coverage detected