Reusable D3 Scatterplot Idempotence
This example demonstrates a reusable D3 scatterplot that cycles through different Iris flower measurements every two seconds, smoothly updating the x-axis mapping while keeping the y-axis fixed. The scatterPlot function exports a configurable closure with getter-setter methods for width, height, data, scales, and margins, enabling idempotent re-invocation with new xValue functions. Using D3’s `selectAll` with `join` for circles and axes, the SVG transitions animate between petal width, sepal width, petal length, and sepal length coordinates, with the data loaded from a CSV and rendered as animated circles.