Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Melting Data for Multiple Lines

Public visualization

Melting Data for Multiple Lines

0 stars2🌍 Public
Yyoyo2050
Last edited Sep 28, 2019
Created on Sep 28, 2019

This example visualizes population over time by region, showing multiple lines that trace changes from 1950 to 2100. It uses D3 v5 with SVG rendering, employing `scaleTime`, `scaleLinear`, and `scaleOrdinal` for scales. The code melts wide-format UN population data into tidy rows using a custom `melt` function, then nests it with `d3.nest()` to generate paths via `d3.line()`. A color legend and gridlines are added, with data sourced from UN population estimates and medium-variant projections.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed