Skip to main content
100%

Selecting a Year on a Line Chart

✓ Published0🌍 Public
HHe Jianfeng
Last edited Apr 16, 2021
Created on Apr 16, 2021

This visualization shows population trends over time for world regions, with a vertical black line marking the currently selected year. Moving the mouse across the chart updates the selected year and repositions the line. The code uses D3 v6 with SVG rendering, employing `scaleTime`, `scaleLinear`, `line` with `curveBasis`, and `axisBottom`/`axisLeft` for axes. Data comes from UN population estimates CSV files, melted into tidy format for visualization. The color legend is built with a custom `colorLegend` function using `scaleOrdinal` and `schemeCategory10`.

AI-generated description
MIT Licensed

Similar vizzes