Problem / motivation
When you zoom into an X (time) window on a FastSense plot, the Y axis never rescales — it stays at the full-dataset range. A small feature riding on a large-amplitude signal therefore renders as a flat line once you zoom in, and the user has to fiddle with ylim manually to see any detail.
This is verified in code:
- At render,
FastSense pins Y to the full data range: set(obj.hAxes,'YLim',[yLimLow,yLimHigh]) (libs/FastSense/FastSense.m:1497) followed by set(obj.hAxes,'YLimMode','manual') (:1500), cached as FullYLim (:1504) for the Home button (:3970).
- The primary zoom/pan listener
onXLimChanged (registered at :1533) re-downsamples for the new X view but never touches Y.
Auto-fit-Y-on-zoom is the single most-requested time-series interaction after zoom itself — every oscilloscope / trace viewer has it. For a MATLAB sensor engineer scanning a long recording, it turns "zoom in → flat line" into "zoom in → see the detail."
Tracker checked (autoscale, YLimMode, AutoY, fit y visible): no existing issue. (#300 secondary y-axis and #263/#285 fixed limits are the opposite — they pin limits; this fits to the view.)
Proposed feature
An opt-in 'AutoFitY' name-value option on FastSense. When enabled, every time the visible X window changes (zoom/pan), the Y axis is rescaled to the min/max of the data currently visible in that window (with a small headroom pad). Default false preserves today's exact behavior.
Rough sketch
- Lib/class:
libs/FastSense/FastSense.m only.
- Public API:
FastSense(..., 'AutoFitY', true) (default false), parsed via the existing parseOpts mechanism. Optionally a runtime setAutoFitY(tf) setter mirroring the other set* toggles.
- Mechanism: in
onXLimChanged (the existing zoom/pan hook), when AutoFitY is on, scan the displayed lines' YData over the current XLim and set YLim to [min max] plus a small pad. MinMax downsampling already preserves per-window extremes, so the displayed YData min/max is the true visible extent — no extra data pass.
- Home button: decide whether Home re-fits or restores
FullYLim (flagged as a product micro-decision below).
- Guard: if the visible window is empty / all-NaN, leave
YLim unchanged.
Value
A genuine new end-user capability (not builder convenience): see detail on zoom instead of a flat line, with zero manual ylim calls. Later forwardable to FastSenseWidget via the established forward-an-option pattern (cf. #290 / #298 / #301).
Constraints check
- Toolbox-free: yes — plain axes
YLim manipulation.
- Backward-compatible: yes — opt-in, default
false preserves current manual-full-range behavior; FastSense config is not serialized, so no dashboard/JSON round-trip impact.
- Pure MATLAB/Octave: yes.
- Existing contract: stays within the
FastSense render/update lifecycle; piggybacks on the existing onXLimChanged listener.
Effort estimate
S–M — one parseOpts default + a small refit block in onXLimChanged + Home-button interaction + empty/all-NaN guard, all in FastSense.m. One focused test: zoom into a sub-window of a spiky-vs-flat signal and assert YLim tightened to the visible extent; assert AutoFitY=false leaves it at FullYLim.
Open product micro-decisions for triage: the Y headroom pad fraction, and whether the Home button re-fits or restores the full range.
AI-proposed via /feature-scout — needs a human product decision before implementation.
Problem / motivation
When you zoom into an X (time) window on a
FastSenseplot, the Y axis never rescales — it stays at the full-dataset range. A small feature riding on a large-amplitude signal therefore renders as a flat line once you zoom in, and the user has to fiddle withylimmanually to see any detail.This is verified in code:
FastSensepins Y to the full data range:set(obj.hAxes,'YLim',[yLimLow,yLimHigh])(libs/FastSense/FastSense.m:1497) followed byset(obj.hAxes,'YLimMode','manual')(:1500), cached asFullYLim(:1504) for the Home button (:3970).onXLimChanged(registered at:1533) re-downsamples for the new X view but never touches Y.Auto-fit-Y-on-zoom is the single most-requested time-series interaction after zoom itself — every oscilloscope / trace viewer has it. For a MATLAB sensor engineer scanning a long recording, it turns "zoom in → flat line" into "zoom in → see the detail."
Tracker checked (
autoscale,YLimMode,AutoY,fit y visible): no existing issue. (#300 secondary y-axis and #263/#285 fixed limits are the opposite — they pin limits; this fits to the view.)Proposed feature
An opt-in
'AutoFitY'name-value option onFastSense. When enabled, every time the visible X window changes (zoom/pan), the Y axis is rescaled to the min/max of the data currently visible in that window (with a small headroom pad). Defaultfalsepreserves today's exact behavior.Rough sketch
libs/FastSense/FastSense.monly.FastSense(..., 'AutoFitY', true)(defaultfalse), parsed via the existingparseOptsmechanism. Optionally a runtimesetAutoFitY(tf)setter mirroring the otherset*toggles.onXLimChanged(the existing zoom/pan hook), whenAutoFitYis on, scan the displayed lines'YDataover the currentXLimand setYLimto[min max]plus a small pad. MinMax downsampling already preserves per-window extremes, so the displayedYDatamin/max is the true visible extent — no extra data pass.FullYLim(flagged as a product micro-decision below).YLimunchanged.Value
A genuine new end-user capability (not builder convenience): see detail on zoom instead of a flat line, with zero manual
ylimcalls. Later forwardable toFastSenseWidgetvia the established forward-an-option pattern (cf. #290 / #298 / #301).Constraints check
YLimmanipulation.falsepreserves current manual-full-range behavior;FastSenseconfig is not serialized, so no dashboard/JSON round-trip impact.FastSenserender/update lifecycle; piggybacks on the existingonXLimChangedlistener.Effort estimate
S–M — one
parseOptsdefault + a small refit block inonXLimChanged+ Home-button interaction + empty/all-NaN guard, all inFastSense.m. One focused test: zoom into a sub-window of a spiky-vs-flat signal and assertYLimtightened to the visible extent; assertAutoFitY=falseleaves it atFullYLim.Open product micro-decisions for triage: the Y headroom pad fraction, and whether the Home button re-fits or restores the full range.
AI-proposed via /feature-scout — needs a human product decision before implementation.