Reusable D3 scatterplot
✓ Published3🌍 Public
This example demonstrates a reusable scatterplot component built with D3 v7, plotting Iris flower measurements with petal width on the x-axis and sepal length on the y-axis. The code implements the reusable chart pattern by exposing setter functions like `.width()`, `.data()`, and `.radius()` to configure the component before rendering. It uses `d3.scaleLinear` for axes, `d3.extent` for domains, and `d3.axisLeft` and `d3.axisBottom` for ticks. The data is loaded from a CSV via `d3.csv` and rendered as SVG circles.
AI-generated descriptionExample Reusable scatterplot
https://www.youtube.com/watch?v=xkBheRZTkaw To 12:31
References
- towards reusable charts, idea is to make components dependend on d3
- see d3 margin convention https://observablehq.com/@d3/margin-convention
MIT Licensed