countsPlot = (data, type = "linear") =>
addTooltips(
Plot.plot({
marks: [
Plot.barX(data, {
x: "value",
y: "type",
fill: "label",
fillOpacity: 0.6,
title: (d) => `${d.label}: ${d.value.toLocaleString()}`
})
],
color: {
scheme: "cividis"
},
label: "",
marginLeft: 70,
x: { ticks: 10, ticks: 5, type: type },
width
}),
{ stroke: "black", "stroke-width": "3px" }
)