🌍 Public
Viewing a saved revision (read-only)
cbc1fd6522174235bfe4a65de3af65c8
Reusable D3 Scatter Plot
This example demonstrates a reusable scatter plot of the Iris dataset, mapping petal length on the x-axis and sepal length on the y-axis. It shows how to build a modular chart component using D3 v7. The code defines a `scatterPlot` factory function that returns a customizable object with `width` and `height` setters, which is then invoked via `svg.call()`. Data is loaded asynchronously with `d3.csv` and parsed into numeric values, while scales and axes are created using `d3.scaleLinear`, `d3.axisLeft`, and `d3.axisBottom`. The plot fills the browser window with SVG rendering.
AI-generated description