Show More
@@ -35,14 +35,9 b' function BranchRenderer() {' | |||||
35 | this.max_column = 1; |
|
35 | this.max_column = 1; | |
36 | this.line_width = 2.5; |
|
36 | this.line_width = 2.5; | |
37 | this.dot_radius = 5.5; |
|
37 | this.dot_radius = 5.5; | |
38 | this.bg = [0, 4]; |
|
|||
39 | this.cell = [2, 0]; |
|
|||
40 | this.revlink = ''; |
|
|||
41 |
|
38 | |||
42 | this.scale = function(height) { |
|
39 | this.scale = function(height) { | |
43 | this.box_size = Math.floor(height/1.2); |
|
40 | this.box_size = Math.floor(height/1.2); | |
44 | this.cell_height = this.box_size; |
|
|||
45 | this.bg_height = height; |
|
|||
46 | } |
|
41 | } | |
47 |
|
42 | |||
48 | this.setColor = function(color, bg, fg) { |
|
43 | this.setColor = function(color, bg, fg) { | |
@@ -58,10 +53,10 b' function BranchRenderer() {' | |||||
58 | this.ctx.fillStyle = s; |
|
53 | this.ctx.fillStyle = s; | |
59 | } |
|
54 | } | |
60 |
|
55 | |||
61 |
this.render = function(data, |
|
56 | this.render = function(data,width) { | |
62 | var idx = 1; |
|
57 | var idx = 1; | |
63 | var rela = document.getElementById('graph'); |
|
58 | var rela = document.getElementById('graph'); | |
64 |
var pad = |
|
59 | var pad = width; | |
65 | var scale = 22; |
|
60 | var scale = 22; | |
66 |
|
61 | |||
67 | for (var i in data) { |
|
62 | for (var i in data) { | |
@@ -73,9 +68,6 b' function BranchRenderer() {' | |||||
73 | var next = document.getElementById("chg_"+(idx+1)); |
|
68 | var next = document.getElementById("chg_"+(idx+1)); | |
74 | var extra = 0; |
|
69 | var extra = 0; | |
75 |
|
70 | |||
76 | this.cell[1] += row.clientWidth; |
|
|||
77 | this.bg[1] += this.bg_height; |
|
|||
78 |
|
||||
79 | cur = data[i]; |
|
71 | cur = data[i]; | |
80 | nodeid = cur[0]; |
|
72 | nodeid = cur[0]; | |
81 | node = cur[1]; |
|
73 | node = cur[1]; | |
@@ -102,7 +94,7 b' function BranchRenderer() {' | |||||
102 | this.setColor(color, 0.0, 0.65); |
|
94 | this.setColor(color, 0.0, 0.65); | |
103 |
|
95 | |||
104 |
|
96 | |||
105 |
x = pad-( |
|
97 | x = pad-(this.box_size * start - 1 + scale); | |
106 |
|
98 | |||
107 | this.ctx.lineWidth=this.line_width; |
|
99 | this.ctx.lineWidth=this.line_width; | |
108 | this.ctx.beginPath(); |
|
100 | this.ctx.beginPath(); | |
@@ -111,12 +103,12 b' function BranchRenderer() {' | |||||
111 |
|
103 | |||
112 | if (start == end) |
|
104 | if (start == end) | |
113 | { |
|
105 | { | |
114 |
x = pad-((1 + this.box_size * end) + |
|
106 | x = pad-((1 + this.box_size * end) + scale-2); | |
115 | this.ctx.lineTo(x,nextY+extra,3); |
|
107 | this.ctx.lineTo(x,nextY+extra,3); | |
116 | } |
|
108 | } | |
117 | else |
|
109 | else | |
118 | { |
|
110 | { | |
119 |
var x2 = pad-((1 + this.box_size * end) + |
|
111 | var x2 = pad-((1 + this.box_size * end) + scale-2); | |
120 | var ymid = (rowY+nextY) / 2; |
|
112 | var ymid = (rowY+nextY) / 2; | |
121 | this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY); |
|
113 | this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY); | |
122 | } |
|
114 | } | |
@@ -128,7 +120,7 b' function BranchRenderer() {' | |||||
128 |
|
120 | |||
129 | radius = this.dot_radius; |
|
121 | radius = this.dot_radius; | |
130 |
|
122 | |||
131 |
x = pad-(Math.round( |
|
123 | x = pad-(Math.round(scale * column + radius) + 15 - (column*4)); | |
132 |
|
124 | |||
133 | this.ctx.beginPath(); |
|
125 | this.ctx.beginPath(); | |
134 | this.setColor(color, 0.25, 0.75); |
|
126 | this.setColor(color, 0.25, 0.75); |
General Comments 0
You need to be logged in to leave comments.
Login now