function drawFnSquares(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();
var cellWidth = (cellSize - 2 * padding) / 3;
var cellHeight = (cellSize - 2 * padding) / 2;
for (const rec of cell.records) {
const sizes = [];
for (const key of selected_variables) {
sizes.push(rec[key]);
}
for (var row = 0; row < 2; row++) {
for (var col = 0; col < 3; col++) {
var index = row * 3 + col;
var size = (sizes[index] / 100) * Math.min(cellWidth, cellHeight);
var centerX = col * cellWidth + cellWidth / 2 - size / 2;
var centerY = row * cellHeight + cellHeight / 2 - size / 2;
ctx.beginPath();
ctx.fillRect(
centerX + x - cellSize / 2 + padding,
centerY + y - cellSize / 2 + padding,
size,
size
);
ctx.fillStyle = colours[index];
ctx.fill();
ctx.lineWidth = 2;
ctx.strokeStyle = "black";
ctx.stroke();
}
}
}
}