“A — Life Expectancy (Loader)”
This example demonstrates a minimal data loader for global life expectancy data from Our World in Data (UN WPP 2024), using a subset of years from 2000 onward. The visualization shows the first five parsed rows in a simple HTML display, confirming that the CSV data has been loaded and formatted correctly. The code uses D3 v7’s `d3.csvParse` to convert raw text into objects with categorical, time, and quantitative attributes, and employs `d3.select` to manage the container. It serves as a foundation for future visualizations, with a clear separation between data loading and rendering logic.
AI-generated descriptionDataset A — Global Life Expectancy (UN WPP via Our World in Data)
Source: Our World in Data – Life Expectancy (UN
WPP 2024)
Link: https://ourworldindata.org/grapher/life-expectancy-unwpp
What it is: Country-by-year life expectancy derived from the UN World Population Prospects 2024 release.
Local data note: To stay under VizHub’s free 0.5 MB limit, this project uses a subset:
- Years 2000 and newer
- Renamed the life expectancy column to
life_expectancyfor simpler code
Columns & attribute types (VAD):
Entity— categorical (country/area name)Code— categorical (ISO3)Year— time (treated as integer year; ordered)life_expectancy— quantitative (years; ratio)
Why this dataset: clean, real, and easy to scale later (filter by country, compare trends, etc.).