D3 Selections (with lines)
✓ Published4🌍 Public
AAndrea Mignone
Last edited Apr 22, 2021
Created on Apr 22, 2021
This example demonstrates the difference between D3's `join` and `merge` operations by animating a dynamic set of circles and vertical lines. As the data count shifts with a sine wave, the `d3.select` API's `join` method incrementally updates the SVG elements, seamlessly adding or removing nodes. Circles are positioned and sized based on generated data, with a `d3.scaleLinear` color mapping from white to green applied to both the circle strokes and the lines descending from each circle to the chart's bottom. The animation runs at roughly 60 frames per second using `setInterval`.
AI-generated descriptionD3 Selections
join vs merge
MIT Licensed