# HG changeset patch # User Aras Pranckevicius # Date 1350305174 -10800 # Node ID 1f3ae3690756398227989a3ca1c188a3a1ebc351 # Parent 582224526c23c781437c4cc0179af2daa0deb6fa graph: remove unused stuff, simplify diff -r 582224526c23 -r 1f3ae3690756 rhodecode/public/js/graph.js --- a/rhodecode/public/js/graph.js Mon Oct 15 15:42:03 2012 +0300 +++ b/rhodecode/public/js/graph.js Mon Oct 15 15:46:14 2012 +0300 @@ -32,14 +32,9 @@ this.ctx.strokeStyle = 'rgb(0, 0, 0)'; this.ctx.fillStyle = 'rgb(0, 0, 0)'; this.cur = [0, 0]; - this.max_column = 1; this.line_width = 2.5; this.dot_radius = 5.5; - this.scale = function(height) { - this.box_size = Math.floor(height/1.2); - } - this.setColor = function(color, bg, fg) { color %= colors.length; var red = (colors[color][0] * fg) || bg; @@ -58,9 +53,9 @@ var rela = document.getElementById('graph'); var pad = width; var scale = 22; + var box_size = Math.floor(scale/1.2); for (var i in data) { - this.scale(scale); var row = document.getElementById("chg_"+idx); if (row == null) @@ -83,18 +78,10 @@ end = line[1]; color = line[2]; - if (start > this.max_column) { - this.max_column = start; - } - - if (end > this.max_column) { - this.max_column = end; - } - this.setColor(color, 0.0, 0.65); - x = pad-(this.box_size * start - 1 + scale); + x = pad-(box_size * start - 1 + scale); this.ctx.lineWidth=this.line_width; this.ctx.beginPath(); @@ -103,12 +90,12 @@ if (start == end) { - x = pad-((1 + this.box_size * end) + scale-2); + x = pad-((1 + box_size * end) + scale-2); this.ctx.lineTo(x,nextY+extra,3); } else { - var x2 = pad-((1 + this.box_size * end) + scale-2); + var x2 = pad-((1 + box_size * end) + scale-2); var ymid = (rowY+nextY) / 2; this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY); }