Repository: ambari Updated Branches: refs/heads/branch-2.1 d19c9859d -> b9b85ca9a
AMBARI-13598. flume metrics show 0 numbers on the y axis even though the graph has data (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b9b85ca9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b9b85ca9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b9b85ca9 Branch: refs/heads/branch-2.1 Commit: b9b85ca9a2cdf3be14d006ffd424ea465132c7ce Parents: d19c985 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Wed Oct 28 11:32:22 2015 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Wed Oct 28 11:32:22 2015 +0200 ---------------------------------------------------------------------- .../app/views/common/chart/linear_time.js | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b9b85ca9/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 22950e5..ccf26ac 100644 --- a/ambari-web/app/views/common/chart/linear_time.js +++ b/ambari-web/app/views/common/chart/linear_time.js @@ -511,6 +511,7 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, { var min = Number.MAX_VALUE; var max = Number.MIN_VALUE; var numberOfNotNullValues = 0; + series.isZero = true; for (var i = 0; i < series.data.length; i++) { avg += series.data[i]['y']; if (series.data[i]['y'] !== null) { @@ -524,15 +525,20 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, { if (series.data[i]['y'] > max) { max = series.data[i]['y']; } + if (series.data[i]['y'] > 1) { + series.isZero = false; + } + } + if (self.get('isPopup')) { + 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); } - 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) { + if (series.isZero) { series.stroke = series.color; } if (series.data.length < series_min_length) { @@ -571,7 +577,8 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, { interpolation: 'step-after', stroke: true, renderer: this.get('renderer'), - strokeWidth: 'area' === this.get('renderer') ? 1 : 2 + strokeWidth: 'area' === this.get('renderer') ? 1 : 2, + max: seriesData.everyProperty('isZero') ? 1 : null }); if ('area' === this.get('renderer')) {