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

1
Cchandanagandla
Last edited Apr 8, 2023
Created on Apr 8, 2023

This interactive line chart displays global population trends over time for different regions, with lines colored by region and a vertical black line marking the currently selected year. Users can move the mouse across the chart to change the selected year, which updates the line position and triggers a re-render. The visualization uses d3 v5, including `scaleTime`, `scaleLinear`, `axisBottom`, `axisLeft`, `line`, and `curveBasis` to draw the axes and paths, with `nest` and `schemeCategory10` for grouping and coloring regions. Data is loaded from UN population estimates CSV files, processed by melting year columns into rows, and rendered using SVG with a custom line chart component that handles the mouse interaction via `on('mousemove')`.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed