Skip to main content
Public

Share visualization

Loading preview…

Minimal Reusable Charts Pattern + React

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

Minimal Reusable Charts Pattern + React

0
DDasbach.EJ
Last edited May 5, 2021
Created on May 5, 2021

This example demonstrates the Minimal Reusable Charts pattern, rendering an interactive scatter plot of the Iris Dataset with D3.js and React. The chart displays sepal length and width measurements as circles, using `d3.scaleLinear` for coordinate mapping and `d3.extent` for domain calculation. The reusable chart function `scatterPlot()` exposes setter methods for data, dimensions, and accessor functions, which are invoked via `g.call(plot)`. Data loads asynchronously from a CSV URL using `d3.csv`, and the SVG output fills the browser viewport.

AI-generated description

A minimal scatter plot of the Iris Dataset using an adaptation of Towards Reusable Charts.

Comments

Sign in to join the discussion.

ISC Licensed