Build a country comparison chart with matched years and clear units
Use a sourced four-country dataset to build a comparison chart, keep different units separate, and publish a table readers can explore.

A useful country comparison chart answers a specific question: which country has the largest population, how a rate differs, or how a measure changes over time. Start with a table that matches countries, years and definitions, then choose the visual—not the other way around.
This example compares population and life expectancy for Australia, Canada, the United Kingdom and the United States. Aim for one public table and two separate charts, not a single chart mixing people and years.
1. Prepare a same-year country table
Use one row per country for a single-year comparison. Keep country codes alongside readable names so later updates do not depend on spelling alone.
The following worked dataset uses 2024 World Bank World Development Indicators values. Population figures are unrounded; life expectancy is rounded to two decimal places for display. Those digits preserve source values, not a guarantee of measurement precision.
| Country | Country code | Year | Population (people) | Life expectancy at birth (years) |
|---|---|---|---|---|
| United States | USA | 2024 | 340003797 | 78.89 |
| United Kingdom | GBR | 2024 | 69281000 | 81.39 |
| Canada | CAN | 2024 | 41262329 | 82.11 |
| Australia | AUS | 2024 | 27194286 | 83.05 |
Sources: World Bank API results for 2024 population and 2024 life expectancy, retrieved October 28, 2026. Both responses identify October 8, 2026 as the dataset’s last update. This is a selected-country example, not a world ranking.
Keep two definitions with the published data:
- Population: the World Bank indicator counts residents regardless of citizenship or legal status and reports midyear estimates. Do not substitute an end-of-year population figure for just one country. Matching the indicator and year improves consistency, but national collection and estimation methods can still differ. Population definition and methodology
- Life expectancy at birth: the years a newborn would live if mortality patterns at birth remained unchanged. It is not the average age of people currently living in the country or an individual lifespan prediction. Life expectancy definition
For your own dataset, choose a common year with adequate coverage. If a country has no observation, leave its value blank and explain why. Do not silently replace it with another year or enter zero.
2. Give each measure its own chart
Population: a horizontal bar chart
Use country names as categories and population as the numeric series. For more readable labels, add a derived population_millions column by dividing Population (people) by 1,000,000.
Keep the original population column so readers can inspect the supplied values. Display the chart values to one decimal place: United States 340.0 million, United Kingdom 69.3 million, Canada 41.3 million and Australia 27.2 million.
Use this chart specification:
- Title: Population in four selected countries, 2024
- Numeric axis: Population (millions), starting at zero
- Order: United States, United Kingdom, Canada, Australia
- Labels: country name and displayed value
Sorting categories by value makes comparisons easier, as the ONS chart-ordering guidance explains. Keep a zero baseline: bar lengths cease to represent values proportionally when the lower portion is cut off. Why bars should start at zero
Life expectancy: a dot plot or separate bar chart
A dot plot can show the relatively small differences using position rather than bar length, an alternative suggested in the European data visualisation guidance. Use an explicitly labelled axis—for example, 75 to 85 years—and direct value labels. If your chart tool does not offer a suitable dot plot, use a separate zero-baseline bar chart and retain the precise table values.
Do not place population and life expectancy in adjacent bars on one numeric axis. Their units are incompatible. Nor should these two measures become an unexplained “best country” score: the dataset contains no weighting rule or overall assessment.
If the main task is comparing countries across both charts, keep the country order consistent between panels. If the task is ranking each measure separately, sort each chart by its own values and make that choice clear.
For other questions, the chart-type guide helps distinguish rankings, trends and relationships.
3. Publish the table with its context
Prepare a clean worksheet before export:
- Use one header row, without merged cells or decorative title rows.
- Keep numeric cells numeric; put units in headers rather than appending “million” or “years” to values.
- Use a unique country-code/year pair for each row.
- Include source references, indicator codes, definitions and retrieval dates in the public dataset or accompanying page text.
As of October 28, 2026, TablePage accepts CSV, TSV, XLSX and XLS uploads and generates a public dataset page with a filterable table and automatic charts. Upload only data intended for public access. The chart specifications above are design targets, not instructions for particular TablePage controls; use a separate charting tool if needed to produce them.
Treat generated charts as a first draft. Before sharing the link, check that the page has interpreted population and life expectancy as numbers, has not plotted country codes or the year as comparison measures, and has kept different units separate. Check every plotted value against the table and verify that source notes remain available to readers. Do not share a misleading generated chart simply because it was created automatically.
The finished page should let someone see the comparison quickly, inspect the underlying values and understand exactly what was compared. Use the table-and-chart workflow when both the visual pattern and the numeric detail matter.