HollowBarY = (data, {x, target, actual} = {}) => {
data = data.map(d => ({...d, percent: maybeAccessor(actual)(d) / maybeAccessor(target)(d)}))
return [
Plot.barY(data, {x, y: actual, fill: actual, insetLeft: 0.5, insetRight: 0.5}),
Plot.barY(data, {x, y: target, stroke: "black", fill: "none"}),
Plot.text(data.filter(d => d.percent < 1), {
x,
y: actual,
text: d => pct(d.percent),
fill: "white",
dy: 12,
}),
Plot.text(data.filter(d => d.percent > 1), {
x,
y: actual,
text: d => pct(d.percent),
dy: -4
})
]
}