##// END OF EJS Templates
graph: remove unused stuff, simplify
Aras Pranckevicius -
r2922:1f3ae369 beta
parent child Browse files
Show More
@@ -32,14 +32,9 b' function BranchRenderer() {'
32 this.ctx.strokeStyle = 'rgb(0, 0, 0)';
32 this.ctx.strokeStyle = 'rgb(0, 0, 0)';
33 this.ctx.fillStyle = 'rgb(0, 0, 0)';
33 this.ctx.fillStyle = 'rgb(0, 0, 0)';
34 this.cur = [0, 0];
34 this.cur = [0, 0];
35 this.max_column = 1;
36 this.line_width = 2.5;
35 this.line_width = 2.5;
37 this.dot_radius = 5.5;
36 this.dot_radius = 5.5;
38
37
39 this.scale = function(height) {
40 this.box_size = Math.floor(height/1.2);
41 }
42
43 this.setColor = function(color, bg, fg) {
38 this.setColor = function(color, bg, fg) {
44 color %= colors.length;
39 color %= colors.length;
45 var red = (colors[color][0] * fg) || bg;
40 var red = (colors[color][0] * fg) || bg;
@@ -58,9 +53,9 b' function BranchRenderer() {'
58 var rela = document.getElementById('graph');
53 var rela = document.getElementById('graph');
59 var pad = width;
54 var pad = width;
60 var scale = 22;
55 var scale = 22;
56 var box_size = Math.floor(scale/1.2);
61
57
62 for (var i in data) {
58 for (var i in data) {
63 this.scale(scale);
64
59
65 var row = document.getElementById("chg_"+idx);
60 var row = document.getElementById("chg_"+idx);
66 if (row == null)
61 if (row == null)
@@ -83,18 +78,10 b' function BranchRenderer() {'
83 end = line[1];
78 end = line[1];
84 color = line[2];
79 color = line[2];
85
80
86 if (start > this.max_column) {
87 this.max_column = start;
88 }
89
90 if (end > this.max_column) {
91 this.max_column = end;
92 }
93
94 this.setColor(color, 0.0, 0.65);
81 this.setColor(color, 0.0, 0.65);
95
82
96
83
97 x = pad-(this.box_size * start - 1 + scale);
84 x = pad-(box_size * start - 1 + scale);
98
85
99 this.ctx.lineWidth=this.line_width;
86 this.ctx.lineWidth=this.line_width;
100 this.ctx.beginPath();
87 this.ctx.beginPath();
@@ -103,12 +90,12 b' function BranchRenderer() {'
103
90
104 if (start == end)
91 if (start == end)
105 {
92 {
106 x = pad-((1 + this.box_size * end) + scale-2);
93 x = pad-((1 + box_size * end) + scale-2);
107 this.ctx.lineTo(x,nextY+extra,3);
94 this.ctx.lineTo(x,nextY+extra,3);
108 }
95 }
109 else
96 else
110 {
97 {
111 var x2 = pad-((1 + this.box_size * end) + scale-2);
98 var x2 = pad-((1 + box_size * end) + scale-2);
112 var ymid = (rowY+nextY) / 2;
99 var ymid = (rowY+nextY) / 2;
113 this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
100 this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
114 }
101 }
General Comments 0
You need to be logged in to leave comments. Login now