Skip to main content
100%

Favorite tooltip (simple version) v7

✓ Published0🌍 Public
Dd3noob
Last edited Jun 19, 2021
Created on Jun 19, 2021

This example shows a simple line chart of stock closing prices over time, with a circular marker that tracks the mouse position along the x-axis to highlight the nearest data point. The tooltip itself is minimal—a blue circle that appears on mouseover and moves with the cursor, using a bisector to find the closest date. The visualization is built with D3 v7, using `d3.line`, `d3.scaleTime`, and `d3.scaleLinear` to render an SVG path and axes. Data comes from a CSV file parsed with `d3.csv`.

AI-generated description

This is a follow on from a simple line graph and is based on @mbostock's example here.

It impliments a simple tooltip which I find particularly neat. This implimentation is designed as a simple example which will be built on to create a slightly more complex example.

This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 7 of d3.js.

mit Licensed

Similar vizzes