Skip to main content
100%

Fork of Reusable D3 Scatter Plot - Idempotence

✓ Published1🌍 Public
Ppawelsapiecha
Last edited Jan 2, 2023
Created on Jan 2, 2023

This example shows a reusable D3 scatter plot of the Iris dataset that cycles through different x-axis variables every two seconds. Each transition is idempotent—re-calling the same plot function produces the same outcome, so animations smoothly update the existing SVG circles and axes. The code uses `d3.csv` to load data, `d3.scaleLinear` and `d3.extent` for scales, and `d3.axisLeft`/`d3.axisBottom` for axes. It renders SVG with precomputed marks and leverages a setInterval to repeatedly invoke the chart’s `my()` function with a new `xValue`, demonstrating the reusable pattern in React.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes