Track View > Curve Editor or Dope Sheet > Navigation: Track View toolbar > Zoom Region
Zoom Region lets you drag a region in the Key window to scale that region to fill the window. Zoom Region remains active until you right-click to cancel or click another option. The Zoom Region button is yellow while active.
In Curve Editor mode, both time and value are scaled to fit the Key window. In Dope Sheet mode, only time is scaled to fit the Key window.