summaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-01-09 13:48:13 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-01-09 13:48:13 +0600
commit5a348f3c91bdf42f1c915c6b754816e126e47fd8 (patch)
treef3f214737e5ae9eb54fb7416586700b76cb61800 /sonar-server/src
parent57a8ecf14c62220f7627d723c065344fac8b4673 (diff)
downloadsonarqube-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.js20
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]);