aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-08-31 18:58:07 +0200
committerFabrice Bellingard <bellingard@gmail.com>2011-08-31 18:58:07 +0200
commit8e085c96accc9c912747df5c8b93c8a0bc85ad95 (patch)
tree2f4b3d73dc9069fd3f1d6ca0f576d64c9d495a38 /sonar-server/src
parent8ce8f2a2ff596cb6185b111cf7eda2368bfc3026 (diff)
downloadsonarqube-8e085c96accc9c912747df5c8b93c8a0bc85ad95.tar.gz
sonarqube-8e085c96accc9c912747df5c8b93c8a0bc85ad95.zip
SONAR-2074 Fix display bug caused by Protovis limitation
If the array used to display the Y axis contains only data with the exact same value, Protovis function y() returns NaN, which makes it impossible to display the line for the given array.
Diffstat (limited to 'sonar-server/src')
-rwxr-xr-xsonar-server/src/main/webapp/javascripts/protovis-sonar.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/sonar-server/src/main/webapp/javascripts/protovis-sonar.js b/sonar-server/src/main/webapp/javascripts/protovis-sonar.js
index a2854578fb4..840ae49a3bb 100755
--- a/sonar-server/src/main/webapp/javascripts/protovis-sonar.js
+++ b/sonar-server/src/main/webapp/javascripts/protovis-sonar.js
@@ -47,15 +47,15 @@ SonarWidgets.Timeline.prototype.render = function() {
var show_y_axis = (data.length==1)
/* Sizing and scales. */
- var footerHeight = 4 + Math.max(this.wMetrics.size(), events ? 2 : 1) * 18;
- var w = widgetDiv.parentNode.clientWidth - 60,
- h = (this.wHeight == null ? 80 : this.wHeight) + footerHeight,
- S=2;
+ var headerHeight = 4 + Math.max(this.wMetrics.size(), events ? 2 : 1) * 18;
+ var w = widgetDiv.parentNode.clientWidth - 60;
+ var h = (this.wHeight == null ? 80 : this.wHeight) + headerHeight;
+ var yMaxHeight = h-headerHeight;
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) {return d.y;}).range(20, h-footerHeight)
+ y[i]=pv.Scale.linear(data[i], function(d) {return d.y;}).range(20, yMaxHeight);
}
var interpolate = "linear"; /* cardinal or linear */
var idx = this.wData[0].size() - 1;
@@ -89,7 +89,7 @@ SonarWidgets.Timeline.prototype.render = function() {
var line = panel.add(pv.Line)
.data(function(array) {return array;})
.left(function(d) {return x(d.x);})
- .bottom(function(d) {return y[this.parent.index](d.y);})
+ .bottom(function(d) {var yAxis = y[this.parent.index](d.y); return isNaN(yAxis) ? yMaxHeight : yAxis;})
.interpolate(function() {return interpolate;})
.lineWidth(2);