Skip to main content
Public

Share visualization

Loading preview…

Corey's Axes with Hover

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Corey's Axes with Hover

0
Ccoreyfnolan@gmail.com
Last edited Feb 12, 2024
Created on Feb 11, 2024

This example shows a scatter plot with labeled X and Y axes, where hovering over the inner plotting area triggers two red crosshair lines that track the mouse pointer. The visualization uses D3.js v7 with custom modular functions for drawing axes, axis labels, and hover interactions. The code employs `d3.scaleLinear` for scaling, `d3.axisBottom` and `d3.axisLeft` for ticks, and a `ResizeObserver` to make the chart responsive. The hover state is managed via `setState`, with pointer coordinates captured through D3's `pointer` event method.

AI-generated description

Adding labels to our X and Y axes with D3.

Comments

Sign in to join the discussion.

MIT Licensed