D3 Selecting a Year on a Line Chart
✓ Published0🌍 Public
An interactive line chart displays UN population estimates and projections from 1950 to 2100 for global regions, with a vertical line marking the currently selected year. Moving the mouse across the chart updates the selected year, repositioning the line and highlighting the population values at that moment. The visualization uses d3.line, d3.scaleTime, and d3.scaleLinear for rendering, with a mouse interceptor rectangle capturing pointer events and d3.mouse to convert pixel positions back into dates. A color legend encodes region identities, and the chart is built with SVG elements and D3's data-join pattern.
AI-generated descriptionMIT Licensed