Selecting a Year on a Line Chart
This interactive line chart visualizes population trends over time by region, with a focus on a selected year. The visualization displays multiple region lines and a movable vertical line; as the user moves the mouse across the chart, the selected year is updated and crosshairs track the cursor. Data is sourced from UN population estimates, and the chart is built with D3 v5, specifically using `scaleTime`, `scaleLinear`, `axisBottom`, `axisLeft`, and `curveBasis`. The rendering uses SVG and includes a color legend. Interaction is handled via an overlay rectangle’s `mousemove` event, which inverts the D3 scales to update the selection.