D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
mforando
Full window
Github gist
SwoopyArrowTest
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } .swoopyArrow{ fill:none; stroke:black; } </style> </head> <svg> <marker id="arrowhead" viewBox="-10 -10 20 20" refX="0" refY="0" markerWidth="20" markerHeight="20" stroke-width="1" orient="auto"><polyline stroke-linejoin="bevel" points="-6.75,-6.75 0,0 -6.75,6.75"></polyline></marker> </svg> <script src="SwoopyArrow.js"></script> <body> <script> //https://github.com/bizweekgraphics/swoopyarrows var svg = d3.select("svg") .attr("width", 500) .attr("height", 500) .style("outline","1px solid black") .style("margin","50px") svg.append("circle") .attr("cy", 200) .attr("cx", 120) .attr("r",5) .style("fill","black") .attr("font-size", 36) .attr("font-family", "monospace") var swoopy = swoopyArrow() .angle(Math.PI/2) .x(function(d) { return d[0]; }) .y(function(d) { return d[1]; }); svg.append("path") .attr("class","swoopyArrow") .attr('marker-end', 'url(#arrowhead)') .datum([[250,200],[130,205]]) .attr("d", swoopy); </script> </body>
https://d3js.org/d3.v4.min.js