Skip to content
EliteChart

Interactions

The full pan / zoom / crosshair / context-menu / drag vocabulary across mouse, trackpad, and touch.

EliteChart's interaction model has to handle three input modalities (mouse, trackpad, touch) and four reference frames (chart canvas, price axis, time axis, drawing handles). This page is the exhaustive vocabulary.

Quick example

code
'use client';
import { EliteChart } from '@elitechart/elitechart';
import '@elitechart/elitechart/styles.css';

export default function Page() {
  return (
    <div style={{ width: '100%', height: '100vh' }}>
      <EliteChart symbol="BTCUSD" timeframe="1h" />
    </div>
  );
}

How it works

Every gesture is dispatched through a central pointer-event router so the same code path handles a mouse, a trackpad, and a finger. Pinch is detected on pointerdown count; momentum scrolling is computed from the last 100 ms of pointer velocity at pointerup.

Chart canvas

GestureAction
Mouse wheel up/downZoom time axis
Trackpad two-finger horizontalPan time axis
Trackpad two-finger verticalPan price axis
Trackpad pinchZoom both axes
Drag (left button)Pan
Drag (middle button)Box-zoom
Right-clickContext menu (drawings, alerts, fit)
Touch — one-finger dragPan
Touch — pinchZoom both axes
Touch — long-pressContext menu (mobile)

Price axis (right edge)

GestureAction
Drag verticalStretch price axis
WheelSame
Double-clickReset price scale
Right-clickAxis options menu

Time axis (bottom edge)

GestureAction
Drag horizontalStretch time axis
WheelSame
Double-clickReset time scale
Right-clickAxis options menu

Drawings

GestureAction
Click bodySelect
Click handleBegin drag-resize
Right-clickPer-drawing menu (delete, duplicate, lock, fix-time)
Backspace while selectedDelete

Variations

Disable pan on the chart

Phase 1b — the interactions prop will gate pan/zoom/right-click independently. For now, intercept at the wrapper:

code
<div onPointerDown={(e) => e.stopPropagation()}>
  <EliteChart />
</div>

Snap drawings to the nearest OHLC value

Toggle magnet from the left toolbar or:

code
import { useChartStore } from '@elitechart/elitechart';
useChartStore.getState().setMagnetEnabled(true);

Reduced motion

Every animation respects prefers-reduced-motion: reduce. When set, pan/zoom transitions instantaneously rather than easing.