viz = {
const ctx = DOM.context2d(width, height);
const path = d3.geoPath(null, ctx);
const container = html`<div class="canvas-container" style="position:relative;">
<style>
.canvas-container {
position: relative;
width: ${width}px;
height: ${height}px;
}
.canvas-container > svg,
.canvas-container > canvas {
position: absolute;
}
.canvas-container > canvas {
top: 0;
left: 0;
}
.canvas-container > svg {
display: inline-block;
top: 10px;
left: ${width / 2 - 100}px;
}
</style>
${legend({
color: colorScaleThreshold,
width: 200,
height: 45,
title: "Cumulative Coronavirus Cases",
tickFormat: ","
})}
${ctx.canvas}
${basemap}
</div>`;
ctx.clearRect(0, 0, width, height);
curData.forEach(d => {
const geojson = countyGeomLookUp.get(d.fips);
if (geojson) {
ctx.beginPath();
path(geojson);
ctx.lineWidth = 0;
ctx.fillStyle = colorScaleThreshold(d.cases);
ctx.fill();
}
});
return container;
}