Commit 8f64897c authored by Mike Bostock's avatar Mike Bostock
Browse files


parent 0d6471da
......@@ -561,9 +561,24 @@ better object and array interpolation…
## [Paths (d3-path)](
The [d3.path]( serializer implements the [CanvasPathMethods API](, allowing you to write code that can render to either Canvas or SVG. For example, given some code that draws to a canvas:
function drawCircle(context, radius) {
context.moveTo(radius, 0);
context.arc(0, 0, radius, 0, 2 * Math.PI);
You can render to SVG as follows:
var context = d3.path();
drawCircle(context, 40);
pathElement.setAttribute("d", context.toString());
This is a new repository that provides an implementation of the CanvasPathMethods API, allowing you to write code once that can render to either Canvas or SVG. It’s used by d3-shape and d3-chord.
The path serializer enables [d3-shape](#shapes-d3-shape) to support both Canvas and SVG; see [*line*.context]( and [*area*.context](, for example.
## [Polygons (d3-polygon)](
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment