map = {
const canvas = d3
.create("canvas")
.attr("width", width)
.attr("height", height)
.node();
canvas.width = width;
canvas.height = height;
let ctx = canvas.getContext("2d");
scaleCanvas(canvas, ctx);
function draw() {
ctx.fillStyle = "rgba(5,5,5,1)";
ctx.fillRect(0, 0, width, height);
const path = d3.geoPath(projection, ctx);
ctx.save();
ctx.beginPath(),
path(land),
(ctx.strokeStyle = "rgba(255, 255, 255, 0.12)"),
ctx.stroke();
ctx.restore();
ctx.strokeWidth = 0.5;
ctx.save();
ctx.beginPath(),
path(hexbinGeoJSON),
(ctx.strokeStyle = "rgba(255, 0, 0, 1)"),
ctx.stroke();
ctx.restore();
slicedMonthlyData.forEach(d => {
if (!d.longitude || !d.latitude || !d) return false;
const loc = projection([d.longitude, d.latitude]);
if (!loc) return null;
const [x, y] = loc;
console.log(d, x, y);
ctx.fillStyle = "rgba(10, 220, 50, 0.75)";
ctx.fillRect(x, y, 2, 2);
});
ctx.strokeStyle = "transparent";
}
draw();
return canvas;
}