comparisonChart = {
const svg = d3.select(DOM.svg(dimens.width, dimens.height))
.style("width", dimens.width)
.style("height", dimens.height)
.style("font", "10px sans-serif");
let verticalOffset = dimens.marginTop;
const monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
for (let month of ['3', '4']) {
let xOffset = dimens.marginLeft;
addLabel(svg, xOffset-(dimens.marginLeft*0.5), verticalOffset, monthNames[parseInt(month)-1]+" 2020")
addLabel(svg, xOffset-(dimens.marginLeft*0.5)+440, verticalOffset, monthNames[parseInt(month)-1]+" 2021")
verticalOffset += 40
for (let day of [...Array((month=='3') ? 31 : 30).keys()]) {
const dayData = dataByYearMonth.get('20').get(month).get((day+1).toString());
addChart(svg, xOffset+((day%7)*dimens.chartWidth),
verticalOffset+(Math.floor(day/7)*dimens.chartWidth), dayData);
}
for (let day of [...Array((month=='3') ? 31 : 30).keys()]) {
const dayData = dataByYearMonth.get('21').get(month).get((day+1).toString());
addChart(svg, xOffset+440+((day%7)*dimens.chartWidth),
verticalOffset+(Math.floor(day/7)*dimens.chartWidth), dayData);
}
verticalOffset += 330;
}
return svg.node();
}