function createScatterplotView({
width = 600,
height = 340,
pointSize = 5,
pointColor = "#000000",
points = [[0, 0]],
backgroundColor = "#ffffff",
invalidation
} = {}) {
const canvas = document.createElement("canvas");
const scatterplot = createScatterplot({
canvas,
pointSize,
pointColor,
width,
height,
lassoOnLongPress: true,
backgroundColor,
showPointConnections: true,
pointConnectionSize: 2,
pointConnectionColor: "#FFFF00"
});
scatterplot.subscribe("select", ({ points }) => {
canvas.value = points;
canvas.dispatchEvent(new Event("input"));
});
scatterplot.draw(points);
invalidation?.then(() => scatterplot.destroy());
return canvas;
}