Show More
@@ -48,12 +48,11 function BranchRenderer() { | |||||
48 | this.ctx.fillStyle = s; |
|
48 | this.ctx.fillStyle = s; | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 |
this.render = function(data, |
|
51 | this.render = function(data,canvasWidth) { | |
52 | var idx = 1; |
|
52 | var idx = 1; | |
53 | var rela = document.getElementById('graph'); |
|
53 | var rela = document.getElementById('graph'); | |
54 | var pad = width; |
|
54 | ||
55 |
var |
|
55 | var box_size = 18; | |
56 | var box_size = Math.floor(scale/1.2); |
|
|||
57 |
|
56 | |||
58 | for (var i in data) { |
|
57 | for (var i in data) { | |
59 |
|
58 | |||
@@ -64,7 +63,6 function BranchRenderer() { | |||||
64 | var extra = 0; |
|
63 | var extra = 0; | |
65 |
|
64 | |||
66 | cur = data[i]; |
|
65 | cur = data[i]; | |
67 | nodeid = cur[0]; |
|
|||
68 | node = cur[1]; |
|
66 | node = cur[1]; | |
69 | in_l = cur[2]; |
|
67 | in_l = cur[2]; | |
70 |
|
68 | |||
@@ -74,40 +72,38 function BranchRenderer() { | |||||
74 | for (var j in in_l) { |
|
72 | for (var j in in_l) { | |
75 |
|
73 | |||
76 | line = in_l[j]; |
|
74 | line = in_l[j]; | |
77 | start = line[0]; |
|
75 | start = line[0] + 1; | |
78 | end = line[1]; |
|
76 | end = line[1] + 1; | |
79 | color = line[2]; |
|
77 | color = line[2]; | |
80 |
|
78 | |||
81 | this.setColor(color, 0.0, 0.65); |
|
79 | this.setColor(color, 0.0, 0.65); | |
82 |
|
80 | |||
83 |
|
81 | |||
84 |
x = |
|
82 | x = canvasWidth - box_size * start; | |
85 |
|
83 | |||
86 | this.ctx.lineWidth=this.line_width; |
|
84 | this.ctx.lineWidth=this.line_width; | |
87 | this.ctx.beginPath(); |
|
85 | this.ctx.beginPath(); | |
88 | this.ctx.moveTo(x, rowY); |
|
86 | this.ctx.moveTo(x, rowY); | |
89 |
|
87 | |||
90 |
|
||||
91 | if (start == end) |
|
88 | if (start == end) | |
92 | { |
|
89 | { | |
93 | x = pad-((1 + box_size * end) + scale-2); |
|
|||
94 | this.ctx.lineTo(x,nextY+extra,3); |
|
90 | this.ctx.lineTo(x,nextY+extra,3); | |
95 | } |
|
91 | } | |
96 | else |
|
92 | else | |
97 | { |
|
93 | { | |
98 |
var x2 = |
|
94 | var x2 = canvasWidth - box_size * end; | |
99 | var ymid = (rowY+nextY) / 2; |
|
95 | var ymid = (rowY+nextY) / 2; | |
100 | this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY); |
|
96 | this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY); | |
101 | } |
|
97 | } | |
102 | this.ctx.stroke(); |
|
98 | this.ctx.stroke(); | |
103 | } |
|
99 | } | |
104 |
|
100 | |||
105 | column = node[0] |
|
101 | column = node[0] + 1; | |
106 | color = node[1] |
|
102 | color = node[1]; | |
107 |
|
103 | |||
108 | radius = this.dot_radius; |
|
104 | radius = this.dot_radius; | |
109 |
|
105 | |||
110 | x = pad-(Math.round(scale * column + radius) + 15 - (column*4)); |
|
106 | x = canvasWidth - box_size * column; | |
111 |
|
107 | |||
112 | this.ctx.beginPath(); |
|
108 | this.ctx.beginPath(); | |
113 | this.setColor(color, 0.25, 0.75); |
|
109 | this.setColor(color, 0.25, 0.75); |
General Comments 0
You need to be logged in to leave comments.
Login now