Logging is easy. Anywhere you have an arrow function, just expand it and drop in a console.log()
.
.attr("data-month", d => {
console.log(d);
return d.month - 1
})
You could also log your scale values that way too. Since it’s all JS anyway, you can log from anywhere, like over the values of your scale functions or whatever. It’s just usually more informative in D3 to log from these implied loops over all your data.
As far as alignment goes, currently it looks like you have 12 month ticks, but 13 rows (or the bottom row is doubled, or is twice the height of the others).