Skip to main content
Public

Share visualization

Loading preview…

Reusable plots

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Reusable plots

0
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.

Comments

Sign in to join the discussion.

MIT Licensed