Reusable D3 Scatterplot with Default Values
This reusable scatterplot displays the Iris dataset, plotting petal width against sepal length with points encoded by species and adjustable point size, chart title, and axis labels. Built as a reusable D3 chart following Mike Bostock’s “Towards Reusable Charts” convention, it exposes setter functions for width, height, data, xValue, yValue, size, symbolValue, margin, and labels. The code uses D3 v3 APIs like `scaleLinear`, `scaleOrdinal`, `symbol`, `axisLeft`, and `axisBottom`. Axis ranges extend 10% beyond data extremes, and all options except data fall back to defaults when unspecified.