dtable-statistic 4.0.2-test-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/es/api/dtable-db-api.js +43 -0
- package/es/assets/css/color-picker.css +53 -0
- package/es/assets/css/color-rules-popover.css +144 -0
- package/es/assets/css/color-theme-dialog.css +40 -0
- package/es/assets/css/dashboard.css +562 -0
- package/es/assets/css/dialog.css +415 -0
- package/es/assets/css/mobile-dashboard.module.css +91 -0
- package/es/assets/css/slider.css +77 -0
- package/es/assets/css/statistic-chart.module.css +11 -0
- package/es/assets/css/statistic-custom-title.module.css +3 -0
- package/es/assets/css/statistic-custom.module.css +4 -0
- package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
- package/es/assets/css/statistic-time-picker.module.css +21 -0
- package/es/assets/css/theme.css +61 -0
- package/es/assets/images/icon.png +0 -0
- package/es/calculator/base-calculator.js +111 -0
- package/es/calculator/basic-chart-calculator.js +571 -0
- package/es/calculator/combination-calculator.js +296 -0
- package/es/calculator/compare-bar-calculator.js +291 -0
- package/es/calculator/completeness-calculator.js +307 -0
- package/es/calculator/copy-value.js +47 -0
- package/es/calculator/dashboard-calculator.js +146 -0
- package/es/calculator/heat-map-calculator.js +225 -0
- package/es/calculator/horizontal-bar-calculator.js +100 -0
- package/es/calculator/index.js +88 -0
- package/es/calculator/map-calculator.js +169 -0
- package/es/calculator/mirror-calculator.js +217 -0
- package/es/calculator/number-card-calculator.js +135 -0
- package/es/calculator/pivot-table-calculator.js +810 -0
- package/es/calculator/scatter-calculator.js +150 -0
- package/es/calculator/thread-manager.js +70 -0
- package/es/calculator/trend-calculator.js +204 -0
- package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
- package/es/calculator/workers/calculator.worker.js +22 -0
- package/es/calculator/workers/card-calculator-worker.js +28 -0
- package/es/calculator/workers/combination-calculator-worker.js +257 -0
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
- package/es/calculator/workers/completeness-calculator-worker.js +153 -0
- package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
- package/es/calculator/workers/mirror-calculator-worker.js +132 -0
- package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
- package/es/calculator/workers/scatter-calculator-worker.js +67 -0
- package/es/calculator/workers/trend-calculator-worker.js +93 -0
- package/es/calculator/world-map-calculator.js +193 -0
- package/es/components/common-add-tool.js +19 -0
- package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
- package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
- package/es/components/dialog/color-theme-dialog.js +71 -0
- package/es/components/dialog/enlarged-chart-dialog.js +73 -0
- package/es/components/dialog/new-table-dialog.js +113 -0
- package/es/components/dialog/new-view-dialog.js +87 -0
- package/es/components/dialog/rename-view-dialog.js +87 -0
- package/es/components/dialog/statistic-record-dialog/index.css +114 -0
- package/es/components/dialog/statistic-record-dialog/index.js +174 -0
- package/es/components/dialog/table-select-dialog.js +93 -0
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
- package/es/components/dtable-popover.js +109 -0
- package/es/components/dtable-search-input.js +137 -0
- package/es/components/dtable-select.js +104 -0
- package/es/components/index.js +11 -0
- package/es/components/loading.js +8 -0
- package/es/components/modal-portal.js +36 -0
- package/es/components/popover/color-rules/color-rule.js +179 -0
- package/es/components/popover/color-rules/index.js +87 -0
- package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
- package/es/components/popover/color-rules/rule-filters/index.css +214 -0
- package/es/components/popover/color-rules/rule-filters/index.js +97 -0
- package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
- package/es/components/popover/color-rules-popover.js +213 -0
- package/es/components/popover/color-selector-popover.js +85 -0
- package/es/components/seatable-radio/index.css +51 -0
- package/es/components/seatable-radio/index.js +28 -0
- package/es/components/select/index.js +2 -0
- package/es/components/select/option-group.css +104 -0
- package/es/components/select/option-group.js +225 -0
- package/es/components/select/option.js +51 -0
- package/es/components/select/select.css +211 -0
- package/es/components/select/select.js +157 -0
- package/es/components/toast/alert.js +130 -0
- package/es/components/toast/index.js +3 -0
- package/es/components/toast/toast.js +164 -0
- package/es/components/toast/toastManager.js +150 -0
- package/es/components/toast/toaster.js +64 -0
- package/es/constants/color-rules.js +8 -0
- package/es/constants/dtable-select-style.js +61 -0
- package/es/constants/event-types.js +1 -0
- package/es/constants/index.js +501 -0
- package/es/constants/key-codes.js +102 -0
- package/es/constants/zIndexes.js +1 -0
- package/es/custom-g2.js +614 -0
- package/es/dashboard.js +408 -0
- package/es/desktop-dashboard.js +299 -0
- package/es/index.js +33 -0
- package/es/locale/index.js +17 -0
- package/es/locale/lang/de.js +237 -0
- package/es/locale/lang/en.js +237 -0
- package/es/locale/lang/fr.js +237 -0
- package/es/locale/lang/zh_CN.js +237 -0
- package/es/mobile-dashboard.js +103 -0
- package/es/model/collaborators.js +11 -0
- package/es/model/stat-item.js +340 -0
- package/es/model/statistic-dashboard.js +8 -0
- package/es/service/chart-service.js +192 -0
- package/es/service/dashboard-service.js +415 -0
- package/es/stat-editor/chart-name-editor.js +75 -0
- package/es/stat-editor/index.js +74 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
- package/es/stat-list/chart-preview.js +139 -0
- package/es/stat-list/index.js +275 -0
- package/es/stat-view/area-chart.js +521 -0
- package/es/stat-view/bar-chart.js +568 -0
- package/es/stat-view/base-chart.js +44 -0
- package/es/stat-view/basic-number-card.js +255 -0
- package/es/stat-view/combination-chart.js +558 -0
- package/es/stat-view/compare-chart.js +485 -0
- package/es/stat-view/completeness-chart.js +389 -0
- package/es/stat-view/custom-bar.js +433 -0
- package/es/stat-view/dashboard-chart.js +317 -0
- package/es/stat-view/heat-map.js +501 -0
- package/es/stat-view/horizontal-bar-chart.js +569 -0
- package/es/stat-view/index.js +183 -0
- package/es/stat-view/line-chart.js +505 -0
- package/es/stat-view/map.js +428 -0
- package/es/stat-view/mirror.js +285 -0
- package/es/stat-view/pie-chart.js +326 -0
- package/es/stat-view/pivot-table/index.js +206 -0
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
- package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
- package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
- package/es/stat-view/ring-chart.js +416 -0
- package/es/stat-view/scatter-chart.js +367 -0
- package/es/stat-view/treemap-chart.js +318 -0
- package/es/stat-view/trend-chart.js +299 -0
- package/es/stat-view/world-map.js +443 -0
- package/es/tabs/index.js +252 -0
- package/es/tabs/statistic-tabs.module.css +154 -0
- package/es/tabs/tab.js +167 -0
- package/es/utils/basic-chart-utils.js +24 -0
- package/es/utils/cell-format.js +110 -0
- package/es/utils/cell-value.js +27 -0
- package/es/utils/collaborator.js +31 -0
- package/es/utils/color-utils.js +112 -0
- package/es/utils/column-utils.js +18 -0
- package/es/utils/column.js +13 -0
- package/es/utils/common-utils.js +303 -0
- package/es/utils/date-format.js +65 -0
- package/es/utils/export-table-utils.js +632 -0
- package/es/utils/index.js +26 -0
- package/es/utils/object.js +26 -0
- package/es/utils/row-utils.js +115 -0
- package/es/utils/search.js +67 -0
- package/es/utils/sql-utils.js +293 -0
- package/es/utils/stat-utils.js +353 -0
- package/es/utils/trend-utils.js +136 -0
- package/index.js +1 -0
- package/package.json +188 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import { CellType, filter2SqlCondition, TableUtils } from 'dtable-store';
|
|
8
|
+
import BaseCalculator from './base-calculator';
|
|
9
|
+
import { DTABLE_DB_SUMMARY_METHOD, STAT_TYPE, SUMMARY_TYPE, TIME_COLUMN_LIST, Y_AXIS_TYPE_PREFIX } from '../constants';
|
|
10
|
+
import { getSqlGroup, getSqlOrder } from '../utils/sql-utils';
|
|
11
|
+
import { formatNumericValue, getSummaryColumnMethod } from '../utils/common-utils';
|
|
12
|
+
import StatUtils from '../utils/stat-utils';
|
|
13
|
+
import { getColorFromSingleSelectColumn } from '../utils/column-utils';
|
|
14
|
+
import { getFormattedLabel } from '../utils/row-utils';
|
|
15
|
+
var BasicChartCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
16
|
+
_inherits(BasicChartCalculator, _BaseCalculator);
|
|
17
|
+
var _super = _createSuper(BasicChartCalculator);
|
|
18
|
+
function BasicChartCalculator(_ref) {
|
|
19
|
+
var value = _ref.value,
|
|
20
|
+
statisticThreadManager = _ref.statisticThreadManager,
|
|
21
|
+
username = _ref.username,
|
|
22
|
+
userId = _ref.userId;
|
|
23
|
+
_classCallCheck(this, BasicChartCalculator);
|
|
24
|
+
return _super.call(this, {
|
|
25
|
+
value: value,
|
|
26
|
+
statisticThreadManager: statisticThreadManager,
|
|
27
|
+
username: username,
|
|
28
|
+
userId: userId
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
_createClass(BasicChartCalculator, [{
|
|
32
|
+
key: "isValidChart",
|
|
33
|
+
value: function isValidChart(chart) {
|
|
34
|
+
if (!this.validateBaseConfigs(chart)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (chart.type === STAT_TYPE.CUSTOM_BAR) {
|
|
38
|
+
return this.isValidCustomBar(chart);
|
|
39
|
+
}
|
|
40
|
+
var table_id = chart.table_id,
|
|
41
|
+
groupby_column_key = chart.groupby_column_key,
|
|
42
|
+
x_axis_column_key = chart.x_axis_column_key,
|
|
43
|
+
summary_column_key = chart.summary_column_key,
|
|
44
|
+
y_axis_column_key = chart.y_axis_column_key;
|
|
45
|
+
var table = this.getTableById(table_id);
|
|
46
|
+
var groupbyColumnKey = groupby_column_key || x_axis_column_key;
|
|
47
|
+
if (!groupbyColumnKey || !TableUtils.getTableColumnByKey(table, groupbyColumnKey)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
var summaryColumnKey = summary_column_key || y_axis_column_key;
|
|
51
|
+
if (summaryColumnKey && !TableUtils.getTableColumnByKey(table, summaryColumnKey)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "isValidCustomBar",
|
|
58
|
+
value: function isValidCustomBar(chart) {
|
|
59
|
+
var table_id = chart.table_id,
|
|
60
|
+
x_axis_column_key = chart.x_axis_column_key,
|
|
61
|
+
y_axises = chart.y_axises;
|
|
62
|
+
var table = this.getTableById(table_id);
|
|
63
|
+
if (!table.columns.find(function (column) {
|
|
64
|
+
return column.key === x_axis_column_key;
|
|
65
|
+
}) || !Array.isArray(y_axises) || y_axises.length === 0 || y_axises.every(function (yAxis) {
|
|
66
|
+
return !Array.isArray(yAxis.column_groupby_numeric_columns) || yAxis.column_groupby_numeric_columns.length === 0;
|
|
67
|
+
})) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "calculate",
|
|
74
|
+
value: function () {
|
|
75
|
+
var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chart) {
|
|
76
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
77
|
+
while (1) {
|
|
78
|
+
switch (_context.prev = _context.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
if (this.isValidChart(chart)) {
|
|
81
|
+
_context.next = 2;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return _context.abrupt("return", []);
|
|
85
|
+
case 2:
|
|
86
|
+
if (!this.isCalcByQueryDB(chart)) {
|
|
87
|
+
_context.next = 6;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
_context.next = 5;
|
|
91
|
+
return this.queryDb(chart);
|
|
92
|
+
case 5:
|
|
93
|
+
return _context.abrupt("return", _context.sent);
|
|
94
|
+
case 6:
|
|
95
|
+
_context.next = 8;
|
|
96
|
+
return this.calculateWithWorker(chart);
|
|
97
|
+
case 8:
|
|
98
|
+
return _context.abrupt("return", _context.sent);
|
|
99
|
+
case 9:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context.stop();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, _callee, this);
|
|
105
|
+
}));
|
|
106
|
+
function calculate(_x) {
|
|
107
|
+
return _calculate.apply(this, arguments);
|
|
108
|
+
}
|
|
109
|
+
return calculate;
|
|
110
|
+
}()
|
|
111
|
+
}, {
|
|
112
|
+
key: "queryDb",
|
|
113
|
+
value: function () {
|
|
114
|
+
var _queryDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(chart) {
|
|
115
|
+
var table_id, view_id, groupby_column_key, summary_type, summary_method, summary_column_key, groupby_date_granularity, include_empty, groupby_geolocation_granularity, column_groupby_multiple_numeric_column, column_groupby_column_key, sortType, yAxisType, selectedTable, selectedView, groupbyColumn, sqlCondition, groupbyName, isTimeColumn, results, column_groupby_numeric_columns, summaryColumn, column_groupby_date_granularity, column_groupby_geolocation_granularity;
|
|
116
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
117
|
+
while (1) {
|
|
118
|
+
switch (_context2.prev = _context2.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
if (!(chart.type === STAT_TYPE.CUSTOM_BAR)) {
|
|
121
|
+
_context2.next = 2;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
return _context2.abrupt("return", this.queryDbFromCustomBar(chart));
|
|
125
|
+
case 2:
|
|
126
|
+
table_id = chart.table_id, view_id = chart.view_id;
|
|
127
|
+
column_groupby_column_key = chart.column_groupby_column_key;
|
|
128
|
+
sortType = chart.sort_type;
|
|
129
|
+
if (chart.type === STAT_TYPE.PIE || chart.type === STAT_TYPE.RING || chart.type === STAT_TYPE.TREEMAP) {
|
|
130
|
+
groupby_column_key = chart.groupby_column_key;
|
|
131
|
+
summary_type = chart.summary_type;
|
|
132
|
+
summary_method = chart.summary_method;
|
|
133
|
+
summary_column_key = chart.summary_column_key;
|
|
134
|
+
groupby_date_granularity = chart.groupby_date_granularity;
|
|
135
|
+
include_empty = chart.groupby_include_empty_cells;
|
|
136
|
+
groupby_geolocation_granularity = chart.groupby_geolocation_granularity;
|
|
137
|
+
} else {
|
|
138
|
+
groupby_column_key = chart.x_axis_column_key;
|
|
139
|
+
summary_type = chart.y_axis_summary_type;
|
|
140
|
+
summary_method = chart.y_axis_summary_method;
|
|
141
|
+
summary_column_key = chart.y_axis_column_key;
|
|
142
|
+
groupby_date_granularity = chart.x_axis_date_granularity;
|
|
143
|
+
groupby_geolocation_granularity = chart.x_axis_geolocation_granularity;
|
|
144
|
+
include_empty = chart.x_axis_include_empty;
|
|
145
|
+
}
|
|
146
|
+
yAxisType = null;
|
|
147
|
+
selectedTable = this.getTableById(table_id);
|
|
148
|
+
selectedView = this.getViewById(view_id, selectedTable);
|
|
149
|
+
if (selectedView) {
|
|
150
|
+
_context2.next = 11;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
return _context2.abrupt("return", []);
|
|
154
|
+
case 11:
|
|
155
|
+
groupbyColumn = TableUtils.getTableColumnByKey(selectedTable, groupby_column_key);
|
|
156
|
+
sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
157
|
+
groupbyName = "`".concat(groupbyColumn.name, "`");
|
|
158
|
+
isTimeColumn = TIME_COLUMN_LIST.includes(groupbyColumn.type);
|
|
159
|
+
if (isTimeColumn) {
|
|
160
|
+
groupbyName = getSqlGroup(groupby_date_granularity, groupbyColumn);
|
|
161
|
+
} else if (groupbyColumn.type === CellType.GEOLOCATION) {
|
|
162
|
+
groupbyName = getSqlGroup(groupby_geolocation_granularity, groupbyColumn);
|
|
163
|
+
}
|
|
164
|
+
if (!(!column_groupby_column_key && !column_groupby_multiple_numeric_column)) {
|
|
165
|
+
_context2.next = 22;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
_context2.next = 19;
|
|
169
|
+
return this.getNoneGroupbyResults(groupbyName, groupbyColumn, groupby_date_granularity, groupby_geolocation_granularity, include_empty, summary_type, summary_column_key, summary_method, sortType, sqlCondition, selectedTable, yAxisType);
|
|
170
|
+
case 19:
|
|
171
|
+
results = _context2.sent;
|
|
172
|
+
_context2.next = 36;
|
|
173
|
+
break;
|
|
174
|
+
case 22:
|
|
175
|
+
if (!column_groupby_multiple_numeric_column) {
|
|
176
|
+
_context2.next = 32;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
column_groupby_numeric_columns = chart.column_groupby_numeric_columns;
|
|
180
|
+
summaryColumn = TableUtils.getTableColumnByKey(selectedTable, summary_column_key);
|
|
181
|
+
if (summaryColumn) {
|
|
182
|
+
_context2.next = 27;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
return _context2.abrupt("return", []);
|
|
186
|
+
case 27:
|
|
187
|
+
_context2.next = 29;
|
|
188
|
+
return this.getGroupbyMultipleNumericColumnsResults(groupbyName, groupbyColumn, groupby_date_granularity, groupby_geolocation_granularity, include_empty, summary_type, summaryColumn, summary_method, column_groupby_numeric_columns, sqlCondition, selectedTable, yAxisType);
|
|
189
|
+
case 29:
|
|
190
|
+
results = _context2.sent;
|
|
191
|
+
_context2.next = 36;
|
|
192
|
+
break;
|
|
193
|
+
case 32:
|
|
194
|
+
column_groupby_date_granularity = chart.column_groupby_date_granularity, column_groupby_geolocation_granularity = chart.column_groupby_geolocation_granularity;
|
|
195
|
+
_context2.next = 35;
|
|
196
|
+
return this.getGroupbyOneColumnResults(groupbyName, groupbyColumn, groupby_date_granularity, groupby_geolocation_granularity, include_empty, summary_type, summary_column_key, summary_method, column_groupby_column_key, column_groupby_date_granularity, column_groupby_geolocation_granularity, sqlCondition, selectedTable, yAxisType);
|
|
197
|
+
case 35:
|
|
198
|
+
results = _context2.sent;
|
|
199
|
+
case 36:
|
|
200
|
+
sortType && StatUtils.sortStatisticData(results, sortType);
|
|
201
|
+
return _context2.abrupt("return", results);
|
|
202
|
+
case 38:
|
|
203
|
+
case "end":
|
|
204
|
+
return _context2.stop();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, _callee2, this);
|
|
208
|
+
}));
|
|
209
|
+
function queryDb(_x2) {
|
|
210
|
+
return _queryDb.apply(this, arguments);
|
|
211
|
+
}
|
|
212
|
+
return queryDb;
|
|
213
|
+
}()
|
|
214
|
+
}, {
|
|
215
|
+
key: "queryDbFromCustomBar",
|
|
216
|
+
value: function () {
|
|
217
|
+
var _queryDbFromCustomBar = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(chart) {
|
|
218
|
+
var table_id, view_id, x_axis_column_key, x_axis_date_granularity, x_axis_geolocation_granularity, x_axis_include_empty, y_axises, sort_type, selectedTable, selectedView, groupbyColumn, sqlCondition, isTimeColumn, groupbyName, summaryType, yAxisSummaryColumn, yAxisSummaryMethod, results, i, len, stack, yAxisType, column_groupby_numeric_columns, _yAxisType, currentResults;
|
|
219
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
220
|
+
while (1) {
|
|
221
|
+
switch (_context3.prev = _context3.next) {
|
|
222
|
+
case 0:
|
|
223
|
+
table_id = chart.table_id, view_id = chart.view_id, x_axis_column_key = chart.x_axis_column_key, x_axis_date_granularity = chart.x_axis_date_granularity, x_axis_geolocation_granularity = chart.x_axis_geolocation_granularity, x_axis_include_empty = chart.x_axis_include_empty, y_axises = chart.y_axises, sort_type = chart.sort_type;
|
|
224
|
+
selectedTable = this.getTableById(table_id);
|
|
225
|
+
selectedView = this.getViewById(view_id, selectedTable);
|
|
226
|
+
if (!(!selectedView || !x_axis_column_key || !Array.isArray(y_axises) || y_axises.length === 0)) {
|
|
227
|
+
_context3.next = 5;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
return _context3.abrupt("return", []);
|
|
231
|
+
case 5:
|
|
232
|
+
groupbyColumn = TableUtils.getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
233
|
+
if (groupbyColumn) {
|
|
234
|
+
_context3.next = 8;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
return _context3.abrupt("return", []);
|
|
238
|
+
case 8:
|
|
239
|
+
sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
240
|
+
isTimeColumn = TIME_COLUMN_LIST.includes(groupbyColumn.type);
|
|
241
|
+
groupbyName = "`".concat(groupbyColumn.name, "`");
|
|
242
|
+
if (isTimeColumn) {
|
|
243
|
+
groupbyName = getSqlGroup(x_axis_date_granularity, groupbyColumn);
|
|
244
|
+
} else if (groupbyColumn.type === CellType.GEOLOCATION) {
|
|
245
|
+
groupbyName = getSqlGroup(x_axis_geolocation_granularity, groupbyColumn);
|
|
246
|
+
}
|
|
247
|
+
summaryType = SUMMARY_TYPE.ADVANCED;
|
|
248
|
+
yAxisSummaryColumn = null;
|
|
249
|
+
yAxisSummaryMethod = null;
|
|
250
|
+
results = [];
|
|
251
|
+
i = 0, len = y_axises.length;
|
|
252
|
+
case 17:
|
|
253
|
+
if (!(i < len)) {
|
|
254
|
+
_context3.next = 31;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
stack = y_axises[i];
|
|
258
|
+
yAxisType = stack.type, column_groupby_numeric_columns = stack.column_groupby_numeric_columns;
|
|
259
|
+
if (!(yAxisType === STAT_TYPE.BAR_STACK)) {
|
|
260
|
+
_context3.next = 28;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
if (!(!Array.isArray(column_groupby_numeric_columns) || column_groupby_numeric_columns.length === 0)) {
|
|
264
|
+
_context3.next = 23;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
return _context3.abrupt("continue", 28);
|
|
268
|
+
case 23:
|
|
269
|
+
_yAxisType = "".concat(Y_AXIS_TYPE_PREFIX).concat(i);
|
|
270
|
+
_context3.next = 26;
|
|
271
|
+
return this.getGroupbyMultipleNumericColumnsResults(groupbyName, groupbyColumn, x_axis_date_granularity, x_axis_geolocation_granularity, x_axis_include_empty, summaryType, yAxisSummaryColumn, yAxisSummaryMethod, column_groupby_numeric_columns, sqlCondition, selectedTable, _yAxisType);
|
|
272
|
+
case 26:
|
|
273
|
+
currentResults = _context3.sent;
|
|
274
|
+
results = results.concat(currentResults);
|
|
275
|
+
case 28:
|
|
276
|
+
i++;
|
|
277
|
+
_context3.next = 17;
|
|
278
|
+
break;
|
|
279
|
+
case 31:
|
|
280
|
+
sort_type && StatUtils.sortStatisticData(results, sort_type);
|
|
281
|
+
return _context3.abrupt("return", results);
|
|
282
|
+
case 33:
|
|
283
|
+
case "end":
|
|
284
|
+
return _context3.stop();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}, _callee3, this);
|
|
288
|
+
}));
|
|
289
|
+
function queryDbFromCustomBar(_x3) {
|
|
290
|
+
return _queryDbFromCustomBar.apply(this, arguments);
|
|
291
|
+
}
|
|
292
|
+
return queryDbFromCustomBar;
|
|
293
|
+
}()
|
|
294
|
+
}, {
|
|
295
|
+
key: "getNoneGroupbyResults",
|
|
296
|
+
value: function () {
|
|
297
|
+
var _getNoneGroupbyResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(groupbyName, groupbyColumn, groupbyDateGranularity, groupbyGeolocationGranularity, includeEmpty, summaryType, summaryColumnKey, summaryMethod, sortType, sqlCondition, table, yAxisType) {
|
|
298
|
+
var _this = this;
|
|
299
|
+
var isAdvanced, selectedSummaryColumn, summaryColumnName, method, summaryColumnMethod, sqlOrder, sqlString, queryResult, data, newResult, valueKey;
|
|
300
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
301
|
+
while (1) {
|
|
302
|
+
switch (_context4.prev = _context4.next) {
|
|
303
|
+
case 0:
|
|
304
|
+
isAdvanced = summaryType === SUMMARY_TYPE.ADVANCED;
|
|
305
|
+
summaryColumnName = "`".concat(groupbyColumn.name, "`");
|
|
306
|
+
if (!isAdvanced) {
|
|
307
|
+
_context4.next = 7;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
selectedSummaryColumn = TableUtils.getTableColumnByKey(table, summaryColumnKey);
|
|
311
|
+
if (selectedSummaryColumn) {
|
|
312
|
+
_context4.next = 6;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
return _context4.abrupt("return", []);
|
|
316
|
+
case 6:
|
|
317
|
+
summaryColumnName = selectedSummaryColumn.name;
|
|
318
|
+
case 7:
|
|
319
|
+
method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[summaryMethod] : 'COUNT';
|
|
320
|
+
summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
321
|
+
sqlOrder = getSqlOrder(sortType, groupbyName);
|
|
322
|
+
sqlString = "select ".concat(groupbyName, ", ").concat(summaryColumnMethod, " from `").concat(table.name, "` ").concat(sqlCondition, " group by ").concat(groupbyName, " ").concat(sqlOrder, " limit 5000");
|
|
323
|
+
_context4.next = 13;
|
|
324
|
+
return this.sqlQuery(sqlString);
|
|
325
|
+
case 13:
|
|
326
|
+
queryResult = _context4.sent;
|
|
327
|
+
if (!(queryResult.status !== 200 || !queryResult.data.success)) {
|
|
328
|
+
_context4.next = 16;
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
return _context4.abrupt("return", []);
|
|
332
|
+
case 16:
|
|
333
|
+
data = queryResult.data;
|
|
334
|
+
if (data.results) {
|
|
335
|
+
_context4.next = 19;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
return _context4.abrupt("return", []);
|
|
339
|
+
case 19:
|
|
340
|
+
newResult = [];
|
|
341
|
+
valueKey = isAdvanced ? "".concat(summaryColumnMethod) : "".concat(method, "(").concat(groupbyColumn.name, ")");
|
|
342
|
+
data.results.forEach(function (item) {
|
|
343
|
+
var label = _this.getLabel(groupbyColumn, groupbyName, item, groupbyDateGranularity, groupbyGeolocationGranularity);
|
|
344
|
+
var value = item[valueKey] || 0;
|
|
345
|
+
if (isAdvanced) {
|
|
346
|
+
value = formatNumericValue(value, selectedSummaryColumn);
|
|
347
|
+
}
|
|
348
|
+
if (!includeEmpty && _this.isEmptyLabel(label)) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
newResult.push({
|
|
352
|
+
name: label,
|
|
353
|
+
value: value,
|
|
354
|
+
original_name: item[groupbyColumn.key],
|
|
355
|
+
y_axis_type: yAxisType
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
return _context4.abrupt("return", newResult);
|
|
359
|
+
case 23:
|
|
360
|
+
case "end":
|
|
361
|
+
return _context4.stop();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}, _callee4, this);
|
|
365
|
+
}));
|
|
366
|
+
function getNoneGroupbyResults(_x4, _x5, _x6, _x7, _x8, _x9, _x10, _x11, _x12, _x13, _x14, _x15) {
|
|
367
|
+
return _getNoneGroupbyResults.apply(this, arguments);
|
|
368
|
+
}
|
|
369
|
+
return getNoneGroupbyResults;
|
|
370
|
+
}()
|
|
371
|
+
}, {
|
|
372
|
+
key: "getGroupbyOneColumnResults",
|
|
373
|
+
value: function () {
|
|
374
|
+
var _getGroupbyOneColumnResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(groupbyName, groupbyColumn, groupbyDateGranularity, groupbyGeolocationGranularity, includeEmpty, summaryType, summaryColumnKey, summaryMethod, columnGroupbyColumnKey, columnGroupbyDateGranularity, columnGroupbyGeolocationGranularity, sqlCondition, table, yAxisType) {
|
|
375
|
+
var _this2 = this;
|
|
376
|
+
var isAdvanced, selectedSummaryColumn, summaryColumnName, columnGroupbyColumn, columnGroupbyColumnName, method, summaryColumnMethod, sqlString, queryResult, data, newResult, valueKey;
|
|
377
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
378
|
+
while (1) {
|
|
379
|
+
switch (_context5.prev = _context5.next) {
|
|
380
|
+
case 0:
|
|
381
|
+
isAdvanced = summaryType === SUMMARY_TYPE.ADVANCED;
|
|
382
|
+
summaryColumnName = "`".concat(groupbyColumn.name, "`");
|
|
383
|
+
if (!isAdvanced) {
|
|
384
|
+
_context5.next = 7;
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
selectedSummaryColumn = TableUtils.getTableColumnByKey(table, summaryColumnKey);
|
|
388
|
+
if (selectedSummaryColumn) {
|
|
389
|
+
_context5.next = 6;
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
return _context5.abrupt("return", []);
|
|
393
|
+
case 6:
|
|
394
|
+
summaryColumnName = selectedSummaryColumn.name;
|
|
395
|
+
case 7:
|
|
396
|
+
columnGroupbyColumn = TableUtils.getTableColumnByKey(table, columnGroupbyColumnKey);
|
|
397
|
+
columnGroupbyColumnName = "`".concat(columnGroupbyColumn.name, "`");
|
|
398
|
+
if (TIME_COLUMN_LIST.includes(columnGroupbyColumn.type)) {
|
|
399
|
+
columnGroupbyColumnName = getSqlGroup(columnGroupbyDateGranularity, columnGroupbyColumn);
|
|
400
|
+
} else if (columnGroupbyColumn.type === CellType.GEOLOCATION) {
|
|
401
|
+
columnGroupbyColumnName = getSqlGroup(columnGroupbyGeolocationGranularity, columnGroupbyColumn);
|
|
402
|
+
}
|
|
403
|
+
method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[summaryMethod] : 'COUNT';
|
|
404
|
+
summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
405
|
+
sqlString = "select ".concat(groupbyName, ", ").concat(columnGroupbyColumnName, ", ").concat(summaryColumnMethod, " from `").concat(table.name, "` ").concat(sqlCondition, " group by ").concat(groupbyName, ", ").concat(columnGroupbyColumnName, " order by ").concat(groupbyName, " limit 5000");
|
|
406
|
+
_context5.next = 15;
|
|
407
|
+
return this.sqlQuery(sqlString);
|
|
408
|
+
case 15:
|
|
409
|
+
queryResult = _context5.sent;
|
|
410
|
+
if (!(queryResult.status !== 200 || !queryResult.data.success)) {
|
|
411
|
+
_context5.next = 18;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
return _context5.abrupt("return", []);
|
|
415
|
+
case 18:
|
|
416
|
+
data = queryResult.data;
|
|
417
|
+
if (data.results) {
|
|
418
|
+
_context5.next = 21;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
return _context5.abrupt("return", []);
|
|
422
|
+
case 21:
|
|
423
|
+
newResult = [];
|
|
424
|
+
valueKey = isAdvanced ? "".concat(summaryColumnMethod) : "".concat(method, "(").concat(groupbyColumn.name, ")");
|
|
425
|
+
data.results.forEach(function (item) {
|
|
426
|
+
var value = item[valueKey] || 0;
|
|
427
|
+
if (isAdvanced) {
|
|
428
|
+
value = formatNumericValue(value, selectedSummaryColumn);
|
|
429
|
+
}
|
|
430
|
+
var label = _this2.getLabel(groupbyColumn, groupbyName, item, groupbyDateGranularity, groupbyGeolocationGranularity);
|
|
431
|
+
if (!includeEmpty && _this2.isEmptyLabel(label)) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
var color;
|
|
435
|
+
if (columnGroupbyColumn.type === CellType.SINGLE_SELECT) {
|
|
436
|
+
var tempValue = StatUtils.getGroupLabel(item[columnGroupbyColumn.key], {}, columnGroupbyColumn, columnGroupbyDateGranularity, columnGroupbyGeolocationGranularity, _this2.value);
|
|
437
|
+
color = getColorFromSingleSelectColumn(columnGroupbyColumn, tempValue);
|
|
438
|
+
}
|
|
439
|
+
var groupLabel = _this2.getLabel(columnGroupbyColumn, columnGroupbyColumnName, item, columnGroupbyDateGranularity, columnGroupbyGeolocationGranularity);
|
|
440
|
+
newResult.push({
|
|
441
|
+
value: value,
|
|
442
|
+
color: color,
|
|
443
|
+
name: label,
|
|
444
|
+
group_name: groupLabel,
|
|
445
|
+
group_original_name: item[columnGroupbyColumn.key],
|
|
446
|
+
original_name: item[groupbyColumn.key],
|
|
447
|
+
y_axis_type: yAxisType
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
return _context5.abrupt("return", newResult);
|
|
451
|
+
case 25:
|
|
452
|
+
case "end":
|
|
453
|
+
return _context5.stop();
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}, _callee5, this);
|
|
457
|
+
}));
|
|
458
|
+
function getGroupbyOneColumnResults(_x16, _x17, _x18, _x19, _x20, _x21, _x22, _x23, _x24, _x25, _x26, _x27, _x28, _x29) {
|
|
459
|
+
return _getGroupbyOneColumnResults.apply(this, arguments);
|
|
460
|
+
}
|
|
461
|
+
return getGroupbyOneColumnResults;
|
|
462
|
+
}()
|
|
463
|
+
}, {
|
|
464
|
+
key: "getGroupbyMultipleNumericColumnsResults",
|
|
465
|
+
value: function () {
|
|
466
|
+
var _getGroupbyMultipleNumericColumnsResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(groupbyName, groupbyColumn, groupbyDateGranularity, groupbyGeolocationGranularity, includeEmpty, summaryType, summaryColumn, summaryMethod, columnGroupbyNumericColumns, sqlCondition, table, yAxisType) {
|
|
467
|
+
var _this3 = this;
|
|
468
|
+
var isAdvanced, numericColumns, groupColumnNames, groupMethods, summaryColumnName, method, summaryColumnMethod, sqlString, result, data, newResult;
|
|
469
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
470
|
+
while (1) {
|
|
471
|
+
switch (_context6.prev = _context6.next) {
|
|
472
|
+
case 0:
|
|
473
|
+
isAdvanced = summaryType === SUMMARY_TYPE.ADVANCED;
|
|
474
|
+
numericColumns = [];
|
|
475
|
+
groupColumnNames = [];
|
|
476
|
+
groupMethods = [];
|
|
477
|
+
if (summaryColumn) {
|
|
478
|
+
summaryColumnName = isAdvanced ? summaryColumn.name : "`".concat(groupbyColumn.name, "`");
|
|
479
|
+
method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[summaryMethod] : 'COUNT';
|
|
480
|
+
summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
481
|
+
numericColumns.push(summaryColumn);
|
|
482
|
+
groupColumnNames.push(summaryColumnName);
|
|
483
|
+
groupMethods.push(summaryColumnMethod);
|
|
484
|
+
}
|
|
485
|
+
columnGroupbyNumericColumns.forEach(function (item) {
|
|
486
|
+
var numericColumn = TableUtils.getTableColumnByKey(table, item.column_key);
|
|
487
|
+
var groupColumnName = numericColumn.name;
|
|
488
|
+
numericColumns.push(numericColumn);
|
|
489
|
+
groupColumnNames.push(groupColumnName);
|
|
490
|
+
groupMethods.push(getSummaryColumnMethod(DTABLE_DB_SUMMARY_METHOD[item.summary_method], groupColumnName));
|
|
491
|
+
});
|
|
492
|
+
sqlString = "select ".concat(groupbyName, ", ").concat(groupMethods.join(','), " from `").concat(table.name, "` ").concat(sqlCondition, " group by ").concat(groupbyName, " order by ").concat(groupbyName, " limit 5000");
|
|
493
|
+
_context6.next = 9;
|
|
494
|
+
return this.sqlQuery(sqlString);
|
|
495
|
+
case 9:
|
|
496
|
+
result = _context6.sent;
|
|
497
|
+
if (!(result.status !== 200 || !result.data.success)) {
|
|
498
|
+
_context6.next = 12;
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
return _context6.abrupt("return", []);
|
|
502
|
+
case 12:
|
|
503
|
+
data = result.data;
|
|
504
|
+
if (data.results) {
|
|
505
|
+
_context6.next = 15;
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
return _context6.abrupt("return", []);
|
|
509
|
+
case 15:
|
|
510
|
+
newResult = [];
|
|
511
|
+
data.results.forEach(function (item) {
|
|
512
|
+
var label = _this3.getLabel(groupbyColumn, groupbyName, item, groupbyDateGranularity, groupbyGeolocationGranularity);
|
|
513
|
+
var isEmpty = _this3.isEmptyLabel(label);
|
|
514
|
+
var groupItems = [];
|
|
515
|
+
groupMethods.forEach(function (_, index) {
|
|
516
|
+
if (!includeEmpty && isEmpty) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
var value = item[groupMethods[index]] || 0;
|
|
520
|
+
var formatted_value = value;
|
|
521
|
+
if (isAdvanced) {
|
|
522
|
+
value = formatNumericValue(value, numericColumns[index]);
|
|
523
|
+
formatted_value = StatUtils.getFormattedValue(value, numericColumns[index]);
|
|
524
|
+
}
|
|
525
|
+
groupItems.push({
|
|
526
|
+
name: label,
|
|
527
|
+
value: value,
|
|
528
|
+
formatted_value: formatted_value,
|
|
529
|
+
group_name: groupColumnNames[index],
|
|
530
|
+
original_name: item[groupbyColumn.key],
|
|
531
|
+
y_axis_type: yAxisType
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
newResult = newResult.concat(groupItems);
|
|
535
|
+
});
|
|
536
|
+
return _context6.abrupt("return", newResult);
|
|
537
|
+
case 18:
|
|
538
|
+
case "end":
|
|
539
|
+
return _context6.stop();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}, _callee6, this);
|
|
543
|
+
}));
|
|
544
|
+
function getGroupbyMultipleNumericColumnsResults(_x30, _x31, _x32, _x33, _x34, _x35, _x36, _x37, _x38, _x39, _x40, _x41) {
|
|
545
|
+
return _getGroupbyMultipleNumericColumnsResults.apply(this, arguments);
|
|
546
|
+
}
|
|
547
|
+
return getGroupbyMultipleNumericColumnsResults;
|
|
548
|
+
}()
|
|
549
|
+
}, {
|
|
550
|
+
key: "getLabel",
|
|
551
|
+
value: function getLabel(groupColumn, groupName, item, groupby_date_granularity, groupby_geolocation_granularity) {
|
|
552
|
+
var isTimeColumn = TIME_COLUMN_LIST.includes(groupColumn.type);
|
|
553
|
+
var label;
|
|
554
|
+
if (isTimeColumn || groupColumn.type === CellType.GEOLOCATION) {
|
|
555
|
+
label = item[groupName];
|
|
556
|
+
} else {
|
|
557
|
+
var currentGroupLabel = item[groupColumn.key];
|
|
558
|
+
label = StatUtils.getGroupLabel(currentGroupLabel, {}, groupColumn, groupby_date_granularity, groupby_geolocation_granularity, this.value);
|
|
559
|
+
label = getFormattedLabel(groupColumn, label, this.value.collaborators);
|
|
560
|
+
}
|
|
561
|
+
return label;
|
|
562
|
+
}
|
|
563
|
+
}, {
|
|
564
|
+
key: "isEmptyLabel",
|
|
565
|
+
value: function isEmptyLabel(label) {
|
|
566
|
+
return !label;
|
|
567
|
+
}
|
|
568
|
+
}]);
|
|
569
|
+
return BasicChartCalculator;
|
|
570
|
+
}(BaseCalculator);
|
|
571
|
+
export default BasicChartCalculator;
|