aboutsummaryrefslogtreecommitdiffstats
path: root/html/js/git-deps-graph.js
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2015-01-06 18:21:24 +0000
committerAdam Spiers <git@adamspiers.org>2015-01-06 18:22:37 +0000
commitfec37fc3ca0e061dcc960cca9e8364b5ba55a496 (patch)
tree85718e8297a13c4df4cf3de2e9fb3d7ba6ec66a7 /html/js/git-deps-graph.js
parente071e2cc1944c36edfea49a49aaaebfe191f74c2 (diff)
downloadgit-deps-fec37fc3ca0e061dcc960cca9e8364b5ba55a496.tar.gz
try out edge routing
Diffstat (limited to 'html/js/git-deps-graph.js')
-rw-r--r--html/js/git-deps-graph.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/html/js/git-deps-graph.js b/html/js/git-deps-graph.js
index 41389e1..72a2830 100644
--- a/html/js/git-deps-graph.js
+++ b/html/js/git-deps-graph.js
@@ -81,6 +81,34 @@ function draw_graph () {
// label.append("title")
// .text(function (d) { return d.name; });
+ var lineFunction = d3.svg.line()
+ .x(function (d) { return d.x; })
+ .y(function (d) { return d.y; })
+ .interpolate("linear");
+
+ var routeEdges = function () {
+ d3cola.prepareEdgeRouting(margin/3);
+ path.attr("d", function (d) {
+ return lineFunction(d3cola.routeEdge(d)
+ // // show visibility graph
+ //, function (g) {
+ // if (d.source.id === 10 && d.target.id === 11) {
+ // g.E.forEach(function (e) {
+ // vis.append("line").attr("x1", e.source.p.x).attr("y1", e.source.p.y)
+ // .attr("x2", e.target.p.x).attr("y2", e.target.p.y)
+ // .attr("stroke", "green");
+ // });
+ // }
+ // }));
+ );
+ });
+ if (isIE()) {
+ path.each(function (d) {
+ this.parentNode.insertBefore(this, this);
+ });
+ }
+ };
+
d3cola.start(10,20,20);
d3cola.on("tick", function () {
@@ -110,6 +138,9 @@ function draw_graph () {
label.attr("x", function (d) { return d.x; })
.attr("y", function (d) { return d.y; });
});
+
+ d3cola.on("end", routeEdges);
+
// turn on overlap avoidance after first convergence
// d3cola.on("end", function () {
// if (!d3cola.avoidOverlaps()) {