Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

[02] Curved Line Chart - Using React Hooks with D3

Public visualization

Viewing a saved revision (read-only)

6b442445383f48ba93bbb7d79463cb5a

[02] Curved Line Chart - Using React Hooks with D3

0 stars1🌍 Public
Ggjonor
Last edited Feb 22, 2020
Created on Feb 18, 2020

This example demonstrates a curved line chart rendered as an SVG, where a dataset of numeric values is mapped to a path using D3’s `line` generator with the `curveCardinal` interpolation. The chart initializes with twenty points, and two buttons trigger updates: one increases every value by 5, while the other filters out values below 35, causing the line to redraw dynamically. React hooks (`useRef`, `useEffect`, `useState`) manage the SVG element and data state, while D3’s `select` and `path` joins handle the visual update. The viewport is set to 940 by 450 pixels, with a yellow fill and blue stroke.

AI-generated description

2020-w08-2

Tutorials by The Muratorium:

Using React (Hooks) with D3

  • Curved Line Chart