fix(axis): show negative X values instead of clamping to 0s
formatTimeSec coerceAtLeast(0L) caused all pre-T0 ticks to display "0s". Now shows -5s, -1:30, -1:02:30 for negative elapsed time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
554b67e630
commit
99f7ee1252
1 changed files with 4 additions and 2 deletions
|
|
@ -152,12 +152,14 @@ internal object AxisRenderer {
|
|||
}
|
||||
|
||||
private fun formatTimeSec(totalSec: Double): String {
|
||||
val s = totalSec.toLong().coerceAtLeast(0L)
|
||||
return when {
|
||||
val negative = totalSec < 0
|
||||
val s = kotlin.math.abs(totalSec.toLong())
|
||||
val formatted = when {
|
||||
s < 60L -> "${s}s"
|
||||
s < 3600L -> "${s / 60}:${(s % 60).toString().padStart(2, '0')}"
|
||||
else -> "${s / 3600}:${((s % 3600) / 60).toString().padStart(2, '0')}:${(s % 60).toString().padStart(2, '0')}"
|
||||
}
|
||||
return if (negative) "-$formatted" else formatted
|
||||
}
|
||||
|
||||
private fun formatAxisValue(value: Double, decimals: Int): String {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue