Life expectancy, GDP per person and population in 12 large economies
Japan has the longest life expectancy of the 12. Heatmap cells shade life expectancy and bar cells draw GDP per person in one table.
Life expectancy, GDP per person and population in 12 large economies. This chart is drawn in the browser.
{
"type": "table",
"data": [
{
"code": "JP",
"country": "Japan",
"population": 124516650,
"gdpPerCapita": 46107,
"lifeExpectancy": 83.6
},
{
"code": "FR",
"country": "France",
"population": 68372286,
"gdpPerCapita": 54799,
"lifeExpectancy": 82.4
},
{
"code": "CA",
"country": "Canada",
"population": 40083484,
"gdpPerCapita": 58321,
"lifeExpectancy": 82.2
},
{
"code": "KR",
"country": "South Korea",
"population": 51712619,
"gdpPerCapita": 55071,
"lifeExpectancy": 81.9
},
{
"code": "GB",
"country": "United Kingdom",
"population": 68492000,
"gdpPerCapita": 53139,
"lifeExpectancy": 81.4
},
{
"code": "DE",
"country": "Germany",
"population": 83287273,
"gdpPerCapita": 63676,
"lifeExpectancy": 80.8
},
{
"code": "US",
"country": "United States",
"population": 336806231,
"gdpPerCapita": 75489,
"lifeExpectancy": 79.2
},
{
"code": "MX",
"country": "Mexico",
"population": 129739759,
"gdpPerCapita": 22040,
"lifeExpectancy": 76.9
},
{
"code": "CN",
"country": "China",
"population": 1410710000,
"gdpPerCapita": 23846,
"lifeExpectancy": 76.1
},
{
"code": "BR",
"country": "Brazil",
"population": 211140729,
"gdpPerCapita": 19652,
"lifeExpectancy": 75.3
},
{
"code": "ID",
"country": "Indonesia",
"population": 281190067,
"gdpPerCapita": 14470,
"lifeExpectancy": 69
},
{
"code": "IN",
"country": "India",
"population": 1438069596,
"gdpPerCapita": 9818,
"lifeExpectancy": 68.3
}
],
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
}import { DataTable } from "@opendata-ai/openchart-react";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = "\u0000demo-fold:0";
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
export function Example() {
return <DataTable spec={spec} />;
}
import { DataTable } from "@opendata-ai/openchart-react";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = [/* 12 rows, as in the Spec tab; Copy includes them */];
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
export function Example() {
return <DataTable spec={spec} />;
}
<script setup lang="ts">
import { DataTable } from "@opendata-ai/openchart-vue";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = "\u0000demo-fold:0";
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
</script>
<template>
<DataTable :spec="spec" />
</template>
<script setup lang="ts">
import { DataTable } from "@opendata-ai/openchart-vue";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = [/* 12 rows, as in the Spec tab; Copy includes them */];
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
</script>
<template>
<DataTable :spec="spec" />
</template>
<script lang="ts">
import { DataTable } from "@opendata-ai/openchart-svelte";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = "\u0000demo-fold:0";
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
</script>
<DataTable {spec} />
<script lang="ts">
import { DataTable } from "@opendata-ai/openchart-svelte";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = [/* 12 rows, as in the Spec tab; Copy includes them */];
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
</script>
<DataTable {spec} />
import { createTable } from "@opendata-ai/openchart-vanilla";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = "\u0000demo-fold:0";
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createTable(container, spec);
import { createTable } from "@opendata-ai/openchart-vanilla";
import type { TableSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = [/* 12 rows, as in the Spec tab; Copy includes them */];
const spec: TableSpec = {
data,
"type": "table",
"columns": [
{
"key": "country",
"label": "Country",
"sortable": true
},
{
"key": "lifeExpectancy",
"label": "Life expectancy (years)",
"format": ".1f",
"sortable": true,
"align": "right",
"heatmap": {
"palette": "blue"
}
},
{
"key": "gdpPerCapita",
"label": "GDP per person (PPP $)",
"format": "$,.0f",
"sortable": true,
"bar": {
"color": "#0e7490"
}
},
{
"key": "population",
"label": "Population",
"format": ",.0f",
"sortable": true,
"align": "right"
}
],
"sort": {
"column": "lifeExpectancy",
"direction": "desc"
},
"chrome": {
"title": "Japan has the longest life expectancy of these 12 countries, at 83.6 years",
"subtitle": "Life expectancy about 2021 (WHO), GDP per person at purchasing power parity about 2022 (OWID, World Bank) and population in 2023 (World Bank)"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createTable(container, spec);