Skip to content

Commit 3bda75d

Browse files
ryan-williamsclaude
andcommitted
Fix CO₂ axis range: use autorange: 'max' for floor > 0 metrics
`range: [floor, null]` with `rangemode: 'nonnegative'` didn't properly auto-scale the upper bound. Using `autorange: 'max'` tells Plotly to fix the lower bound at `floor` while auto-calculating the maximum. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d552b08 commit 3bda75d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

www/src/components/AwairChart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,8 @@ export const AwairChart = React.memo(function AwairChart({ deviceDataResults, su
655655
tickformat: '.3~s',
656656
// If not auto-ranging: use floor as minimum (default 0 with rangemode tozero)
657657
...(!autoRange && floor === 0 && { rangemode: 'tozero' as const }),
658-
...(!autoRange && floor > 0 && { rangemode: 'nonnegative' as const, range: [floor, null] }),
658+
// For metrics with floor > 0 (e.g., CO2 at 400ppm), use autorange:'max' to auto-scale upper bound
659+
...(!autoRange && floor > 0 && { autorange: 'max' as const, range: [floor, null] }),
659660
...(side === 'right' && { overlaying: 'y' as const }),
660661
})
661662
// OG mode: fill viewport height (625px to leave room for bottom margin in 630px viewport)

0 commit comments

Comments
 (0)