Published
Edited
Feb 27, 2022
1 fork
8 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
eurostatmap = require("eurostat-map@3.3.5")
Insert cell
Insert cell
Insert cell
createSvg = function(id) {
return html`<svg id=${id}></svg>`;
}
Insert cell
Insert cell
Insert cell
eurostatmap
.map("ch") // ch = choropleth
.svgId("map1") // this will be the id of our svg
.nutsLvl(2)
.insets("default") // show overseas regions using the default styling
.classifMethod("threshold")
.threshold([50, 65, 70, 73, 80]) //the values of each class, the original map has 75 but 73 is more meaningful as it is the EU average
.colors(["#F45C19", "#F37E15", "#F79E0E", "#F9CB80", "#7799D6", "#3E6AB3"]) //the colours of each class

// here we define the eurostat dataset we want to use, and its filters.
// See https://github.com/eurostat/eurostat-map.js/blob/master/docs/reference.md#eurostat-database for more details
.stat({
eurostatDatasetCode: "lfst_r_lfe2emprtn",
filters: {
citizen: "TOTAL",
time: "2018",
unit: "PC",
isced11: "TOTAL",
age: "Y20-64"
},
unitText: "% of people aged 20-64 years"
})

//add a legend
.legend({
x: 10,
y: 180,
title: "%",
labelDecNb: 0
})

//add a title
.title("Employment rate, 2019")
.titleFontSize(20)

.build()
Insert cell
Insert cell
createSvg("map1")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
createSvg("map2")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
createSvg("map3")
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3-scale-chromatic")
Insert cell
Insert cell
Insert cell
createSvg("map4")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more