function interactiveDrawFn(mode) {
return function drawFn(cell, x, y, cellSize, ctx, global, panel) {
if (!cell) return;
const padding = 2;
var grid_long = cellSize - padding * 2;
var grid_wide = cellSize - padding * 2;
const boundary = cell.getBoundary(padding);
ctx.fillStyle = "#cccb";
ctx.beginPath();
ctx.moveTo(boundary[0][0], boundary[0][1]);
for (let i = 1; i < boundary.length; i++)
ctx.lineTo(boundary[i][0], boundary[i][1]);
ctx.closePath();
ctx.fill();
const newData = Object.fromEntries(
getKeys.map((key) => [key, cell.averages[key]])
);
const cleanedAvg = removeEmpty(newData);
if (mode == "Line Chart") {
drawLineChart(ctx, x, y, cellSize, cell.averages);
} else if (mode == "Heatmaps") {
drawHeatmapChart(ctx, x, y, cellSize, cell.averages);
} else if (mode == "Rose Chart") {
drawNightingaleRoseChart(
ctx,
x,
y,
cellSize,
cleanedAvg,
colours,
padding
);
}
};
}