Plot.plot({
marks: [
Plot.areaY(data, {
x: "date",
y: "unemployed",
fill: "industry"
}),
Plot.tip(
data,
Plot.pointerX(
Plot.binX(
{
y: () => 0,
title: (v) => v
},
{
x: "date",
y: "unemployed",
thresholds: 100,
render: (index, scales, values, dimensions, context) => {
const g = d3.select(context.ownerSVGElement).append("g");
const [i] = index;
if (i !== undefined) {
console.log(values, dimensions)
const data = values.title[i];
g.attr(
"transform",
`translate(${Math.min(
values.x1[i],
dimensions.width - dimensions.marginRight - 200
)}, 20)`
).append(() =>
Plot.plot({
marginTop: 14,
height: 85,
width: 195,
axis: null,
marks: [
Plot.text(data, {
y: "industry",
text: "industry",
frameAnchor: "left",
dx: 14
}),
]
})
);
}
return g.node();
}
}
)
)
),
Plot.ruleY([0])
]
})