map = {
let map = Plot.plot({
color: "#ddd",
width: 600,
height: 400,
projection: d3.geoMercator().fitExtent(
[
[0, 0],
[600, 400]
],
italy
),
marks: [
Plot.geo(italy, {
fill: "#eee",
stroke: "black"
}),
Plot.dot(cities, {
x: "lng",
y: "lat",
r: 5,
fill: "#cd212a",
stroke: "black",
title: "city"
})
]
});
let dots = d3.select(map).selectAll("circle");
dots
.each(function () {
let t = d3.select(this).select("title").text();
tippy(this, {
content: tip(t),
theme: "light-border",
allowHTML: true,
interactive: true,
appendTo: () => document.body
});
})
.selectAll("title")
.remove();
return map;
}