Line Drawing
✓ Published0🌍 Public
Mmbostock
Last edited Jul 5, 2019
Created on May 19, 2015
This example demonstrates freehand line drawing through mouse drag interaction. A user presses and holds to create a smooth, flowing path rendered as an SVG stroke on a white canvas. The interaction is built using `d3.drag` to capture pointer events, while `d3.line` with the `d3.curveBasis` curve generates the smooth B-spline path through the collected points. The path elements are appended directly to the SVG container, and the code styles them with a black, three-pixel-wide stroke for a clear visual result.
AI-generated descriptionDrag to draw a line!
gpl-3.0 Licensed