Repository: ambari Updated Branches: refs/heads/trunk 10653cf46 -> bd7d61d5b
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/bd7d61d5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bd7d61d5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bd7d61d5 Branch: refs/heads/trunk Commit: bd7d61d5b1774d57101c00763c5527f261827445 Parents: 10653cf Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Tue Oct 27 14:32:00 2015 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Tue Oct 27 14:37:46 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/bd7d61d5/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, ' ', 2) + '| ' + - string_utils.pad('min', 5, ' ', 3) + - string_utils.pad(self.get('yAxisFormatter')(min), 12, ' ', 3) + - string_utils.pad('avg', 5, ' ', 3) + - string_utils.pad(self.get('yAxisFormatter')(avg / numberOfNotNullValues), 12, ' ', 3) + - string_utils.pad('max', 12, ' ', 3) + - string_utils.pad(self.get('yAxisFormatter')(max), 5, ' ', 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, ' ', 2) + '| ' + + string_utils.pad('min', 5, ' ', 3) + + string_utils.pad(self.get('yAxisFormatter')(min), 12, ' ', 3) + + string_utils.pad('avg', 5, ' ', 3) + + string_utils.pad(self.get('yAxisFormatter')(avg / numberOfNotNullValues), 12, ' ', 3) + + string_utils.pad('max', 12, ' ', 3) + + string_utils.pad(self.get('yAxisFormatter')(max), 5, ' ', 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;