viewof plot = addTooltips(
Plot.plot({
height: 200,
width: 1000,
y: {
label: null
},
color: { range: ["#6699CC", "#B3CCE6"], domain: ["studies", "work"], type: "categorical"},
marks: [
Plot.barX(tasks, {
x1: (d) => parser(d.startDate),
x2: (d) => parser(d.endDate),
y: "type",
fill: "type",
stroke: "black",
strokeDasharray: 1,
strokeOpacity: 0.5,
title: (d) =>
`${d.name}\n${d.what}\nStart: ${d.startDate}\nEnd: ${d.endDate}`
}),
Plot.image(tasks, {
x: (d) => new Date((parser(d.endDate).getTime() + parser(d.startDate).getTime()) / 2),
y: (d) => d.type,
width: d => d.logoWidth || 60,
src: "logoUrl",
title: (d) =>
`${d.name}\n${d.what}\nStart: ${d.startDate}\nEnd: ${d.endDate}`
})
]
})
)