block by hwangmoretime 06af5f439f24bf28aec0

Point Tracking for Non-Linear Lines: I

Full Screen

What This Shows

Using data from the US Census, this visualization displays popular names that have historically been androgynous.

Technical

Control points are not intersected by the path for several non-linear interpolations for lines (“basis” in this case). Because of this, point tracking for non-linear lines should be calculated from the svg-path rather than from the d3-scales. Mike Bostock has two examples showing how to do this with a single path. This gist shows one approach for point tracking with multiple paths. Other approaches are shown here and here.

This approach uses a combination of precomputed voronoi tessellations and on-the-fly closestPoint to determine which line and point to highlight. The voronoi tessellations determine the line, which the on-the-fly closestPoint determines the point. Notedly, the voronoi tessellations are computed using the coordinates producted by the linear scale, rather than the non-linear scale (“basis” here). For this visualization, incorrect line selection does not occur as a result of this under-the-hood inaccuracy. YMMV.

index.html

steady_andro.csv