Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Selecting a Year on a Line Chart

Public visualization

Viewing a saved revision (read-only)

a65709e435794d8a9b4c343b423299ac

Fork of Selecting a Year on a Line Chart

0 stars0🌍 Public
DDonald Bagwell
Last edited Dec 20, 2023
Created on Dec 20, 2023

A fork of the "Selecting a Year on a Line Chart" example visualizes regional population changes over time from UN estimates and medium-variant projections. It displays multiple smoothed line paths, colored by region via `d3.scaleOrdinal` and `d3.schemeCategory10`, with a vertical black line marking a selected year. Users can drag the mouse over the chart to update the year, triggering a re-render that snaps the line to that date using `d3.mouse` and `d3.scaleTime.invert`. The SVG rendering uses d3.v5 and modular functions like `lineChart` and `colorLegend` for axes and legends.

AI-generated description