Skip to main content
100%

d3 point locator

✓ Published0🌍 Public
SSoumyaranjan Pal
Last edited Feb 6, 2023
Created on Feb 6, 2023
Forked from HTML Starter

This example demonstrates how to locate the y-coordinate of a point on a smoothed curve for a given x-value, using a bisection algorithm on the SVG path element. It generates a random walk dataset of 50 points, renders it as a smooth line using d3.line with the “curveBasis” interpolation, and then for each data point, finds the corresponding y-value on the rendered path by repeatedly sampling path.getPointAtLength. The code uses d3.select, d3.scaleLinear, and d3.line to create the visualization.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes