Plot.plot({
width: width,
grid: true,
y: { label: 'month of the year', domain: months_short },
x: { label: 'hour of the day', ticks: 23, tickFormat: '%H:%M' },
y: { label: 'month of the year', ticks: 12 },
fy: { label: 'years', scale: 'number' },
color: {
scheme: "BuRd"
},
height: 8000,
marginRight: 50,
marks: [
Plot.dot(data, {
x: d => dateToGeneric24Hour(d['ts']),
y: d => months_short[new Date(d['ts']).getUTCMonth()],
fy: d => new Date(d['ts']).getFullYear(),
channels: {name: 'track_name', artist: 'artist_name', time: d => clock_time(d['ts']) },
fill: (d) => top_artists.indexOf(d['artist_name']) != -1 ? artist_colors(d['artist_name']) : 'grey',
fillOpacity: 0.3,
}),
Plot.tip(data, Plot.pointer({
x: d => dateToGeneric24Hour(d['ts']),
y: d => months_short[new Date(d['ts']).getUTCMonth()],
fy: d => new Date(d['ts']).getFullYear(),
title: (d) => [d.track_name, d.artist_name].join("\n\n")
}))
]
})