From a3773cfbebdba8dc7aef7fd0e7bc8db50deea6ac Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Fri, 19 Aug 2011 10:13:19 +0200 Subject: [PATCH] Fix compression of javascript --- .../main/webapp/javascripts/protovis-sonar.js | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/sonar-server/src/main/webapp/javascripts/protovis-sonar.js b/sonar-server/src/main/webapp/javascripts/protovis-sonar.js index edaa93ab6c2..12ebca3f7be 100755 --- a/sonar-server/src/main/webapp/javascripts/protovis-sonar.js +++ b/sonar-server/src/main/webapp/javascripts/protovis-sonar.js @@ -5,11 +5,10 @@ function displayTrendChart(divId, data) { h = 300 - 25, S=2; - - var x = pv.Scale.linear(pv.blend(pv.map(data, function(d) d)), function(d) d.x).range(0, w); + var x = pv.Scale.linear(pv.blend(pv.map(data, function(d) {return d;})), function(d) {return d.x}).range(0, w); var y = new Array(data.length); for(var i = 0; i < data.length; i++){ - y[i]=pv.Scale.linear(data[i], function(d) d.y).range(0, h) + y[i]=pv.Scale.linear(data[i], function(d) {return d.y;}).range(0, h) } var interpolate = "linear"; /* cardinal or linear */ var idx = -1; @@ -41,7 +40,7 @@ function displayTrendChart(divId, data) { vis.add(pv.Rule) .data(y[0].ticks(5)) .bottom(y[0]) - .strokeStyle(function(d) d ? "#eee" : "#000") + .strokeStyle(function(d) {return d ? "#eee" : "#000";}) .anchor("left") .add(pv.Label) .text(y[0].tickFormat); @@ -53,25 +52,25 @@ function displayTrendChart(divId, data) { /* The line. */ var line = panel.add(pv.Line) - .data(function(array) array) - .left(function(d) x(d.x)) - .bottom(function(d) y[this.parent.index](d.y)) - .interpolate(function() interpolate) + .data(function(array) {return array;}) + .left(function(d) {return x(d.x);}) + .bottom(function(d) {return y[this.parent.index](d.y);}) + .interpolate(function() {return interpolate;}) .lineWidth(2); /* The mouseover dots and label. */ line.add(pv.Dot) - .visible(function() idx >= 0) - .data(function(d) [d[idx]]) - .fillStyle(function() line.strokeStyle()) + .visible(function() {return idx >= 0;}) + .data(function(d) {return [d[idx]];}) + .fillStyle(function() {return line.strokeStyle();}) .strokeStyle("#000") .size(20) .lineWidth(1) .add(pv.Dot) .left(10) - .bottom(function() this.parent.index * 12 + 10) + .bottom(function() {return this.parent.index * 12 + 10;}) .anchor("right").add(pv.Label) - .text(function(d) d.y.toFixed(2)); + .text(function(d) {return d.y.toFixed(2);}); /* An invisible bar to capture events (without flickering). */ @@ -83,10 +82,9 @@ function displayTrendChart(divId, data) { }) .event("mousemove", function() { var mx = x.invert(vis.mouse().x); - idx = pv.search(data[0].map(function(d) d.x), mx); + idx = pv.search(data[0].map(function(d) {return d.x;}), mx); idx = idx < 0 ? (-idx - 2) : idx; return vis; }); vis.render(); - -} \ No newline at end of file +}; \ No newline at end of file -- 2.39.5