diff options
author | Valery Sizov <vsv2711@gmail.com> | 2011-11-13 15:58:45 +0400 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2011-11-13 15:58:45 +0400 |
commit | 94690bd2c4b30116aeee42fab5f97d5023ac750f (patch) | |
tree | 89c3339c488e256e2723fd6df39228e1009b97b6 /lib | |
parent | 6b66a766d1e534dbfb5735828d9f6d770732a19b (diff) |
Graph: base implementation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/assets/javascripts/branch-graph.js | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/lib/assets/javascripts/branch-graph.js b/lib/assets/javascripts/branch-graph.js index b98c836ff5c..f8b73660d11 100644 --- a/lib/assets/javascripts/branch-graph.js +++ b/lib/assets/javascripts/branch-graph.js @@ -1,30 +1,37 @@ -var commits = chunk1.commits, +var commits = {}, comms = {}, pixelsX = [], pixelsY = [], mmax = Math.max, mtime = 0, mspace = 0, - parents = {}; -for (var i = 0, ii = commits.length; i < ii; i++) { - for (var j = 0, jj = commits[i].parents.length; j < jj; j++) { - parents[commits[i].parents[j][0]] = true; - } - mtime = Math.max(mtime, commits[i].time); - mspace = Math.max(mspace, commits[i].space); -} -mtime = mtime + 4; -mspace = mspace + 10; -for (i = 0; i < ii; i++) { - if (commits[i].id in parents) { - commits[i].isParent = true; - } - comms[commits[i].id] = commits[i]; -} -var colors = ["#000"]; -for (var k = 0; k < mspace; k++) { - colors.push(Raphael.getColor()); + parents = {}, + ii = 0, + colors = ["#000"]; + +function initGraph(){ + commits = chunk1.commits; + ii = commits.length; + for (var i = 0; i < ii; i++) { + for (var j = 0, jj = commits[i].parents.length; j < jj; j++) { + parents[commits[i].parents[j][0]] = true; + } + mtime = Math.max(mtime, commits[i].time); + mspace = Math.max(mspace, commits[i].space); + } + mtime = mtime + 4; + mspace = mspace + 10; + for (i = 0; i < ii; i++) { + if (commits[i].id in parents) { + commits[i].isParent = true; + } + comms[commits[i].id] = commits[i]; + } + for (var k = 0; k < mspace; k++) { + colors.push(Raphael.getColor()); + } } + function branchGraph(holder) { var ch = mspace * 20 + 20, cw = mtime * 20 + 20, r = Raphael("holder", cw, ch), |