chart/tests/e2e
Chris Amow ab372832db Snap by x for the bar and y for the extreme, and stop the crosshair magnetting
Sweeping the cursor along the bottom of the chart rarely landed on a bar's low,
and often nowhere near the bar at all. The cause was a nearest-in-2D search I
added an hour earlier to make bars easier to hit when zoomed out: whichever bar
nearby had the lowest low won on total distance, so the dot skipped off the bar
under the cursor instead of tracing each low in turn. Reverted.

The rule is now written down rather than adjusted per complaint — x picks the
bar, y picks which of its extremes — and an e2e test asserts it by sweeping a
zoomed-out 1h chart and requiring every position to land on the low of the bar
beneath it. 115 of 115.

The crosshair is the other half of why this felt broken. Lightweight Charts
defaults to Magnet, which snaps it to the bar's close, so hovering beside a low
displayed a price several ticks from the one an anchor would use. Arming a tool
already switched to Normal, but the chart is read before a tool is armed, which
is when the misleading reading was being taken. Normal everywhere now.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 21:35:52 -05:00
..
chart.test.mjs Snap to the nearest extreme on screen, and add an e2e suite 2026-08-10 20:16:09 -05:00
comments.test.mjs Snap to the nearest extreme on screen, and add an e2e suite 2026-08-10 20:16:09 -05:00
helpers.mjs Snap to the nearest extreme on screen, and add an e2e suite 2026-08-10 20:16:09 -05:00
trendline.test.mjs Snap by x for the bar and y for the extreme, and stop the crosshair magnetting 2026-08-10 21:35:52 -05:00