Skip to content

Instantly share code, notes, and snippets.

@duhaime
Created September 17, 2017 13:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save duhaime/55bd42029556c69c5418b1fd810c7c07 to your computer and use it in GitHub Desktop.
Save duhaime/55bd42029556c69c5418b1fd810c7c07 to your computer and use it in GitHub Desktop.
Directed Graph Arrowhead
// Add svg marker for arrowheads
svg.append('svg:defs').append('svg:marker')
.attr('id', 'arrowhead')
.attr('viewBox', '0 0 10 10')
.attr('refX', 22)
.attr('refY', 5)
.attr('markerWidth', 9)
.attr('markerHeight', 9)
.attr('orient', 'auto')
.append('svg:path')
.attr('d', 'M5 0 L5 10 L10 5 Z')
.attr('fill', 'rgba(160,160,160,0.9)');
// Add the arrowhead to the link
link = link.enter().append('line')
.attr('class', 'link')
.attr('marker-end', 'url(#arrowhead)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment