Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(charts): move chart tooltips in one tap on touch devices (#79665)

Sam Pennington98cb50c7f724
diff --git a/packages/quill/packages/charts/AGENTS.md b/packages/quill/packages/charts/AGENTS.md
index 27acbaaf4840..611aa11f7c88 100644
--- a/packages/quill/packages/charts/AGENTS.md
+++ b/packages/quill/packages/charts/AGENTS.md
@@ -81,6 +81,7 @@ Safari is the exception: it never fires `contextrestored`, so a context lost the
- Overlays (`ReferenceLine`/`ReferenceLines`, `ValueLabels`, `AxisTitles`, `TrendLineOverlay`, `HighlightedRange`) compose as children.
- `HighlightedRange` draws a translucent box spanning an x-axis range — pass `start`/`end` as data indices or labels (e.g. straight from `onDateRangeZoom`'s `startIndex`/`endIndex`). Use it to mirror an external selection (the rows visible in a paired virtualized list, a picked time window) onto the chart. On band (bar) charts the box covers the endpoints' full bands; on point (line) charts it runs point to point. `color`, `fillOpacity`, and `borderOpacity` tune the look (`borderOpacity: 0` drops the edge border); it clamps to the plot area and renders null when an endpoint doesn't resolve.
- `DefaultTooltip` (the built-in tooltip, also usable from a custom `tooltip` render prop) takes optional `valueFormatter`, `labelFormatter`, `labelRenderer`, `showHeader`, `showTotal`, `totalLabel`, `totalFormatter`, `sortedByValue`, `hideZeroRows`, `onRowClick`, and `footer`. `valueFormatter` gets `(value, entry)` — the row's `seriesData` entry as a second arg — so each row can format with its own `series.meta` (e.g. per-column currency/duration); it may return a node, not just a string (e.g. a property-formatted value). `labelFormatter` transforms the raw x-axis label shown in the tooltip header (e.g. convert an ISO datetime string to "Jun 24, 10:00"); on time-series charts with `xAxis.timezone` + `interval` set it defaults to an interval-aware date formatter that includes the weekday for single-day buckets ("Sat, Jun 6, 2026", "Sat, Jun 6, 14:00"; week/month buckets span days, so "Jun 1, 2026", "Jun 2026"), so the header matches the auto-formatted axis ticks — an explicit `labelFormatter` still wins. `labelRenderer` overrides how each row's label renders (defaults to the series label) — use for richer labels than a plain string, e.g. breakdown-value pills. `showHeader` (default true) toggles the header label row — pass false for charts without a meaningful header (pie slices, aggregated single-column bars). `showTotal` appends a footer row summing the visible series; it excludes `overlay` series (goal lines) and series with `visibility.total: false` (values that don't sum meaningfully with the rest, e.g. a percentage column alongside counts — the row itself still renders) from the sum, and is suppressed when fewer than two summable series remain. `totalFormatter` formats the total (defaults to `valueFormatter` applied with the first summable row's entry); `totalLabel` defaults to `'Total'`. `sortedByValue` sorts rows by value descending so the highest value appears first. `hideZeroRows` drops rows whose value is exactly `0` (e.g. lifecycle statuses absent for a period), so the tooltip lists only series with data at the hovered point. `onRowClick` makes each series row clickable (firing with the row's `seriesData` entry) — the tooltip must be pinned for clicks to land, since an unpinned tooltip is `pointer-events: none`; use it to open a per-series drill-down (e.g. the persons modal). `footer` renders arbitrary content below all rows (with a divider) — useful for "click to inspect" hints. A formatter taking only `value` stays compatible — the extra arg is ignored. Pinned tooltips are copy-friendly: outside-dismissal keys off where the press _started_ (pointer-down outside the tooltip/chart, or Escape), so a text-selection drag that releases outside the tooltip doesn't dismiss it, and a click that completes a text selection inside a row doesn't fire `onRowClick`.
+- Touch devices are tap-driven (cartesian charts): a tap on a data point reveals its tooltip — pinned when `config.tooltip.pinnable`, so its rows are tappable for `onRowClick` drill-downs — a tap on a different point moves it there, and a tap on the point whose tooltip is already showing runs the click action (dismiss a pinned tooltip; fire `onPointClick` on non-pinnable charts). Tapping outside the chart, scrolling, or Escape dismisses. Mouse hover/click behavior is unchanged; the split lives in `useChartInteraction`, keyed off the pointerdown's `pointerType`.
- BarChart sets `TooltipContext.hoveredSeriesKey` — the key of the bar/segment under the cursor (stacked: the visible segment; grouped: the band-slot hit). Stacked `seriesData` keeps every segment in declaration order, so a custom tooltip that describes a single segment (e.g. a funnel breakdown) must select by `hoveredSeriesKey`, not `seriesData[0]`. It may reference a series hidden from `seriesData` via `visibility.tooltip: false` (e.g. a drop-off filler), and is `undefined` on other chart types and pinned rebuilds without a cursor.
- To tune the built-in tooltip **without writing a render prop**, put those same fields on `config.tooltip` (`{ enabled, pinnable, resolveClickToNearestSeries, placement, valueFormatter, labelFormatter, showTotal, totalLabel, totalFormatter, sortedByValue }`). When no `tooltip` render prop is supplied, the chart renders `DefaultTooltip` with them applied; a render prop, if given, owns content entirely and these are ignored. Prefer config for "format each row / add a total" cases (e.g. SQL insights pass per-column formatters this way) and reach for the render prop only for genuinely custom tooltip markup (e.g. adding a `footer` hint). `resolveClickToNearestSeries` (default false) changes what a click on a `pinnable` multi-series chart does: instead of always pinning first (letting the user then click a specific row), it resolves the series nearest the cursor and fires `onPointClick` for it directly — skip pinning only where a click's target series is visually unambiguous by position (e.g. funnel breakdown areas, one per breakdown value); leave it off where series overlap closely and a wrong guess is costly (e.g. trend lines).
- `ReferenceLine` variants: `goal` (dashed grey), `alert` (dashed red), `marker` (solid thin). A numeric line reveals its value on hover of the line itself (via a wider invisible hit area) or its label — appended as `label: value` when it has a label, shown alone when it doesn't — matching the legacy chart.js goal-line behavior.
diff --git a/packages/quill/packages/charts/src/core/chart-shell.tsx b/packages/quill/packages/charts/src/core/chart-shell.tsx
index 600ca1f71960..a46c3896608e 100644
--- a/packages/quill/packages/charts/src/core/chart-shell.tsx
+++ b/packages/quill/packages/charts/src/core/chart-shell.tsx
@@ -40,7 +40,7 @@ export interface ChartShellProps {
crosshair?: boolean
ariaLabel: string
handlers: Required<Pick<React.DOMAttributes<HTMLDivElement>, 'onMouseMove' | 'onMouseLeave' | 'onClick'>> &
- Pick<React.DOMAttributes<HTMLDivElement>, 'onMouseDown'>
+ Pick<React.DOMAttributes<HTMLDivElement>, 'onMouseDown' | 'onPointerDown'>
/** Render the overlay layer — bases gate this on layout readiness (dimensions + scales). */
showOverlay: boolean
children?: React.ReactNode
@@ -80,6 +80,7 @@ export function ChartShell({
onMouseMove={handlers.onMouseMove}
onMouseLeave={handlers.onMouseLeave}
onClick={handlers.onClick}
+ onPointerDown={handlers.onPointerDown}
>
<canvas ref={canvasRef} role="img" aria-label={ariaLabel} className={STATIC_CANVAS_CLASS} />
<canvas ref={overlayCanvasRef} aria-hidden="true" className={OVERLAY_CANVAS_CLASS} />
diff --git a/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
index b250d4927e51..7712db53a534 100644
--- a/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
+++ b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
@@ -42,18 +42,7 @@ function makeRefs(): { canvasRef: React.RefObject<HTMLCanvasElement>; wrapperRef
}
}
-function simulateMouseMove(
- handlers: { onMouseMove: (e: React.MouseEvent<HTMLDivElement>) => void },
- refs: ReturnType<typeof makeRefs>,
- clientX: number,
- clientY: number
-): void {
- const mockEvent = {
- clientX,
- clientY,
- currentTarget: refs.wrapperRef.current!,
- } as unknown as React.MouseEvent<HTMLDivElement>
- // Mock getBoundingClientRect on wrapper for the mouse move calculation
+function mockWrapperRect(refs: ReturnType<typeof makeRefs>): void {
refs.wrapperRef.current!.getBoundingClientRect = () =>
({
x: 0,
@@ -66,9 +55,48 @@ function simulateMouseMove(
left: 0,
toJSON: () => ({}),
}) as DOMRect
+}
+
+function simulateMouseMove(
+ handlers: { onMouseMove: (e: React.MouseEvent<HTMLDivElement>) => void },
+ refs: ReturnType<typeof makeRefs>,
+ clientX: number,
+ clientY: number
+): void {
+ const mockEvent = {
+ clientX,
+ clientY,
+ currentTarget: refs.wrapperRef.current!,
+ } as unknown as React.MouseEvent<HTMLDivElement>
+ // Mock getBoundingClientRect on wrapper for the mouse move calculation
+ mockWrapperRect(refs)
handlers.onMouseMove(mockEvent)
}
+/** A tap on a touch device: pointerdown (pointerType 'touch'), then a click with tap
+ * coordinates but no preceding mousemove, matching the browser's compatibility-event order. */
+function simulateTap(
+ result: { current: ReturnType<typeof useChartInteraction> },
+ refs: ReturnType<typeof makeRefs>,
+ clientX: number,
+ clientY: number
+): void {
+ mockWrapperRect(refs)
+ act(() => {
+ result.current.handlers.onPointerDown({
+ pointerType: 'touch',
+ } as unknown as React.PointerEvent<HTMLDivElement>)
+ })
+ act(() => {
+ result.current.handlers.onClick({
+ target: refs.wrapperRef.current!,
+ currentTarget: refs.wrapperRef.current!,
+ clientX,
+ clientY,
+ } as unknown as React.MouseEvent<HTMLDivElement>)
+ })
+}
+
function simulateClick(handlers: { onClick: (e: React.MouseEvent<HTMLDivElement>) => void }, target: Element): void {
handlers.onClick({ target } as unknown as React.MouseEvent<HTMLDivElement>)
}
@@ -475,6 +503,66 @@ describe('useChartInteraction — tooltip pinning', () => {
expect(result.current.tooltipCtx).toBe(initialCtx)
})
+ // Touch devices fire no mousemove before a tap, so these go through the click handler's
+ // touch path (index resolved from the click coordinates) rather than hover state.
+ it('touch tap with no prior hover shows a pinned tooltip at the tapped index', () => {
+ const { result } = renderInteraction()
+
+ simulateTap(result, refs, 200, 100)
+
+ expect(result.current.tooltipCtx?.dataIndex).toBe(1)
+ expect(result.current.tooltipCtx?.isPinned).toBe(true)
+ expect(result.current.hoverIndex).toBe(1)
+ })
+
+ it('second touch tap on the same point dismisses the pinned tooltip', () => {
+ const { result } = renderInteraction()
+
+ simulateTap(result, refs, 200, 100)
+ simulateTap(result, refs, 200, 100)
+
+ expect(result.current.tooltipCtx).toBeNull()
+ })
+
+ it('touch tap on another point moves the pinned tooltip there instead of dismissing', () => {
+ const { result } = renderInteraction()
+
+ simulateTap(result, refs, 200, 100)
+ simulateTap(result, refs, 300, 100)
+
+ expect(result.current.tooltipCtx?.dataIndex).toBe(2)
+ expect(result.current.tooltipCtx?.isPinned).toBe(true)
+ })
+
+ it('touch tap on a non-pinnable chart shows an unpinned tooltip, and a second tap fires onPointClick', () => {
+ const onPointClick = jest.fn()
+ const { result } = renderInteraction(false, onPointClick)
+
+ simulateTap(result, refs, 200, 100)
+ expect(result.current.tooltipCtx?.dataIndex).toBe(1)
+ expect(result.current.tooltipCtx?.isPinned).toBe(false)
+ expect(onPointClick).not.toHaveBeenCalled()
+
+ simulateTap(result, refs, 200, 100)
+ expect(onPointClick).toHaveBeenCalledTimes(1)
+ expect(onPointClick.mock.calls[0][0].dataIndex).toBe(1)
+ })
+
+ // Mirrors the mouse-click resolveClickToNearestSeries test above: a single tap on a
+ // pinnable, multi-series chart must resolve directly to the nearest series instead of
+ // pinning first, so touch users get the same one-tap drill-in mouse users get on a click.
+ it('a single touch tap fires onPointClick for the nearest series when resolveClickToNearestSeries is set', () => {
+ const onPointClick = jest.fn()
+ const { result } = renderInteraction(true, onPointClick, true)
+
+ // Tap at (200, 100) -> Tue column, closer to series 'a' (yPixel 180) than 'b' (yPixel 185).
+ simulateTap(result, refs, 200, 100)
+
+ expect(onPointClick).toHaveBeenCalledTimes(1)
+ expect(onPointClick.mock.calls[0][0].series.key).toBe('a')
+ expect(result.current.tooltipCtx?.isPinned).not.toBe(true)
+ })
+
it('clears the pinned tooltip when labels shrink so the pinned dataIndex no longer exists', () => {
const { rerender, result } = renderHook(
({ ls }: { ls: string[] }) =>
diff --git a/packages/quill/packages/charts/src/core/hooks/useChartInteraction.ts b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.ts
index 10de1fe4ee2d..bef563f481fe 100644
--- a/packages/quill/packages/charts/src/core/hooks/useChartInteraction.ts
+++ b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.ts
@@ -1,4 +1,4 @@
-import React, { useCallback, useMemo } from 'react'
+import React, { useCallback, useMemo, useRef } from 'react'
import { findClosestSeriesKey } from '../../overlays/tooltipUtils'
import {
@@ -107,6 +107,7 @@ interface UseChartInteractionResult<Meta> {
onMouseMove: (e: React.MouseEvent<HTMLDivElement>) => void
onMouseLeave: () => void
onClick: (e: React.MouseEvent<HTMLDivElement>) => void
+ onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void
}
}
@@ -183,7 +184,7 @@ export function useChartInteraction<Meta = unknown>({
]
)
- const { hoverIndex, hoverPosition, tooltipCtx, setHover, setTooltipCtx, isPinned, clearTooltip, pin } =
+ const { hoverIndex, hoverPosition, tooltipCtx, setHover, setTooltipCtx, isPinned, clearTooltip, pin, unpin } =
useTooltipLifecycle<Meta>({
wrapperRef,
rebuildPinnedCtx,
@@ -204,8 +205,7 @@ export function useChartInteraction<Meta = unknown>({
// Bind the committed scales into the 2D-brush callback so chart-type adapters can map the
// y pixel range onto their own bands (the core has no y-band concept).
const onAreaSelectWithScales = useMemo(
- () =>
- onAreaSelect && scales ? (data: AreaSelectData): void => onAreaSelect(data, scales) : undefined,
+ () => (onAreaSelect && scales ? (data: AreaSelectData): void => onAreaSelect(data, scales) : undefined),
[onAreaSelect, scales]
)
@@ -226,6 +226,59 @@ export function useChartInteraction<Meta = unknown>({
onDragActivate: clearTooltip,
})
+ // Cursor → data-index hit test, shared by mousemove hover and touch taps.
+ const resolveIndexAt = useCallback(
+ (x: number, y: number): number => {
+ if (!scales || !dimensions || !isInPlotArea(x, y, dimensions)) {
+ return -1
+ }
+ const probe = interactionAxis === 'y' ? y : x
+ const nearestIndex = findNearestIndexFromPositions(probe, labelPositions)
+ // Chart-type dead-zone veto (e.g. a funnel compare bar's blank volume gap): treat as
+ // no-hover so tooltip, pointer cursor, highlight, and click are all suppressed there.
+ return nearestIndex >= 0 && resolveHoverIndex
+ ? resolveHoverIndex(nearestIndex, { x, y }, scales)
+ : nearestIndex
+ },
+ [scales, dimensions, interactionAxis, labelPositions, resolveHoverIndex]
+ )
+
+ const buildCtxAt = useCallback(
+ (index: number, position: { x: number; y: number }): TooltipContext<Meta> | null => {
+ if (!scales) {
+ return null
+ }
+ const canvasBounds = canvasRef.current?.getBoundingClientRect() ?? new DOMRect()
+ return buildTooltipContext(
+ index,
+ series,
+ labels,
+ labelToCoord ?? scales.x,
+ scales.y,
+ canvasBounds,
+ resolveValue,
+ scales.yAxes,
+ interactionAxis,
+ position,
+ effectivePositionResolve,
+ resolveBottomValue,
+ scales.extent?.(labels[index]),
+ scales.bandSlotAtCursor?.(labels[index], position)
+ )
+ },
+ [
+ scales,
+ series,
+ labels,
+ labelToCoord,
+ canvasRef,
+ resolveValue,
+ interactionAxis,
+ effectivePositionResolve,
+ resolveBottomValue,
+ ]
+ )
+
const onMouseMove = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
if (!scales || !dimensions) {
@@ -245,19 +298,7 @@ export function useChartInteraction<Meta = unknown>({
return
}
- if (!isInPlotArea(mouseX, mouseY, dimensions)) {
- clearTooltip()
- return
- }
-
- const probe = interactionAxis === 'y' ? mouseY : mouseX
- const nearestIndex = findNearestIndexFromPositions(probe, labelPositions)
- // Chart-type dead-zone veto (e.g. a funnel compare bar's blank volume gap): treat as
- // no-hover so tooltip, pointer cursor, highlight, and click are all suppressed there.
- const index =
- nearestIndex >= 0 && resolveHoverIndex
- ? resolveHoverIndex(nearestIndex, { x: mouseX, y: mouseY }, scales)
- : nearestIndex
+ const index = resolveIndexAt(mouseX, mouseY)
if (index < 0) {
clearTooltip()
return
@@ -265,47 +306,21 @@ export function useChartInteraction<Meta = unknown>({
setHover(index, { x: mouseX, y: mouseY })
if (showTooltip) {
- const canvasBounds = canvasRef.current?.getBoundingClientRect() ?? new DOMRect()
// Always propagate the result (including null) so tooltipCtx stays in sync with hoverIndex.
- setTooltipCtx(
- buildTooltipContext(
- index,
- series,
- labels,
- labelToCoord ?? scales.x,
- scales.y,
- canvasBounds,
- resolveValue,
- scales.yAxes,
- interactionAxis,
- { x: mouseX, y: mouseY },
- effectivePositionResolve,
- resolveBottomValue,
- scales.extent?.(labels[index]),
- scales.bandSlotAtCursor?.(labels[index], { x: mouseX, y: mouseY })
- )
- )
+ setTooltipCtx(buildCtxAt(index, { x: mouseX, y: mouseY }))
}
},
[
scales,
dimensions,
- labels,
- series,
showTooltip,
- resolveValue,
- effectivePositionResolve,
- canvasRef,
isPinned,
clearTooltip,
handleDragMouseMove,
- labelPositions,
- labelToCoord,
- interactionAxis,
setHover,
setTooltipCtx,
- resolveBottomValue,
- resolveHoverIndex,
+ resolveIndexAt,
+ buildCtxAt,
]
)
@@ -316,6 +331,25 @@ export function useChartInteraction<Meta = unknown>({
clearTooltip()
}, [isPinned, clearTooltip])
+ // Touch support state. Touch devices fire no mousemove before a tap, so hover state is
+ // absent (or stale) when the tap's click arrives; the click handler must resolve the tapped
+ // point itself. `lastPointerTypeRef` tells it whether the click came from a touch, and
+ // `tapDownTooltipIndexRef` records which point's tooltip was showing when the gesture
+ // started. Both are captured at pointerdown because a tap's compatibility mouse events
+ // (mouseover/mousemove/mousedown) fire after pointerup, which means by click time the
+ // tooltip state may already reflect this very tap.
+ const tooltipCtxRef = useLatest(tooltipCtx)
+ const lastPointerTypeRef = useRef<string>('mouse')
+ const tapDownTooltipIndexRef = useRef<number>(-1)
+
+ const onPointerDown = useCallback(
+ (e: React.PointerEvent<HTMLDivElement>) => {
+ lastPointerTypeRef.current = e.pointerType
+ tapDownTooltipIndexRef.current = tooltipCtxRef.current?.dataIndex ?? -1
+ },
+ [tooltipCtxRef]
+ )
+
const onClick = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
if (originatesInTooltip(e)) {
@@ -325,7 +359,58 @@ export function useChartInteraction<Meta = unknown>({
if (shouldSwallowClick()) {
return
}
- const currentIndex = hoverIndexRef.current
+
+ let currentIndex = hoverIndexRef.current
+ let clickPosition = hoverPositionRef.current
+
+ if (lastPointerTypeRef.current === 'touch') {
+ const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
+ const position = { x: e.clientX - rect.left, y: e.clientY - rect.top }
+ const index = resolveIndexAt(position.x, position.y)
+ if (index < 0) {
+ clearTooltip()
+ return
+ }
+ // First tap on a point reveals its tooltip instead of acting on it, mirroring the
+ // desktop hover-then-click sequence. Pinned when the chart allows it, so the
+ // tooltip's rows are tappable and it survives until an outside tap or Escape.
+ // Only a tap on the point whose tooltip was already showing when the gesture
+ // started falls through to the click action below (dismiss the pin, or drill in).
+ if (index !== tapDownTooltipIndexRef.current) {
+ setHover(index, position)
+ if (showTooltip) {
+ const ctx = buildCtxAt(index, position)
+ // Mirror the mouse path: an unambiguous nearest-series tap fires the click
+ // action directly instead of pinning first, so touch users get the same
+ // one-tap drill-in mouse users get on a single click.
+ if (
+ ctx &&
+ pinnable &&
+ resolveClickToNearestSeries &&
+ onPointClick &&
+ ctx.seriesData.length > 1
+ ) {
+ const clickData = resolveNearestSeriesClickData(
+ index,
+ series,
+ labels,
+ ctx,
+ interactionAxis,
+ position
+ )
+ if (clickData) {
+ onPointClick(wrapClickData && scales ? wrapClickData(clickData, scales) : clickData)
+ return
+ }
+ }
+ setTooltipCtx(ctx && pinnable ? { ...ctx, isPinned: true, onUnpin: unpin } : ctx)
+ return
+ }
+ }
+ currentIndex = index
+ clickPosition = position
+ }
+
if (currentIndex < 0) {
return
}
@@ -342,14 +427,14 @@ export function useChartInteraction<Meta = unknown>({
if (pinnable && tooltipCtx && tooltipCtx.seriesData.length > 1) {
// Opt-in: a click nearer one series than the others is unambiguous, so resolve it
// and fire onPointClick directly instead of making the user pin then pick a row.
- if (resolveClickToNearestSeries && onPointClick && hoverPositionRef.current) {
+ if (resolveClickToNearestSeries && onPointClick && clickPosition) {
const clickData = resolveNearestSeriesClickData(
currentIndex,
series,
labels,
tooltipCtx,
interactionAxis,
- hoverPositionRef.current
+ clickPosition
)
if (clickData) {
onPointClick(wrapClickData && scales ? wrapClickData(clickData, scales) : clickData)
@@ -361,13 +446,7 @@ export function useChartInteraction<Meta = unknown>({
}
if (onPointClick) {
- const clickData = buildPointClickData(
- currentIndex,
- series,
- labels,
- resolveValue,
- hoverPositionRef.current
- )
+ const clickData = buildPointClickData(currentIndex, series, labels, resolveValue, clickPosition)
if (clickData) {
onPointClick(wrapClickData && scales ? wrapClickData(clickData, scales) : clickData)
}
@@ -385,11 +464,17 @@ export function useChartInteraction<Meta = unknown>({
isPinned,
clearTooltip,
pin,
+ unpin,
shouldSwallowClick,
hoverIndexRef,
hoverPositionRef,
wrapClickData,
scales,
+ showTooltip,
+ resolveIndexAt,
+ buildCtxAt,
+ setHover,
+ setTooltipCtx,
]
)
@@ -404,8 +489,8 @@ export function useChartInteraction<Meta = unknown>({
)
const handlers = useMemo(
- () => ({ onMouseDown: guardedMouseDown, onMouseMove, onMouseLeave, onClick }),
- [guardedMouseDown, onMouseMove, onMouseLeave, onClick]
+ () => ({ onMouseDown: guardedMouseDown, onMouseMove, onMouseLeave, onClick, onPointerDown }),
+ [guardedMouseDown, onMouseMove, onMouseLeave, onClick, onPointerDown]
)
return { hoverIndex, hoverPosition, tooltipCtx, dragRect, handlers }