Skip to main content
100%

Fork of Selecting a Year on a Line Chart

✓ Published0🌍 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
MIT Licensed

Similar vizzes