Skip to main content
Public

Share visualization

Loading preview…

Fork of Selecting a Year on a Line Chart

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Fork of Selecting a Year on a Line Chart

0
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

Comments

Sign in to join the discussion.

MIT Licensed