viewof summary = Plot.plot({
width: window.innerWidth,
height: 400,
color: { scheme: "Category10", legend: true },
x: {
label: "Year of build",
tickFormat: d => d.toString().replace(/,/g, '')
},
y: {
label: "Number of ships"
},
marks: [
Plot.rectY(
country_picker,
Plot.binX(
{ y: "distinct" },
{
x: "ship_build_period",
y: "id",
fill: "ship_country_build",
fill: "#e4066e",
tip: {
format: d => `Ship Build Period: ${d.x}\nNumber of Ships: ${d.y}\nCountry: ${d.fill}`
}
}
)
),
Plot.ruleY([0])
]
});