diff options
author | Adam Spiers <git@adamspiers.org> | 2015-01-08 16:32:46 +0000 |
---|---|---|
committer | Adam Spiers <git@adamspiers.org> | 2015-01-08 16:35:49 +0000 |
commit | e749e283f9c1691ef7603e785bdd14c393f8e2ea (patch) | |
tree | 1f46cd409a174ee57a9fb68f4e1de85f1bdad5f0 /html | |
parent | d214a9c49be983d5fdea983235c3879c5af473c1 (diff) | |
download | git-deps-e749e283f9c1691ef7603e785bdd14c393f8e2ea.tar.gz |
split marker arrow definition into separate function
Diffstat (limited to 'html')
-rw-r--r-- | html/js/git-deps-graph.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/html/js/git-deps-graph.js b/html/js/git-deps-graph.js index 45772f5..a50840b 100644 --- a/html/js/git-deps-graph.js +++ b/html/js/git-deps-graph.js @@ -161,17 +161,7 @@ function draw_graph(commitish) { .symmetricDiffLinkLengths(30); //.jaccardLinkLengths(100); - // define arrow markers for graph links - fg.append('svg:defs').append('svg:marker') - .attr('id', 'end-arrow') - .attr('viewBox', '0 -5 10 10') - .attr('refX', 6) - .attr('markerWidth', 8) - .attr('markerHeight', 8) - .attr('orient', 'auto') - .append('svg:path') - .attr('d', 'M0,-5L10,0L0,5') - .attr('fill', '#000'); + define_arrow_markers(fg); path = fg.selectAll(".link") .data(links, function (d) { @@ -192,6 +182,20 @@ function draw_graph(commitish) { }); } +function define_arrow_markers(fg) { + // define arrow markers for graph links + fg.append('svg:defs').append('svg:marker') + .attr('id', 'end-arrow') + .attr('viewBox', '0 -5 10 10') + .attr('refX', 6) + .attr('markerWidth', 8) + .attr('markerHeight', 8) + .attr('orient', 'auto') + .append('svg:path') + .attr('d', 'M0,-5L10,0L0,5') + .attr('fill', '#000'); +} + function draw_nodes(fg, node) { // Initialize tooltip tip = d3.tip().attr('class', 'd3-tip').html(tip_html); |