How it works
The widget chains two classic components through one shared state. The chart half is magnetic snapping: as the finger drags horizontally, the touch point is converted into chart coordinates, the nearest data point wins, and the cursor line plus dot glide over with transform: translateX on a spring-flavored transition - the landing has a tiny overshoot that reads as the cursor being physically pulled onto the point. The counter half is an odometer: every digit position is a vertical strip holding 0 through 9 stacked top to bottom, and changing the value just slides each strip with translateY to the target digit's row over about 300 milliseconds. Thousands separators are static glyphs that never move.
The linkage is one integer: whichever index the cursor snaps to becomes the value the odometer rolls to. One subtle requirement makes or breaks it - inside SVG, the cursor must be moved with transform, never by writing attribute coordinates, because attribute changes cannot transition on the compositor and will jump instead of glide on mid-range phones.
How to use this prompt
Use it for any time series users scrub through point by point: steps, revenue, battery, heart rate. Send the prompt with your data array and value range so the AI generates the correct coordinate mapping. If you have dozens of points, add one sentence - snap by pixel distance threshold instead of nearest point - which keeps dragging feeling 1:1 with the finger even on dense data.
Tips for better results
The odometer only looks right if each strip's row height exactly equals the line height of the digits; half a pixel off shows as clipped steps mid-roll. When values jump by large amounts, cap how fast the highest digit spins or the leading digit becomes a blur that steals the show. Set the snap radius to half the gap between adjacent points for seamless full coverage. On touch devices, call setPointerCapture on pointerdown so dragging that slides off the chart keeps tracking until the finger lifts - without it the cursor freezes at the chart edge.