Skip to main content
100%

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

✓ Published1🌍 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
MIT Licensed

Similar vizzes