Skip to main content
100%

Melting Data for Multiple Lines

✓ Published2🌍 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
MIT Licensed

Similar vizzes