ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: ignite-843 Sql add support string x-axis for area, line charts.
Date Mon, 05 Oct 2015 11:09:47 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 eeca4ce79 -> 3d9ac74aa


ignite-843 Sql add support string x-axis for area, line charts.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3d9ac74a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3d9ac74a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3d9ac74a

Branch: refs/heads/ignite-843
Commit: 3d9ac74aa13f18818c9174d2a6d63423232c4ac9
Parents: eeca4ce
Author: Andrey <anovikov@gridgain.com>
Authored: Mon Oct 5 18:09:36 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Mon Oct 5 18:09:36 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/sql-controller.js   | 30 +++++++++++++-------
 .../src/main/js/public/stylesheets/style.scss   |  2 +-
 .../src/main/js/views/sql/sql.jade              |  4 ++-
 3 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3d9ac74a/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 e9b1c20..d336a0f 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
@@ -127,6 +127,10 @@ consoleModule.controller('sqlController',
             return !$common.isEmptyArray(this.chartKeyCols) && this.chartKeyCols[0].label
== TIME_LINE;
         };
 
+        paragraph.timeLineSupported = function () {
+            return this.result != 'pie';
+        };
+
         Object.defineProperty(paragraph, 'gridOptions', { value: {
             enableColResize: true,
             columnDefs: [],
@@ -703,18 +707,15 @@ consoleModule.controller('sqlController',
     };
 
     function _chartNumber(arr, idx, dflt) {
-        if (arr && arr.length > idx) {
-            var val = arr[idx];
-
-            if (_.isNumber(val))
-                return val;
+        if (arr && arr.length > idx && _.isNumber(arr[idx])) {
+            return arr[idx];
         }
 
         return dflt;
     }
 
     function _chartLabel(arr, idx, dflt) {
-        if (arr && arr.length > idx)
+        if (arr && arr.length > idx && _.isString(arr[idx]))
             return arr[idx];
 
         return dflt;
@@ -760,6 +761,7 @@ consoleModule.controller('sqlController',
                      values = _.map(paragraph.rows, function (row) {
                          return {
                              x: _chartNumber(row, paragraph.chartKeyCols[0].value, index++),
+                             xLbl: _chartLabel(row, paragraph.chartKeyCols[0].value, undefined),
                              y: _chartNumber(row, valCol.value, 0)
                          }
                      });
@@ -849,7 +851,7 @@ consoleModule.controller('sqlController',
         var datum = _chartDatumLblNum(paragraph);
 
         if (datum.length == 0)
-            datum = [{key: 'No data', values: []}];
+            datum = [{values: []}];
 
         paragraph.charts = _.map(datum, function (data) {
             return {
@@ -892,6 +894,14 @@ consoleModule.controller('sqlController',
         return d3.time.format('%X')(new Date(d));
     }
 
+    var _chartWithLabelFormat = function(values) {
+        return function (d) {
+            var lbl = values[d].xLbl;
+
+            return lbl ? lbl : d3.format(',.2f')(d);
+        }
+    };
+
     function _lineChart(paragraph) {
         var data = _chartDatumNumNum(paragraph);
 
@@ -905,8 +915,8 @@ consoleModule.controller('sqlController',
                     x: _xX,
                     y: _yY,
                     xAxis: {
-                        axisLabel:  _chartAxisLabel(paragraph.chartKeyCols, 'X'),
-                        tickFormat: paragraph.chartTimeLineEnabled() ? _chartTimeTickFormat
: d3.format(',.2f')
+                        axisLabel: _chartAxisLabel(paragraph.chartKeyCols, 'X'),
+                        tickFormat: paragraph.chartTimeLineEnabled() ? _chartTimeTickFormat
: _chartWithLabelFormat(data[0].values)
                     },
                     yAxis: {
                         axisLabel:  _chartAxisLabel(paragraph.chartValCols, 'Y'),
@@ -940,7 +950,7 @@ consoleModule.controller('sqlController',
                     y: _yY,
                     xAxis: {
                         axisLabel:  _chartAxisLabel(paragraph.chartKeyCols, 'X'),
-                        tickFormat: paragraph.chartTimeLineEnabled() ? _chartTimeTickFormat
: d3.format(',.2f')
+                        tickFormat: paragraph.chartTimeLineEnabled() ? _chartTimeTickFormat
: _chartWithLabelFormat(data[0].values)
                     },
                     yAxis: {
                         axisLabel:  _chartAxisLabel(paragraph.chartValCols, 'Y'),

http://git-wip-us.apache.org/repos/asf/ignite/blob/3d9ac74a/modules/control-center-web/src/main/js/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/public/stylesheets/style.scss b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
index 10517f1..deb6008 100644
--- a/modules/control-center-web/src/main/js/public/stylesheets/style.scss
+++ b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
@@ -1502,7 +1502,7 @@ a {
 .chart-settings-link {
     font-size: $font-size-base;
     color: $link-color !important;
-    margin-left: 20px;
+    margin-left: 10px;
 }
 
 .chart-settings {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3d9ac74a/modules/control-center-web/src/main/js/views/sql/sql.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/sql.jade b/modules/control-center-web/src/main/js/views/sql/sql.jade
index e09902b..9cfa03d 100644
--- a/modules/control-center-web/src/main/js/views/sql/sql.jade
+++ b/modules/control-center-web/src/main/js/views/sql/sql.jade
@@ -149,8 +149,10 @@ block container
                                         .chart-settings-link
                                             i.fa.fa-chevron-circle-down
                                             a(ng-show='paragraph.chart' ng-click='$event.stopPropagation()'
bs-popover data-template-url='chart-settings' data-placement='bottom' data-auto-close='1'
data-trigger='click') Chart settings
-                                        div(ng-repeat='chart in paragraph.charts')
+                                        div(ng-repeat='chart in paragraph.charts' ng-hide='paragraph.chartTimeLineEnabled()
&& !paragraph.timeLineSupported()')
                                             nvd3(options='chart.options' data='chart.data'
api='chart.api')
+                                        .sql-empty-result(ng-show='paragraph.chartTimeLineEnabled()
&& !paragraph.timeLineSupported()') Pie chart does not supported 'TIME_LINE' column
for X-axis.
+                                    div(ng-show='paragraph.chart() && paragraph.nonEmpty()
&& ')
                                     div(ng-show='paragraph.queryId')
                                         hr(style='margin-top: 0; margin-bottom: 5px')
                                         i.fa.fa-chevron-circle-right(style='float: right;margin-right:
10px;' ng-click='nextPage(paragraph)')


Mime
View raw message