Created
September 17, 2017 13:28
-
-
Save duhaime/55bd42029556c69c5418b1fd810c7c07 to your computer and use it in GitHub Desktop.
Directed Graph Arrowhead
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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