yvaralStyle = new g.Style({
drawFun: (cells, cg, r) => {
cells = cells.filter((c) => c.ind);
const ext = d3.extent(cells, (c) => +c.ind);
for (let c of cells) {
const xS = cg.geoToPixX(c.x + r / 2),
yS = cg.geoToPixY(c.y + r / 2),
d = Math.hypot(xS - cg.w / 2, yS - cg.h / 2),
ref = cg[cg.w > cg.h ? "w" : "h"] / 2,
dr = d / ref;
const sX = Math.sign(yS - cg.h / 2),
sY = Math.sign(xS - cg.w / 2),
idx = sX + (sY + 3) / 2,
mY = idx % 2,
mX = (idx > 1) | 0,
cx = c.x + r * mX,
cy = c.y + r * mY,
dx = (1 - 2 * mX) * r,
dy = (1 - 2 * mY) * r;
cg.ctx.beginPath();
cg.ctx.moveTo(cx, cy);
cg.ctx.lineTo(cx, cy + dy);
cg.ctx.lineTo(cx + dx, cy + dy);
cg.ctx.closePath();
cg.ctx.fillStyle = colorRampDarkPurple(dr);
cg.ctx.fill();
cg.ctx.beginPath();
cg.ctx.moveTo(cx, cy);
cg.ctx.lineTo(cx + dx, cy);
cg.ctx.lineTo(cx + dx, cy + dy);
cg.ctx.closePath();
cg.ctx.fillStyle = colorRampBrightPurple(dr);
cg.ctx.fill();
let t = (c.ind - ext[0]) / (ext[1] - ext[0]);
t = scale(t);
cg.ctx.fillStyle = colorRamp(t);
t = t * 0.8 + 0.1;
cg.ctx.fillRect(cx, cy, dx * t, dy * t);
}
}
})