Skip to main content
100%

Reusable plots

✓ Published0🌍 Public
AAmanullah007
Last edited Mar 27, 2022
Created on Mar 27, 2022

This example demonstrates how to build reusable chart components in React with D3. It visualizes the classic Iris dataset as a scatter plot, mapping petal length on the x-axis and sepal width on the y-axis, with circle radii fixed at 7 pixels. The code separates axes and marks into distinct React components—AxisBottom, AxisLeft, and Marks—which accept scales and dimensions as props for reuse. It uses d3.scaleLinear with extent-based domains, d3.csv for data loading, and renders SVG elements via React’s JSX syntax.

AI-generated description

A scatter plot of The Iris Dataset.

MIT Licensed

Similar vizzes