function draw(context, p) {
context.clearRect(0, 0, width, height);
context.save();
context.beginPath();
delaunay.render(context);
context.strokeStyle = "#ccc";
context.stroke();
context.restore();
context.save();
context.beginPath();
for (let i = 0; i < data.length; i++) {
const cx = x(data[i][xDim]);
const cy = y(data[i][yDim]);
context.moveTo(cx + 1.5, cy);
context.arc(cx, cy, 1.5, 0, 2 * Math.PI);
}
context.fill();
if (p > -1) {
context.beginPath();
const cx = x(data[p][xDim]);
const cy = y(data[p][yDim]);
context.moveTo(cx + 6, cy);
context.arc(cx, cy, 6, 0, 2 * Math.PI);
context.fillStyle = "red";
context.fill();
context.fillStyle = "black";
context.fillText(data[p].name, 10, 10);
}
context.restore();
}