Skip to main content

Gestures & viewport

All navigation is handled inside the chart — you don't wire up any gesture code.

GestureEffect
Drag (one finger)Scroll through time; vertical drag moves the price window
PinchZoom around the focus point
Drag the price axis (right)Rescale price only
Drag the time axis (bottom)Rescale time only
Long-pressShow the snapping crosshair

Controlling the visible window

By default the chart shows a sensible recent window on first render. To control it explicitly, pass visibleRange:

<VroomChart
candles={candles}
visibleRange={{ startMs: 1700000000000, endMs: 1700090000000 }}
/>

Omit it (or pass both 0) to fit all candles. When you do drive visibleRange, treat onViewportChange as the source of truth for the current window after the user pans/zooms, and feed it back into state if you want a fully controlled chart.

Framing by candle width

Instead of an explicit time window, you can frame the first view by candle size. Pass defaultCandleWidth (px) and the chart picks the initial zoom so each candle body renders about that wide:

<VroomChart candles={candles} defaultCandleWidth={8} />

Larger values are more zoomed in (fewer, wider candles); smaller values are more zoomed out. This only affects the initial framing (and reset) — the user can still pan and zoom freely afterward, and an explicit visibleRange takes precedence. It's handy for keeping candles a consistent size across devices of different widths.

Sizing

The chart fills its parent, so prefer layout-driven sizing via style (flex, aspectRatio, or absolute fill). Pass explicit width / height only to override measured layout. See VroomChartProps.