Unemployment rate by EU countries.
In this example, data is retrieved from Eurostat in the JSON-stat format, processed with the JSON-stat Javascript Toolkit and visualized with Idescat Visual.
For a similar example, see EU vs Germany.
Unemployment rate by EU countries.
In this example, data is retrieved from Eurostat in the JSON-stat format, processed with the JSON-stat Javascript Toolkit and visualized with Idescat Visual.
For a similar example, see EU vs Germany.
<!DOCTYPE html> | |
<!--[if lt IE 7]><html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]><html class="lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]><html class="lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html> <!--<![endif]--> | |
<head> | |
<title>Eurostat JSON-stat API + Idescat Visual choropleth map example</title> | |
<!-- DO NOT DO THIS IN PRODUCTION --> | |
<!-- js.org and json-stat.org ARE NOT CDNs --> | |
<link href="https://visual.js.org/visual.css" rel="stylesheet" type="text/css" /> | |
<script src="https://visual.js.org/lazyvisualsetup.js"></script> | |
<!-- /DO NOT DO THIS IN PRODUCTION --> | |
<script src="https://unpkg.com/jsonstat-toolkit@1.4.2"></script> | |
</head> | |
<body> | |
<div id="visual" class="visual"></div> | |
<script> | |
//Unemployment rate (dataset tesem120) | |
JSONstat("https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/tesem120?sex=T&age=Y15-74&unit=PC_ACT&lang=EN").then(function(j){ | |
//1. Get info | |
var | |
//Select the only dataset available in the bundle | |
ds=j.Dataset(0), | |
t=ds.Dimension("time"), | |
//Get time id & label for the latest time available | |
last=t.id[t.length-1], | |
time=t.Category(last).label, | |
//Get countries IDs | |
countries=ds.Dimension( "geo" ).id, | |
//Get the values for the selected time | |
//for all the countries (free dimension). | |
//Then transform info to the Visual data format | |
data=ds.Data( { "time": last } ).map( function( e, i ){ | |
return { id: countries[i], val: e.value }; | |
}) | |
; | |
//2. Draw map with retrieved and transformed info | |
visual( | |
{ | |
lang: "en", | |
title: "Unemployment rate", | |
time: time, | |
geo: "European Union", | |
footer: "Source: Eurostat (dataset tesem120).", | |
unit: { symbol: "%" }, | |
dec: 1, | |
legend: false, | |
type: "cmap", | |
by: "eu27", | |
data: data | |
} | |
); | |
}); | |
</script> | |
</body> | |
</html> |