Reusable D3 Scatter Plot
✓ Published0🌍 Public
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 descriptionMIT Licensed