Repository: ambari Updated Branches: refs/heads/trunk e4c62592f -> cfd548cff
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/cfd548cf Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cfd548cf Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cfd548cf Branch: refs/heads/trunk Commit: cfd548cff0f874809e25cc1ae2211a3beb631ffe Parents: e4c6259 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:43:56 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/cfd548cf/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')) {