Skip to main content
100%

Fork of Reusable D3 Scatter Plot

✓ Published1🌍 Public
YYash Raj Mathur
Last edited Mar 30, 2026
Created on Mar 30, 2026

This example shows a reusable scatter plot mapping study Hours on the x-axis against test Score on the y-axis, with five data points plotted as black circles. The visualization is built using D3 v6 modules including `scaleLinear`, `axisBottom`, `axisLeft`, and `extent`, all wrapped in a custom `scatterPlot` factory function that accepts configurable setters for width, height, data, and accessor functions. The SVG rendering includes labeled axes for Hours and Score, with margins and a fixed 800×500 canvas, while the page uses the Share Tech font from Google Fonts. The code demonstrates a modular pattern where `index.js` supplies a small hardcoded dataset and applies the reusable chart via `svg.call(plot)`.

AI-generated description
MIT Licensed

Similar vizzes