ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-13580. Area graph is empty when metrics value is 0 for any displayed time moment (onechiporenko)
Date Tue, 27 Oct 2015 12:34:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 334b48336 -> 4a6234ae3


AMBARI-13580. Area graph is empty when metrics value is 0 for any displayed time moment (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4a6234ae
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a6234ae
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a6234ae

Branch: refs/heads/branch-2.1
Commit: 4a6234ae34f7b2a6fc779b016e67078c1a8dc071
Parents: 334b483
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Oct 27 14:32:00 2015 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Oct 27 14:32:00 2015 +0200

----------------------------------------------------------------------
 .../app/views/common/chart/linear_time.js       | 51 ++++++++++----------
 1 file changed, 26 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4a6234ae/ambari-web/app/views/common/chart/linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js
index 96ce4cb..22950e5 100644
--- a/ambari-web/app/views/common/chart/linear_time.js
+++ b/ambari-web/app/views/common/chart/linear_time.js
@@ -506,33 +506,34 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin,
{
       }
       series.color = seriesColor;
       series.stroke = 'rgba(0,0,0,0.3)';
-      if (self.get('isPopup')) {
-        // calculate statistic data for popup legend
-        var avg = 0;
-        var min = Number.MAX_VALUE;
-        var max = Number.MIN_VALUE;
-        var numberOfNotNullValues = 0;
-        for (var i = 0; i < series.data.length; i++) {
-          avg += series.data[i]['y'];
-          if (series.data[i]['y'] !== null) {
-            numberOfNotNullValues++;
-          }
-          if (!Em.isNone(series.data[i]['y'])) {
-            if (series.data[i]['y'] < min) {
-              min = series.data[i]['y'];
-            }
-          }
-          if (series.data[i]['y'] > max) {
-            max = series.data[i]['y'];
+      // calculate statistic data for popup legend
+      var avg = 0;
+      var min = Number.MAX_VALUE;
+      var max = Number.MIN_VALUE;
+      var numberOfNotNullValues = 0;
+      for (var i = 0; i < series.data.length; i++) {
+        avg += series.data[i]['y'];
+        if (series.data[i]['y'] !== null) {
+          numberOfNotNullValues++;
+        }
+        if (!Em.isNone(series.data[i]['y'])) {
+          if (series.data[i]['y'] < min) {
+            min = series.data[i]['y'];
           }
         }
-        series.name = string_utils.pad(series.name.length > 36 ? series.name.substr(0,
36) + '...' : series.name, 40, '&nbsp;', 2) + '|&nbsp;' +
-          string_utils.pad('min', 5, '&nbsp;', 3) +
-          string_utils.pad(self.get('yAxisFormatter')(min), 12, '&nbsp;', 3) +
-          string_utils.pad('avg', 5, '&nbsp;', 3) +
-          string_utils.pad(self.get('yAxisFormatter')(avg / numberOfNotNullValues), 12, '&nbsp;',
3) +
-          string_utils.pad('max', 12, '&nbsp;', 3) +
-          string_utils.pad(self.get('yAxisFormatter')(max), 5, '&nbsp;', 3);
+        if (series.data[i]['y'] > max) {
+          max = series.data[i]['y'];
+        }
+      }
+      series.name = string_utils.pad(series.name.length > 36 ? series.name.substr(0, 36)
+ '...' : series.name, 40, '&nbsp;', 2) + '|&nbsp;' +
+        string_utils.pad('min', 5, '&nbsp;', 3) +
+        string_utils.pad(self.get('yAxisFormatter')(min), 12, '&nbsp;', 3) +
+        string_utils.pad('avg', 5, '&nbsp;', 3) +
+        string_utils.pad(self.get('yAxisFormatter')(avg / numberOfNotNullValues), 12, '&nbsp;',
3) +
+        string_utils.pad('max', 12, '&nbsp;', 3) +
+        string_utils.pad(self.get('yAxisFormatter')(max), 5, '&nbsp;', 3);
+      if (min === max && 0 === min || max === Number.MIN_VALUE) {
+        series.stroke = series.color;
       }
       if (series.data.length < series_min_length) {
         series_min_length = series.data.length;


Mime
View raw message