diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2014-01-09 13:48:13 +0600 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2014-01-09 13:48:13 +0600 |
commit | 5a348f3c91bdf42f1c915c6b754816e126e47fd8 (patch) | |
tree | f3f214737e5ae9eb54fb7416586700b76cb61800 /sonar-server/src | |
parent | 57a8ecf14c62220f7627d723c065344fac8b4673 (diff) | |
download | sonarqube-5a348f3c91bdf42f1c915c6b754816e126e47fd8.tar.gz sonarqube-5a348f3c91bdf42f1c915c6b754816e126e47fd8.zip |
Histogram: issue when displayWorstBestValues is true and best value = 0
Diffstat (limited to 'sonar-server/src')
-rw-r--r-- | sonar-server/src/main/webapp/javascripts/widgets/histogram.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sonar-server/src/main/webapp/javascripts/widgets/histogram.js b/sonar-server/src/main/webapp/javascripts/widgets/histogram.js index 556c5b9e3ba..dad5ed09d6f 100644 --- a/sonar-server/src/main/webapp/javascripts/widgets/histogram.js +++ b/sonar-server/src/main/webapp/javascripts/widgets/histogram.js @@ -185,15 +185,21 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; // Update scales - var xDomain, + var xDomain = d3.extent(this.components(), function(d) { + return widget.getMainMetric(d); + }), metric = this.metrics()[this.mainMetric]; - if (this.options().displayWorstBestValues && metric.worstValue != null && metric.bestValue != null) { - xDomain = d3.extent([metric.worstValue, metric.bestValue]); - } else { - xDomain = d3.extent(this.components(), function(d) { - return widget.getMainMetric(d); - }); + + if (this.options().displayWorstBestValues) { + if (metric.worstValue != null && metric.bestValue != null) { + xDomain = d3.extent([metric.worstValue, metric.bestValue]); + } else if (metric.bestValue != null) { + xDomain[0] = metric.bestValue; + } else if (metric.worstValue != null) { + xDomain[0] = metric.worstValue; + } } + this.x .domain(xDomain) .range([0, this.availableWidth]); |