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,225 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
8
|
+
import dayjs from 'dayjs';
|
|
9
|
+
import { filter2SqlCondition, TableUtils } from 'dtable-store';
|
|
10
|
+
import BaseCalculator from './base-calculator';
|
|
11
|
+
import { formatNumericValue, getSummaryColumnMethod } from '../utils/common-utils';
|
|
12
|
+
import { DTABLE_DB_SUMMARY_METHOD } from '../constants';
|
|
13
|
+
var HeatMapCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
14
|
+
_inherits(HeatMapCalculator, _BaseCalculator);
|
|
15
|
+
var _super = _createSuper(HeatMapCalculator);
|
|
16
|
+
function HeatMapCalculator(_ref) {
|
|
17
|
+
var value = _ref.value,
|
|
18
|
+
statisticThreadManager = _ref.statisticThreadManager,
|
|
19
|
+
username = _ref.username,
|
|
20
|
+
userId = _ref.userId;
|
|
21
|
+
_classCallCheck(this, HeatMapCalculator);
|
|
22
|
+
return _super.call(this, {
|
|
23
|
+
value: value,
|
|
24
|
+
statisticThreadManager: statisticThreadManager,
|
|
25
|
+
username: username,
|
|
26
|
+
userId: userId
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
_createClass(HeatMapCalculator, [{
|
|
30
|
+
key: "isValidChart",
|
|
31
|
+
value: function isValidChart(chart) {
|
|
32
|
+
if (!this.validateBaseConfigs(chart)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
var table_id = chart.table_id,
|
|
36
|
+
time_column = chart.time_column,
|
|
37
|
+
summary_column = chart.summary_column;
|
|
38
|
+
var table = this.getTableById(table_id);
|
|
39
|
+
if (!TableUtils.getTableColumnByKey(table, time_column)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (summary_column && !TableUtils.getTableColumnByKey(table, summary_column)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "calculate",
|
|
49
|
+
value: function () {
|
|
50
|
+
var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chart) {
|
|
51
|
+
var result, data, years;
|
|
52
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
53
|
+
while (1) {
|
|
54
|
+
switch (_context.prev = _context.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
if (this.isValidChart(chart)) {
|
|
57
|
+
_context.next = 2;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return _context.abrupt("return", {
|
|
61
|
+
data: [],
|
|
62
|
+
years: []
|
|
63
|
+
});
|
|
64
|
+
case 2:
|
|
65
|
+
if (!this.isCalcByQueryDB(chart)) {
|
|
66
|
+
_context.next = 8;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
_context.next = 5;
|
|
70
|
+
return this.queryDb(chart);
|
|
71
|
+
case 5:
|
|
72
|
+
_context.t0 = _context.sent;
|
|
73
|
+
_context.next = 11;
|
|
74
|
+
break;
|
|
75
|
+
case 8:
|
|
76
|
+
_context.next = 10;
|
|
77
|
+
return this.calculateWithWorker(this.convertChart(chart));
|
|
78
|
+
case 10:
|
|
79
|
+
_context.t0 = _context.sent;
|
|
80
|
+
case 11:
|
|
81
|
+
result = _context.t0;
|
|
82
|
+
data = [];
|
|
83
|
+
years = [];
|
|
84
|
+
result.forEach(function (item) {
|
|
85
|
+
if (!item.name) {
|
|
86
|
+
data.push(item);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var year = dayjs(item.name).year();
|
|
90
|
+
data.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
91
|
+
year: year
|
|
92
|
+
}));
|
|
93
|
+
if (years.indexOf(year) < 0) {
|
|
94
|
+
years.push(year);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
this.sortDataByYear(data);
|
|
98
|
+
return _context.abrupt("return", {
|
|
99
|
+
data: data,
|
|
100
|
+
years: years
|
|
101
|
+
});
|
|
102
|
+
case 17:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context.stop();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, _callee, this);
|
|
108
|
+
}));
|
|
109
|
+
function calculate(_x) {
|
|
110
|
+
return _calculate.apply(this, arguments);
|
|
111
|
+
}
|
|
112
|
+
return calculate;
|
|
113
|
+
}()
|
|
114
|
+
}, {
|
|
115
|
+
key: "queryDb",
|
|
116
|
+
value: function () {
|
|
117
|
+
var _queryDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(chart) {
|
|
118
|
+
var table_id, view_id, time_column, summary_type, summary_method, summary_column, selectedTable, selectedView, selectedColumn, columnName, isAdvanced, method, sqlCondition, summaryColumnName, summaryColumn, sqlString, summaryColumnMethod, result, data, newResult, _summaryColumnMethod, valueKey;
|
|
119
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
120
|
+
while (1) {
|
|
121
|
+
switch (_context2.prev = _context2.next) {
|
|
122
|
+
case 0:
|
|
123
|
+
table_id = chart.table_id, view_id = chart.view_id, time_column = chart.time_column, summary_type = chart.summary_type, summary_method = chart.summary_method, summary_column = chart.summary_column;
|
|
124
|
+
selectedTable = this.getTableById(table_id);
|
|
125
|
+
selectedView = this.getViewById(view_id, selectedTable);
|
|
126
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, time_column);
|
|
127
|
+
columnName = selectedColumn.name;
|
|
128
|
+
isAdvanced = summary_type === 'advanced';
|
|
129
|
+
method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[summary_method] : 'COUNT';
|
|
130
|
+
sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
131
|
+
summaryColumnName = '';
|
|
132
|
+
sqlString = '';
|
|
133
|
+
if (isAdvanced) {
|
|
134
|
+
summaryColumn = TableUtils.getTableColumnByKey(selectedTable, summary_column);
|
|
135
|
+
summaryColumnName = summaryColumn.name;
|
|
136
|
+
summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
137
|
+
sqlString = "select `".concat(columnName, "`, ").concat(summaryColumnMethod, " from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by `").concat(columnName, "` limit 5000");
|
|
138
|
+
} else {
|
|
139
|
+
sqlString = "select `".concat(columnName, "`, ").concat(method, "(").concat(columnName, ") from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by `").concat(columnName, "` limit 5000");
|
|
140
|
+
}
|
|
141
|
+
_context2.next = 13;
|
|
142
|
+
return this.sqlQuery(sqlString);
|
|
143
|
+
case 13:
|
|
144
|
+
result = _context2.sent;
|
|
145
|
+
if (!(result.status === 200 && result.data.success)) {
|
|
146
|
+
_context2.next = 23;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
data = result.data;
|
|
150
|
+
if (data.results) {
|
|
151
|
+
_context2.next = 18;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
return _context2.abrupt("return", []);
|
|
155
|
+
case 18:
|
|
156
|
+
newResult = [];
|
|
157
|
+
_summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
158
|
+
valueKey = isAdvanced ? "".concat(_summaryColumnMethod) : "".concat(method, "(").concat(columnName, ")");
|
|
159
|
+
data.results.forEach(function (item) {
|
|
160
|
+
var currentValue = item[time_column];
|
|
161
|
+
if (currentValue) {
|
|
162
|
+
var value = item[valueKey];
|
|
163
|
+
if (isAdvanced) {
|
|
164
|
+
value = formatNumericValue(value, summaryColumn);
|
|
165
|
+
}
|
|
166
|
+
var name = typeof currentValue === 'string' ? currentValue : currentValue.country_region;
|
|
167
|
+
newResult.push({
|
|
168
|
+
name: dayjs(name).format('YYYY-MM-DD'),
|
|
169
|
+
value: value
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
return _context2.abrupt("return", newResult);
|
|
174
|
+
case 23:
|
|
175
|
+
return _context2.abrupt("return", []);
|
|
176
|
+
case 24:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context2.stop();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, _callee2, this);
|
|
182
|
+
}));
|
|
183
|
+
function queryDb(_x2) {
|
|
184
|
+
return _queryDb.apply(this, arguments);
|
|
185
|
+
}
|
|
186
|
+
return queryDb;
|
|
187
|
+
}()
|
|
188
|
+
}, {
|
|
189
|
+
key: "convertChart",
|
|
190
|
+
value: function convertChart(chart) {
|
|
191
|
+
var _id = chart._id,
|
|
192
|
+
table_id = chart.table_id,
|
|
193
|
+
view_id = chart.view_id,
|
|
194
|
+
time_column = chart.time_column,
|
|
195
|
+
summary_type = chart.summary_type,
|
|
196
|
+
summary_column = chart.summary_column,
|
|
197
|
+
summary_method = chart.summary_method;
|
|
198
|
+
return {
|
|
199
|
+
_id: _id,
|
|
200
|
+
table_id: table_id,
|
|
201
|
+
view_id: view_id,
|
|
202
|
+
x_axis_column_key: time_column,
|
|
203
|
+
y_axis_summary_type: summary_type,
|
|
204
|
+
y_axis_summary_method: summary_method,
|
|
205
|
+
y_axis_column_key: summary_column,
|
|
206
|
+
x_axis_date_granularity: 'day'
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
key: "sortDataByYear",
|
|
211
|
+
value: function sortDataByYear(data) {
|
|
212
|
+
data.sort(function (current, next) {
|
|
213
|
+
if (current.year > next.year) {
|
|
214
|
+
return -1;
|
|
215
|
+
} else if (current.year < next.year) {
|
|
216
|
+
return 1;
|
|
217
|
+
} else {
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}]);
|
|
223
|
+
return HeatMapCalculator;
|
|
224
|
+
}(BaseCalculator);
|
|
225
|
+
export default HeatMapCalculator;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 BasicChartCalculator from './basic-chart-calculator';
|
|
6
|
+
import { DATA_SORT_TYPE } from '../constants';
|
|
7
|
+
var HorizontalBarCalculator = /*#__PURE__*/function () {
|
|
8
|
+
function HorizontalBarCalculator(_ref) {
|
|
9
|
+
var value = _ref.value,
|
|
10
|
+
statisticThreadManager = _ref.statisticThreadManager,
|
|
11
|
+
username = _ref.username,
|
|
12
|
+
userId = _ref.userId;
|
|
13
|
+
_classCallCheck(this, HorizontalBarCalculator);
|
|
14
|
+
this.basicChartCalculator = new BasicChartCalculator({
|
|
15
|
+
value: value,
|
|
16
|
+
username: username,
|
|
17
|
+
userId: userId,
|
|
18
|
+
statisticThreadManager: statisticThreadManager
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
_createClass(HorizontalBarCalculator, [{
|
|
22
|
+
key: "isValidChart",
|
|
23
|
+
value: function isValidChart(chart) {
|
|
24
|
+
var convertedChart = this.convertChart(chart);
|
|
25
|
+
return this.basicChartCalculator.isValidChart(convertedChart);
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
key: "calculate",
|
|
29
|
+
value: function () {
|
|
30
|
+
var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chart) {
|
|
31
|
+
var convertedChart;
|
|
32
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
33
|
+
while (1) {
|
|
34
|
+
switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
convertedChart = this.convertChart(chart);
|
|
37
|
+
_context.next = 3;
|
|
38
|
+
return this.basicChartCalculator.calculate(convertedChart);
|
|
39
|
+
case 3:
|
|
40
|
+
return _context.abrupt("return", _context.sent);
|
|
41
|
+
case 4:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, _callee, this);
|
|
47
|
+
}));
|
|
48
|
+
function calculate(_x) {
|
|
49
|
+
return _calculate.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
return calculate;
|
|
52
|
+
}()
|
|
53
|
+
}, {
|
|
54
|
+
key: "convertChart",
|
|
55
|
+
value: function convertChart(chart) {
|
|
56
|
+
var _id = chart._id,
|
|
57
|
+
table_id = chart.table_id,
|
|
58
|
+
view_id = chart.view_id,
|
|
59
|
+
vertical_axis_column_key = chart.vertical_axis_column_key,
|
|
60
|
+
vertical_axis_date_granularity = chart.vertical_axis_date_granularity,
|
|
61
|
+
vertical_axis_geolocation_granularity = chart.vertical_axis_geolocation_granularity,
|
|
62
|
+
vertical_axis_include_empty = chart.vertical_axis_include_empty,
|
|
63
|
+
horizontal_axis_summary_type = chart.horizontal_axis_summary_type,
|
|
64
|
+
horizontal_axis_column_key = chart.horizontal_axis_column_key,
|
|
65
|
+
horizontal_axis_summary_method = chart.horizontal_axis_summary_method,
|
|
66
|
+
column_groupby_column_key = chart.column_groupby_column_key,
|
|
67
|
+
column_groupby_date_granularity = chart.column_groupby_date_granularity,
|
|
68
|
+
column_groupby_geolocation_granularity = chart.column_groupby_geolocation_granularity,
|
|
69
|
+
column_groupby_multiple_numeric_column = chart.column_groupby_multiple_numeric_column,
|
|
70
|
+
column_groupby_numeric_columns = chart.column_groupby_numeric_columns;
|
|
71
|
+
var sortType = chart.sort_type;
|
|
72
|
+
if (sortType === DATA_SORT_TYPE.ASCENDING) {
|
|
73
|
+
sortType = DATA_SORT_TYPE.DESCENDING;
|
|
74
|
+
} else if (sortType === DATA_SORT_TYPE.DESCENDING) {
|
|
75
|
+
sortType = DATA_SORT_TYPE.ASCENDING;
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
type: 'bar',
|
|
79
|
+
_id: _id,
|
|
80
|
+
table_id: table_id,
|
|
81
|
+
view_id: view_id,
|
|
82
|
+
y_axis_column_key: horizontal_axis_column_key,
|
|
83
|
+
x_axis_date_granularity: vertical_axis_date_granularity,
|
|
84
|
+
x_axis_geolocation_granularity: vertical_axis_geolocation_granularity,
|
|
85
|
+
x_axis_include_empty: vertical_axis_include_empty,
|
|
86
|
+
y_axis_summary_type: horizontal_axis_summary_type,
|
|
87
|
+
x_axis_column_key: vertical_axis_column_key,
|
|
88
|
+
y_axis_summary_method: horizontal_axis_summary_method,
|
|
89
|
+
column_groupby_column_key: column_groupby_column_key,
|
|
90
|
+
column_groupby_date_granularity: column_groupby_date_granularity,
|
|
91
|
+
column_groupby_geolocation_granularity: column_groupby_geolocation_granularity,
|
|
92
|
+
column_groupby_multiple_numeric_column: column_groupby_multiple_numeric_column,
|
|
93
|
+
column_groupby_numeric_columns: column_groupby_numeric_columns,
|
|
94
|
+
sort_type: sortType
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}]);
|
|
98
|
+
return HorizontalBarCalculator;
|
|
99
|
+
}();
|
|
100
|
+
export default HorizontalBarCalculator;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
+
import PivotTableCalculator from './pivot-table-calculator';
|
|
7
|
+
import BasicChartCalculator from './basic-chart-calculator';
|
|
8
|
+
import CompareBarCalculator from './compare-bar-calculator';
|
|
9
|
+
import HorizontalBarCalculator from './horizontal-bar-calculator';
|
|
10
|
+
import CompletenessCalculator from './completeness-calculator';
|
|
11
|
+
import ScatterCalculator from './scatter-calculator';
|
|
12
|
+
import CombinationCalculator from './combination-calculator';
|
|
13
|
+
import MapCalculator from './map-calculator';
|
|
14
|
+
import WorldMapCalculator from './world-map-calculator';
|
|
15
|
+
import HeatMapCalculator from './heat-map-calculator';
|
|
16
|
+
import MirrorCalculator from './mirror-calculator';
|
|
17
|
+
import NumberCardCalculator from './number-card-calculator';
|
|
18
|
+
import TrendCalculator from './trend-calculator';
|
|
19
|
+
import DashboardCalculator from './dashboard-calculator';
|
|
20
|
+
import { STAT_TYPE } from '../constants';
|
|
21
|
+
var BASIC_CHART = 'basic_chart';
|
|
22
|
+
var ChartCalculator = /*#__PURE__*/function () {
|
|
23
|
+
function ChartCalculator(_ref) {
|
|
24
|
+
var _this$chartCalculatio;
|
|
25
|
+
var username = _ref.username,
|
|
26
|
+
userId = _ref.userId,
|
|
27
|
+
value = _ref.value,
|
|
28
|
+
statisticThreadManager = _ref.statisticThreadManager;
|
|
29
|
+
_classCallCheck(this, ChartCalculator);
|
|
30
|
+
var configs = {
|
|
31
|
+
username: username,
|
|
32
|
+
userId: userId,
|
|
33
|
+
value: value,
|
|
34
|
+
statisticThreadManager: statisticThreadManager
|
|
35
|
+
};
|
|
36
|
+
this.chartCalculationMap = (_this$chartCalculatio = {}, _defineProperty(_this$chartCalculatio, STAT_TYPE.PIVOT_TABLE, new PivotTableCalculator(configs)), _defineProperty(_this$chartCalculatio, BASIC_CHART, new BasicChartCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.COMPARE_BAR, new CompareBarCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.HORIZONTAL_BAR, new HorizontalBarCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.HORIZONTAL_GROUP_BAR, new HorizontalBarCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.STACKED_HORIZONTAL_BAR, new HorizontalBarCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.COMPLETENESS_CHART, new CompletenessCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.GROUP_COMPLETENESS_CHART, new CompletenessCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.SCATTER, new ScatterCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.COMBINATION_CHART, new CombinationCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.MAP, new MapCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.MAP_BUBBLE, new MapCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.WORLD_MAP, new WorldMapCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.WORLD_MAP_BUBBLE, new WorldMapCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.HEAT_MAP, new HeatMapCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.MIRROR, new MirrorCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.BASIC_NUMBER_CARD, new NumberCardCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.TREND_CHART, new TrendCalculator(configs)), _defineProperty(_this$chartCalculatio, STAT_TYPE.DASHBOARD, new DashboardCalculator(configs)), _this$chartCalculatio);
|
|
37
|
+
}
|
|
38
|
+
_createClass(ChartCalculator, [{
|
|
39
|
+
key: "isValidChart",
|
|
40
|
+
value: function isValidChart(chart) {
|
|
41
|
+
if (!chart) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
var chartCalculation = this.chartCalculationMap[chart.type];
|
|
45
|
+
if (!chartCalculation) {
|
|
46
|
+
return this.chartCalculationMap[BASIC_CHART].isValidChart(chart);
|
|
47
|
+
}
|
|
48
|
+
return chartCalculation ? chartCalculation.isValidChart(chart) : false;
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "calculate",
|
|
52
|
+
value: function () {
|
|
53
|
+
var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chart) {
|
|
54
|
+
var chartCalculation;
|
|
55
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
56
|
+
while (1) {
|
|
57
|
+
switch (_context.prev = _context.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
if (chart) {
|
|
60
|
+
_context.next = 2;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
return _context.abrupt("return", null);
|
|
64
|
+
case 2:
|
|
65
|
+
chartCalculation = this.chartCalculationMap[chart.type];
|
|
66
|
+
if (chartCalculation) {
|
|
67
|
+
_context.next = 5;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return _context.abrupt("return", this.chartCalculationMap[BASIC_CHART].calculate(chart));
|
|
71
|
+
case 5:
|
|
72
|
+
return _context.abrupt("return", chartCalculation.calculate(chart));
|
|
73
|
+
case 6:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context.stop();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, _callee, this);
|
|
79
|
+
}));
|
|
80
|
+
function calculate(_x) {
|
|
81
|
+
return _calculate.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
return calculate;
|
|
84
|
+
}()
|
|
85
|
+
}]);
|
|
86
|
+
return ChartCalculator;
|
|
87
|
+
}();
|
|
88
|
+
export default ChartCalculator;
|
|
@@ -0,0 +1,169 @@
|
|
|
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 { formatNumericValue, getSummaryColumnMethod } from '../utils/common-utils';
|
|
10
|
+
import { getSqlGroup } from '../utils/sql-utils';
|
|
11
|
+
import { DTABLE_DB_SUMMARY_METHOD } from '../constants';
|
|
12
|
+
var MapCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
13
|
+
_inherits(MapCalculator, _BaseCalculator);
|
|
14
|
+
var _super = _createSuper(MapCalculator);
|
|
15
|
+
function MapCalculator(_ref) {
|
|
16
|
+
var value = _ref.value,
|
|
17
|
+
statisticThreadManager = _ref.statisticThreadManager,
|
|
18
|
+
username = _ref.username,
|
|
19
|
+
userId = _ref.userId;
|
|
20
|
+
_classCallCheck(this, MapCalculator);
|
|
21
|
+
return _super.call(this, {
|
|
22
|
+
value: value,
|
|
23
|
+
statisticThreadManager: statisticThreadManager,
|
|
24
|
+
username: username,
|
|
25
|
+
userId: userId
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
_createClass(MapCalculator, [{
|
|
29
|
+
key: "isValidChart",
|
|
30
|
+
value: function isValidChart(chart) {
|
|
31
|
+
if (!this.validateBaseConfigs(chart)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
var table_id = chart.table_id,
|
|
35
|
+
geo_column = chart.geo_column,
|
|
36
|
+
summary_column = chart.summary_column;
|
|
37
|
+
var table = this.getTableById(table_id);
|
|
38
|
+
var selectedColumn = geo_column && TableUtils.getTableColumnByKey(table, geo_column);
|
|
39
|
+
if (geo_column && (!selectedColumn || selectedColumn.type !== CellType.GEOLOCATION)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (summary_column && !TableUtils.getTableColumnByKey(table, summary_column)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "calculate",
|
|
49
|
+
value: function () {
|
|
50
|
+
var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chart) {
|
|
51
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
52
|
+
while (1) {
|
|
53
|
+
switch (_context.prev = _context.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
if (this.isValidChart(chart)) {
|
|
56
|
+
_context.next = 2;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
return _context.abrupt("return", []);
|
|
60
|
+
case 2:
|
|
61
|
+
if (!this.isCalcByQueryDB(chart)) {
|
|
62
|
+
_context.next = 6;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
_context.next = 5;
|
|
66
|
+
return this.queryDb(chart);
|
|
67
|
+
case 5:
|
|
68
|
+
return _context.abrupt("return", _context.sent);
|
|
69
|
+
case 6:
|
|
70
|
+
_context.next = 8;
|
|
71
|
+
return this.calculateWithWorker(chart);
|
|
72
|
+
case 8:
|
|
73
|
+
return _context.abrupt("return", _context.sent);
|
|
74
|
+
case 9:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, _callee, this);
|
|
80
|
+
}));
|
|
81
|
+
function calculate(_x) {
|
|
82
|
+
return _calculate.apply(this, arguments);
|
|
83
|
+
}
|
|
84
|
+
return calculate;
|
|
85
|
+
}()
|
|
86
|
+
}, {
|
|
87
|
+
key: "queryDb",
|
|
88
|
+
value: function () {
|
|
89
|
+
var _queryDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(chart) {
|
|
90
|
+
var table_id, view_id, geo_column, summary_type, summary_method, summary_column, geolocation_granularity, selectedTable, selectedView, column, columnName, isAdvanced, method, sqlCondition, groupName, sqlString, summaryColumn, summaryColumnName, summaryColumnMethod, result, data, newResult, _summaryColumnMethod, valueKey;
|
|
91
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
92
|
+
while (1) {
|
|
93
|
+
switch (_context2.prev = _context2.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
table_id = chart.table_id, view_id = chart.view_id, geo_column = chart.geo_column, summary_type = chart.summary_type, summary_method = chart.summary_method, summary_column = chart.summary_column, geolocation_granularity = chart.geolocation_granularity;
|
|
96
|
+
selectedTable = this.getTableById(table_id);
|
|
97
|
+
selectedView = this.getViewById(view_id, selectedTable);
|
|
98
|
+
column = TableUtils.getTableColumnByKey(selectedTable, geo_column);
|
|
99
|
+
if (column) {
|
|
100
|
+
_context2.next = 6;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return _context2.abrupt("return", []);
|
|
104
|
+
case 6:
|
|
105
|
+
columnName = column.name;
|
|
106
|
+
isAdvanced = summary_type === 'advanced';
|
|
107
|
+
method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[summary_method] : 'COUNT';
|
|
108
|
+
sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
109
|
+
groupName = getSqlGroup(geolocation_granularity, column);
|
|
110
|
+
sqlString = '';
|
|
111
|
+
summaryColumnName = '';
|
|
112
|
+
if (isAdvanced) {
|
|
113
|
+
summaryColumn = TableUtils.getTableColumnByKey(selectedTable, summary_column);
|
|
114
|
+
summaryColumnName = summaryColumn.name;
|
|
115
|
+
summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
116
|
+
sqlString = "select ".concat(groupName, ", ").concat(summaryColumnMethod, " from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by ").concat(groupName, " limit 5000");
|
|
117
|
+
} else {
|
|
118
|
+
sqlString = "select ".concat(groupName, ", ").concat(method, "(`").concat(columnName, "`) from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by ").concat(groupName, " limit 5000");
|
|
119
|
+
}
|
|
120
|
+
_context2.next = 16;
|
|
121
|
+
return this.sqlQuery(sqlString);
|
|
122
|
+
case 16:
|
|
123
|
+
result = _context2.sent;
|
|
124
|
+
if (!(result.status === 200 && result.data.success)) {
|
|
125
|
+
_context2.next = 26;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
data = result.data;
|
|
129
|
+
if (data.results) {
|
|
130
|
+
_context2.next = 21;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return _context2.abrupt("return", []);
|
|
134
|
+
case 21:
|
|
135
|
+
newResult = [];
|
|
136
|
+
_summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
137
|
+
valueKey = isAdvanced ? "".concat(_summaryColumnMethod) : "".concat(method, "(").concat(columnName, ")");
|
|
138
|
+
data.results.forEach(function (item) {
|
|
139
|
+
var currentValue = item[groupName];
|
|
140
|
+
var value = item[valueKey];
|
|
141
|
+
if (isAdvanced) {
|
|
142
|
+
value = formatNumericValue(value, summaryColumn);
|
|
143
|
+
}
|
|
144
|
+
if (currentValue) {
|
|
145
|
+
newResult.push({
|
|
146
|
+
name: currentValue,
|
|
147
|
+
value: value
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
return _context2.abrupt("return", newResult);
|
|
152
|
+
case 26:
|
|
153
|
+
return _context2.abrupt("return", []);
|
|
154
|
+
case 27:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context2.stop();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, _callee2, this);
|
|
160
|
+
}));
|
|
161
|
+
function queryDb(_x2) {
|
|
162
|
+
return _queryDb.apply(this, arguments);
|
|
163
|
+
}
|
|
164
|
+
return queryDb;
|
|
165
|
+
}()
|
|
166
|
+
}]);
|
|
167
|
+
return MapCalculator;
|
|
168
|
+
}(BaseCalculator);
|
|
169
|
+
export default MapCalculator;
|