Skip to main content
Experimental. resetButton, renderResetButton, onResetView and resetView() are prototypes. The button is available on LiveChart; resetView() works on both charts.
Once a chart can be scrolled back in time, pinched, scaled on the price axis and panned on the price axis, nothing short of a timeframe change brings it back. resetButton floats a control inside the plot while the view differs from the fitted live view and hides it again once the chart is back where it started. One tap returns the time window, the price scale and the price offset together.

Scale and pan candles or lines, then restore the live view with the reset button. The same reset also clears pinch zoom.

Live example: app/demo/reset-view.tsx opens this guide’s demo directly. app/demo/time-scroll.tsx shares the same interaction controls, and app/showcase/fomo-perps.tsx shows the button in a product layout.

Try it in the example app

Open Demos → Interaction → Reset view (also available under Time scroll). The demo starts with price panning set to After scale, pinch zoom on, and the reset button enabled, in candle mode.
  1. Drag the price-axis labels vertically to scale the range and arm price panning.
  2. Drag vertically inside the plot to move its price window, or diagonally to pan time and price together. Pinch with two fingers to change the time window.
  3. Tap the floating reset button to restore the fitted live view. The Reset view controls also expose resetView() and let you hide or show the button.
  4. Switch Chart type to Line to try the same interactions on a line chart.
The Price scroll controls offer Off, After scale, and Always. The Fomo perps showcase also enables price panning and the floating reset button.

What shows the button

The button appears while any of these is true, and fades out (default 160 ms) when none is:
  • the window is scrolled back in time (timeScroll),
  • the window width was pinched (zoom),
  • the price axis was scaled (yRangeScale differs from 1),
  • the price window was panned (priceScroll).
It hides while a scrub owns the touch. Pick which states count with showFor:

Placement and look

The built-in button is a round glyph in palette colors, sitting margin px inside the plot rect and clear of the price-axis gutter and the time labels.
The glyph uses the chart font, like scrubAction.icon and marker icons. If your font lacks the default "↺", pass a glyph it has, or render your own button.

Custom button

renderResetButton replaces the visual only. The chart keeps the placement, the visibility and fade, and the tap, so return a plain view, not a pressable. The element is measured with onLayout, so any size works. Wire reset to onAccessibilityTap on iOS and an activate accessibility action on Android so screen readers can activate it; visible is a SharedValue you can use for your own animation. The built-in button handles both platforms.
Keep the render callback stable (useCallback) so the chart’s memoized overlay does not re-render each frame.

resetView() from outside

Both charts expose resetView() on the LiveChartHandle. It runs on the UI thread and is safe when the view is already fitted:
  • The pinch window is cleared and the right edge glides back to live with the returnToLive timing (instant when returnToLive is false).
  • A price range written by priceScroll or the axis-scale gesture is cleared. yRangeScale lands on 1 in one step in that case, so the display range eases from the panned window to the fit instead of jumping; without a panned range it animates to 1 over 240 ms, as the axis double tap does.
  • An app-written viewport.range is left alone, as with resetZoom(). A later app write, including modify(), or a replacement viewport.range gives ownership back to the app after a price pan.
  • onResetView fires on the JS thread after the reset overrides have been applied on the UI thread, for both button taps and resetView(). Return animations may still be running.
On LiveChartSeries, resetView() is resetZoom() plus the eased yRangeScale reset.

Notes

  • Gesture order. The button’s tap is composed ahead of the plot gestures and claims only touches that land on the visible button, so it never delays scrub, time-scroll, price pan or pinch.
  • Hidden means hidden. While the button is faded out it is not focusable by screen readers and does not receive touches.
  • Timeframe changes. A snapKey or mode change re-frames the chart and clears a gesture-written price range, so the button hides on its own.