diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-08-04 14:56:36 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-08-04 14:56:42 +0200 |
commit | 62aa23863d60b66aea4e027a1d8899cb10142560 (patch) | |
tree | 76c4eaf5e1355e001613c379f43c32464a77a451 /server/sonar-web/src/main/js/widgets | |
parent | 324e7ea6fb166942a519dfac10647eae5af803cd (diff) | |
download | sonarqube-62aa23863d60b66aea4e027a1d8899cb10142560.tar.gz sonarqube-62aa23863d60b66aea4e027a1d8899cb10142560.zip |
SONAR-5004 Do not display bubble chart when all values for one axis are null/non available
Diffstat (limited to 'server/sonar-web/src/main/js/widgets')
-rw-r--r-- | server/sonar-web/src/main/js/widgets/bubble-chart.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/widgets/bubble-chart.js b/server/sonar-web/src/main/js/widgets/bubble-chart.js index de34819fdd5..d4b3feb87a3 100644 --- a/server/sonar-web/src/main/js/widgets/bubble-chart.js +++ b/server/sonar-web/src/main/js/widgets/bubble-chart.js @@ -70,9 +70,15 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; container = d3.select(container); - var validData = this.components().reduce(function(p, c) { - return p && !!c.measures[widget.metricsPriority()[0]] && !!c.measures[widget.metricsPriority()[1]]; - }, true); + var noInvalidEntry = true, + atLeastOneValueOnX = false, + atLeastOneValueOnY = false; + this.components().forEach(function validateComponent(component) { + noInvalidEntry &= (!!component.measures[widget.metricsPriority()[0]] && !!component.measures[widget.metricsPriority()[1]]); + atLeastOneValueOnX |= (component.measures[widget.metricsPriority()[0]] || {}).fval != '-'; + atLeastOneValueOnY |= (component.measures[widget.metricsPriority()[1]] || {}).fval != '-'; + }); + var validData = !!noInvalidEntry && !!atLeastOneValueOnX && !!atLeastOneValueOnY; if (!validData) { container.text(this.options().noMainMetric); |