Skip to main content
100%

Selecting a Year on a Line Chart with D3.js!

✓ Published0🌍 Public
Fforcox43
Last edited Jul 22, 2020
Created on Jul 22, 2020

This example presents a line chart of global population estimates from 1950 to 2100, with lines colored by region. A vertical black line marks the selected year, and moving the mouse over the chart updates this line to the nearest year. The visualization is built with D3.js (v5) using the `select` API, `scaleTime`, `scaleLinear`, `axisLeft`, `axisBottom`, and `line` generators, with data loaded from CSV files. The line chart and color legend are implemented as reusable components (using `selection.enter` and `merge`) within a React framework, rendering to SVG.

AI-generated description

See also React Starter.

MIT Licensed

Similar vizzes