From e749e283f9c1691ef7603e785bdd14c393f8e2ea Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Thu, 8 Jan 2015 16:32:46 +0000 Subject: split marker arrow definition into separate function --- html/js/git-deps-graph.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'html') 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); -- cgit