Melting Data for Multiple Lines
✓ Published0🌍 Public
This example visualizes population over time by region, displaying multiple trend lines across a Cartesian coordinate system. The chart uses D3’s `nest` and `line` with `curveBasis` to structure and smooth the data, while `scaleTime`, `scaleLinear`, and `scaleOrdinal` manage the axes and color encoding. A color legend, generated by a custom `colorLegend` function, identifies each region. The data comes from UN population estimates and medium-variant projections, processed through a custom `melt` function that reshapes the dataset.
AI-generated descriptionMIT Licensed