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)

932c14ef7ea54ad7b0229b21e9d55681

Fork of Selecting a Year on a Line Chart

0 stars0🌍 Public
PPiotr Paszek
Last edited Feb 12, 2022
Created on Feb 12, 2022

This interactive line chart displays population trends over time for global regions, with a movable vertical line that lets users select a specific year. Hovering over the chart triggers the `setSelectedYear` function, which updates the selected year and redraws the visualization. The chart uses `d3.line` with `curveBasis` for smooth paths, `d3.scaleTime` and `d3.scaleLinear` for axes, and `d3.nest` to group data by region. A color legend built with `d3.scaleOrdinal` and `schemeCategory10` identifies each line. Population data comes from UN estimates merged with medium variant projections, rendered as SVG.

AI-generated description