Repository: ignite Updated Branches: refs/heads/ignite-843-rc1 6dfd3b51d -> e5a30a20f
IGNITE-1870 Fixed aggregation logic and added aggregation function to Y axes. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e5a30a20 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e5a30a20 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e5a30a20 Branch: refs/heads/ignite-843-rc1 Commit: e5a30a20f8494bc26f52d4278dcaeffaec29f8e6 Parents: 6dfd3b5 Author: Alexey Kuznetsov <akuznet...@apache.org> Authored: Mon Nov 16 09:59:16 2015 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Mon Nov 16 09:59:16 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/sql-controller.js | 33 +++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/e5a30a20/modules/control-center-web/src/main/js/controllers/sql-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/sql-controller.js b/modules/control-center-web/src/main/js/controllers/sql-controller.js index a4188db..bf1a41e 100644 --- a/modules/control-center-web/src/main/js/controllers/sql-controller.js +++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js @@ -1008,7 +1008,7 @@ consoleModule.controller('sqlController', values.push({ x: lastItem.tm, - y: _aggregate(lastItem.rows[0], aggFx, colIdx, index++) + y: _aggregate(lastItem.rows, aggFx, colIdx, index++) }); while (values.length > 0 && values[0].x < leftBound) @@ -1118,12 +1118,23 @@ consoleModule.controller('sqlController', _chartApplySettings(paragraph, true); }; - function _colLabel(col) { - return col.label; + function _xAxisLabel(paragraph) { + return $common.isEmptyArray(paragraph.chartKeyCols) ? 'X' : paragraph.chartKeyCols[0].label; } - function _chartAxisLabel(cols, dflt) { - return $common.isEmptyArray(cols) ? dflt : _.map(cols, _colLabel).join(', '); + function _yAxisLabel(paragraph) { + var cols = paragraph.chartValCols; + + var tml = paragraph.chartTimeLineEnabled(); + + return $common.isEmptyArray(cols) ? 'Y' : _.map(cols, function (col) { + var lbl = col.label; + + if (tml) + lbl += ' [' + col.aggFx + ']'; + + return lbl; + }).join(', '); } function _xX(d) { @@ -1219,12 +1230,12 @@ consoleModule.controller('sqlController', x: _xX, y: _yY, xAxis: { - axisLabel: _chartAxisLabel(paragraph.chartKeyCols, 'X'), + axisLabel: _xAxisLabel(paragraph), tickFormat: paragraph.chartTimeLineEnabled() ? _xAxisTimeFormat : _xAxisWithLabelFormat(paragraph), showMaxMin: false }, yAxis: { - axisLabel: _chartAxisLabel(paragraph.chartValCols, 'Y'), + axisLabel: _yAxisLabel(paragraph), tickFormat: _yAxisFormat }, color: CHART_COLORS, @@ -1287,12 +1298,12 @@ consoleModule.controller('sqlController', x: _xX, y: _yY, xAxis: { - axisLabel: _chartAxisLabel(paragraph.chartKeyCols, 'X'), + axisLabel: _xAxisLabel(paragraph), tickFormat: paragraph.chartTimeLineEnabled() ? _xAxisTimeFormat : _xAxisWithLabelFormat(paragraph), showMaxMin: false }, yAxis: { - axisLabel: _chartAxisLabel(paragraph.chartValCols, 'Y'), + axisLabel: _yAxisLabel(paragraph), tickFormat: _yAxisFormat }, color: CHART_COLORS, @@ -1321,12 +1332,12 @@ consoleModule.controller('sqlController', x: _xX, y: _yY, xAxis: { - axisLabel: _chartAxisLabel(paragraph.chartKeyCols, 'X'), + axisLabel: _xAxisLabel(paragraph), tickFormat: paragraph.chartTimeLineEnabled() ? _xAxisTimeFormat : _xAxisWithLabelFormat(paragraph), showMaxMin: false }, yAxis: { - axisLabel: _chartAxisLabel(paragraph.chartValCols, 'Y'), + axisLabel: _yAxisLabel(paragraph), tickFormat: _yAxisFormat }, color: CHART_COLORS