Axes with Hover
✓ Published4🌍 Public
This example displays a scatter plot with labeled axes and a hover interaction. Moving the cursor over the inner rectangle draws black crosshair lines from the pointer to the x- and y-axes, dynamically revealing the mouse coordinates. The visualization uses D3's scaleLinear for mapping data, axisBottom and axisLeft for tick marks, and a ResizeObserver for responsive sizing. Hover events are captured via d3.pointer, updating state to drive the lines. The example is a static 100x100 data range with no external dataset.
AI-generated descriptionAdding a hover effect to the inner rectangle to extend lines from the cursor to the axes.
Challenge
- Show the hovered numbers in place of tick marks on the axes themselves.
MIT Licensed