Skip to content

fix: track the finger directly when inspecting charts on touch - #237

Merged
starc007 merged 2 commits into
mainfrom
fix/chart-touch-tracking
Oct 27, 2026
Merged

starc007 merged 2 commits into
mainfrom
fix/chart-touch-tracking

Conversation

@starc007

Copy link
Copy Markdown
Owner

What

On touch screens, chart inspection marks now follow the finger directly instead of gliding behind it.

  • Line Chart: the crosshair, dots, axis pill and the dimming past the crosshair, plus the tooltip, which trailed on a deliberately softer spring.
  • Bar Chart: the category band.
  • Sparkline: the interactive readout dot.
  • Composition Chart: the crosshair.

Mouse and keyboard keep the glide, and data-change springs are untouched.

Why

Every inspection mark moved to the inspected sample on a spring. With a mouse that reads as smooth, but under a finger any glide reads as lag. This was reported on mobile for the line chart.

How

  • The shared xy inspector reports when a touch drag starts and ends (onTouchChange), and useInspection holds a touching flag.
  • While it's set, the line, bar and sparkline marks use an instant transition.
  • Composition Chart tracks the same flag locally in its plot.

Other charts checked

  • Price Target Fan: its scrub crosshair uses the stiff, critically damped handle spring (about 0.1s), commented as intentional for continuous scrubbing, so it's left as is.
  • Candlestick: the crosshair isn't animated.
  • The rest only fade or scale on inspect, or already follow the pointer.

Verification

  • bun run check passes, and bun test passes 190 accessibility tests.
  • Browser, 375px mobile emulation with simulated touch drags:
    • The line chart crosshair and tooltip sat at their final positions 40ms after each move.
    • The composition crosshair went straight from one column to the next with no in-between frames.
  • Desktop mouse still glides: 16 distinct crosshair positions over 400ms on Composition.
  • Not tested on a physical phone.
  • Composition Chart is already released, so its updatedAt is bumped and it has a changelog line. Line, Bar and Sparkline are still this week's new entries.

Inspection marks glided to each sample on springs, and the line chart
tooltip trailed on a softer follow spring. Under a finger that read as lag.
During a touch drag the line chart crosshair, dots, axis pill, receding
mask and tooltip, the bar chart band and the sparkline dot now track the
touch directly; mouse and keyboard keep the glide.
The crosshair glided between columns on a layout spring, which trailed a
touch drag. It now jumps to the column under the finger during a touch
drag; mouse and keyboard keep the glide.
@starc007
starc007 merged commit 01b4088 into main Oct 27, 2026
1 check passed
@starc007
starc007 deleted the fix/chart-touch-tracking branch October 27, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant