dtable-statistic 4.3.2 → 4.3.3
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/es/api/dtable-db-api.js +10 -3
- package/es/calculator/base-calculator.js +20 -12
- package/es/calculator/basic-chart-calculator.js +72 -65
- package/es/calculator/combination-calculator.js +64 -57
- package/es/calculator/compare-bar-calculator.js +33 -26
- package/es/calculator/completeness-calculator.js +37 -30
- package/es/calculator/copy-value.js +7 -1
- package/es/calculator/dashboard-calculator.js +20 -13
- package/es/calculator/heat-map-calculator.js +25 -18
- package/es/calculator/horizontal-bar-calculator.js +15 -8
- package/es/calculator/index.js +42 -35
- package/es/calculator/map-calculator.js +29 -22
- package/es/calculator/mirror-calculator.js +27 -20
- package/es/calculator/number-card-calculator.js +17 -10
- package/es/calculator/pivot-table-calculator.js +65 -58
- package/es/calculator/scatter-calculator.js +21 -14
- package/es/calculator/thread-manager.js +7 -1
- package/es/calculator/trend-calculator.js +29 -22
- package/es/calculator/workers/basic-chart-calculator-worker.js +83 -76
- package/es/calculator/workers/calculator.worker.js +33 -30
- package/es/calculator/workers/card-calculator-worker.js +19 -13
- package/es/calculator/workers/combination-calculator-worker.js +53 -46
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +29 -22
- package/es/calculator/workers/completeness-calculator-worker.js +41 -34
- package/es/calculator/workers/dashboard-calculator-worker.js +24 -18
- package/es/calculator/workers/mirror-calculator-worker.js +29 -22
- package/es/calculator/workers/pivot-table-calculator-worker.js +84 -77
- package/es/calculator/workers/scatter-calculator-worker.js +27 -20
- package/es/calculator/workers/trend-calculator-worker.js +34 -27
- package/es/calculator/world-map-calculator.js +24 -17
- package/es/components/common-add-tool.js +12 -5
- package/es/components/dialog/chart-addition-edit-dialog.js +20 -12
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +110 -103
- package/es/components/dialog/color-theme-dialog.js +22 -15
- package/es/components/dialog/delete-confirmation-dialog.js +18 -11
- package/es/components/dialog/enlarged-chart-dialog.js +28 -20
- package/es/components/dialog/new-table-dialog.js +23 -16
- package/es/components/dialog/new-view-dialog.js +22 -15
- package/es/components/dialog/rename-view-dialog.js +22 -14
- package/es/components/dialog/statistic-record-dialog/index.js +45 -37
- package/es/components/dialog/statistic-types-dialog/index.js +22 -14
- package/es/components/dialog/table-select-dialog.js +23 -15
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +56 -43
- package/es/components/dtable-popover.js +19 -12
- package/es/components/dtable-search-input.js +21 -13
- package/es/components/dtable-select.js +20 -12
- package/es/components/icon.js +11 -4
- package/es/components/index.js +76 -11
- package/es/components/loading.js +10 -3
- package/es/components/modal-portal.js +12 -5
- package/es/components/popover/color-rules/color-rule.js +33 -25
- package/es/components/popover/color-rules/index.js +14 -6
- package/es/components/popover/color-rules/rule-filters/filter.js +35 -28
- package/es/components/popover/color-rules/rule-filters/index.js +25 -17
- package/es/components/popover/color-rules/rule-filters/number-input.js +17 -9
- package/es/components/popover/color-rules-popover.js +32 -24
- package/es/components/popover/color-selector-popover.js +17 -10
- package/es/components/seatable-radio/index.js +16 -9
- package/es/components/select/index.js +9 -2
- package/es/components/select/option-group.js +27 -19
- package/es/components/select/option.js +14 -6
- package/es/components/select/select.js +25 -17
- package/es/components/toast/alert.js +31 -24
- package/es/components/toast/index.js +10 -3
- package/es/components/toast/toast.js +20 -12
- package/es/components/toast/toastManager.js +17 -9
- package/es/components/toast/toaster.js +14 -6
- package/es/constants/color-rules.js +12 -6
- package/es/constants/dtable-select-style.js +9 -4
- package/es/constants/event-types.js +10 -4
- package/es/constants/index.js +96 -67
- package/es/constants/key-codes.js +2 -0
- package/es/constants/map.js +8 -2
- package/es/constants/model.js +26 -20
- package/es/constants/regions.js +8 -3
- package/es/constants/zIndexes.js +7 -1
- package/es/custom-g2.js +236 -208
- package/es/dashboard.js +58 -50
- package/es/desktop-dashboard.js +55 -47
- package/es/index.js +6 -3
- package/es/locale/index.js +13 -10
- package/es/locale/lang/de.js +7 -1
- package/es/locale/lang/en.js +7 -1
- package/es/locale/lang/fr.js +7 -1
- package/es/locale/lang/zh_CN.js +7 -1
- package/es/mobile-dashboard.js +46 -38
- package/es/model/bar-group.js +19 -11
- package/es/model/bar.js +18 -10
- package/es/model/base-model.js +9 -2
- package/es/model/basic-number-card.js +16 -8
- package/es/model/collaborators.js +9 -2
- package/es/model/combination.js +20 -12
- package/es/model/compare-bar.js +24 -16
- package/es/model/completeness-group.js +16 -8
- package/es/model/completeness.js +13 -5
- package/es/model/custom-bar.js +14 -6
- package/es/model/dashboard.js +14 -6
- package/es/model/generic-model.js +141 -133
- package/es/model/heat-map.js +19 -11
- package/es/model/horizontal-bar-group.js +18 -10
- package/es/model/horizontal-bar.js +18 -10
- package/es/model/index.js +185 -53
- package/es/model/map.js +23 -15
- package/es/model/mirror.js +21 -13
- package/es/model/pie.js +18 -10
- package/es/model/ring.js +19 -11
- package/es/model/scatter.js +14 -6
- package/es/model/statistic-dashboard.js +9 -2
- package/es/model/table.js +18 -10
- package/es/model/trend.js +20 -12
- package/es/model/world-map.js +21 -13
- package/es/service/chart-service.js +14 -7
- package/es/service/dashboard-service.js +42 -35
- package/es/service/map-json.js +14 -8
- package/es/stat-editor/chart-name-editor.js +15 -8
- package/es/stat-editor/index.js +24 -16
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +30 -22
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +57 -49
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +32 -24
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +11 -4
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +27 -19
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +51 -43
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +48 -40
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +29 -21
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +34 -26
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +55 -47
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +30 -22
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +35 -27
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +32 -24
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +41 -33
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +30 -22
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +25 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +54 -46
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +31 -23
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +34 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +85 -77
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +29 -21
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +81 -73
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +24 -16
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +27 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +59 -51
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +27 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +57 -49
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +20 -12
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +56 -48
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +17 -9
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +29 -21
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +38 -30
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +58 -50
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +25 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +56 -47
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +20 -12
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +19 -12
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +70 -62
- package/es/stat-editor/stat-settings/map/map-level.js +20 -13
- package/es/stat-editor/stat-settings/map/map-province-city.js +27 -20
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +19 -11
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +28 -20
- package/es/stat-editor/stat-settings/public-setting/calender.js +29 -22
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +13 -6
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +16 -9
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +21 -13
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +15 -8
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +19 -11
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +35 -27
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +15 -8
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +26 -18
- package/es/stat-list/chart-preview.js +33 -20
- package/es/stat-list/index.js +36 -28
- package/es/stat-view/area-chart.js +51 -44
- package/es/stat-view/bar-chart.js +55 -48
- package/es/stat-view/base-chart.js +32 -24
- package/es/stat-view/basic-number-card.js +26 -19
- package/es/stat-view/combination-chart.js +57 -50
- package/es/stat-view/compare-chart.js +47 -40
- package/es/stat-view/completeness-chart.js +37 -30
- package/es/stat-view/custom-bar.js +38 -31
- package/es/stat-view/dashboard-chart.js +22 -15
- package/es/stat-view/heat-map.js +50 -43
- package/es/stat-view/horizontal-bar-chart.js +59 -52
- package/es/stat-view/index.js +80 -73
- package/es/stat-view/line-chart.js +47 -40
- package/es/stat-view/map.js +40 -33
- package/es/stat-view/mirror.js +28 -21
- package/es/stat-view/pie-chart.js +36 -29
- package/es/stat-view/pivot-table/index.js +39 -32
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +39 -31
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +37 -29
- package/es/stat-view/pivot-table/pivot-table-display-name.js +54 -46
- package/es/stat-view/pivot-table/two-dimension-table.js +70 -62
- package/es/stat-view/ring-chart.js +46 -39
- package/es/stat-view/scatter-chart.js +37 -30
- package/es/stat-view/treemap-chart.js +45 -38
- package/es/stat-view/trend-chart.js +39 -32
- package/es/stat-view/world-map.js +40 -33
- package/es/tabs/index.js +40 -32
- package/es/tabs/tab.js +35 -27
- package/es/utils/basic-chart-utils.js +9 -2
- package/es/utils/cell-format.js +22 -14
- package/es/utils/cell-value.js +14 -7
- package/es/utils/collaborator.js +13 -4
- package/es/utils/color-utils.js +29 -18
- package/es/utils/column-utils.js +29 -18
- package/es/utils/column.js +11 -4
- package/es/utils/common-utils.js +67 -43
- package/es/utils/date-format.js +8 -2
- package/es/utils/export-table-utils.js +91 -82
- package/es/utils/index.js +100 -11
- package/es/utils/map.js +36 -26
- package/es/utils/model.js +14 -6
- package/es/utils/object.js +15 -6
- package/es/utils/pivot-table.js +23 -16
- package/es/utils/row-utils.js +34 -24
- package/es/utils/search.js +29 -21
- package/es/utils/sql-utils.js +75 -65
- package/es/utils/stat-utils.js +67 -60
- package/es/utils/trend-utils.js +40 -32
- package/package.json +82 -125
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
+
var _dtableStore = require("dtable-store");
|
|
10
|
+
var _baseCalculator = _interopRequireDefault(require("./base-calculator"));
|
|
11
|
+
var _sqlUtils = require("../utils/sql-utils");
|
|
12
|
+
var _statUtils = _interopRequireDefault(require("../utils/stat-utils"));
|
|
13
|
+
var _commonUtils = require("../utils/common-utils");
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
class CompareBarCalculator extends _baseCalculator.default {
|
|
9
16
|
constructor(_ref) {
|
|
10
17
|
let {
|
|
11
18
|
value,
|
|
@@ -35,9 +42,9 @@ class CompareBarCalculator extends BaseCalculator {
|
|
|
35
42
|
x_axis_compared_date_range_end
|
|
36
43
|
} = chart;
|
|
37
44
|
const table = this.getTableById(table_id);
|
|
38
|
-
if (!TableUtils.getTableColumnByKey(table, x_axis_column_key)) return false;
|
|
45
|
+
if (!_dtableStore.TableUtils.getTableColumnByKey(table, x_axis_column_key)) return false;
|
|
39
46
|
const summaryColumnKey = summary_column_key || y_axis_column_key;
|
|
40
|
-
if (summaryColumnKey && !TableUtils.getTableColumnByKey(table, summaryColumnKey)) return false;
|
|
47
|
+
if (summaryColumnKey && !_dtableStore.TableUtils.getTableColumnByKey(table, summaryColumnKey)) return false;
|
|
41
48
|
if (!x_axis_date_range_start || !x_axis_date_range_end || !x_axis_compared_date_range_start || !x_axis_compared_date_range_end) {
|
|
42
49
|
return false;
|
|
43
50
|
}
|
|
@@ -70,21 +77,21 @@ class CompareBarCalculator extends BaseCalculator {
|
|
|
70
77
|
} = chart;
|
|
71
78
|
const selectedTable = this.getTableById(table_id);
|
|
72
79
|
const selectedView = this.getViewById(view_id, selectedTable);
|
|
73
|
-
const selectedColumn = TableUtils.getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
74
|
-
const isAdvanced = y_axis_summary_type === SUMMARY_TYPE.ADVANCED;
|
|
75
|
-
const method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[y_axis_summary_method] : DTABLE_DB_SUMMARY_METHOD.Count;
|
|
80
|
+
const selectedColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
81
|
+
const isAdvanced = y_axis_summary_type === _constants.SUMMARY_TYPE.ADVANCED;
|
|
82
|
+
const method = isAdvanced ? _constants.DTABLE_DB_SUMMARY_METHOD[y_axis_summary_method] : _constants.DTABLE_DB_SUMMARY_METHOD.Count;
|
|
76
83
|
let sqlString = '';
|
|
77
|
-
let groupName = getSqlGroup('day', selectedColumn);
|
|
78
|
-
const sqlOrder = getSqlOrder(null, groupName);
|
|
84
|
+
let groupName = (0, _sqlUtils.getSqlGroup)('day', selectedColumn);
|
|
85
|
+
const sqlOrder = (0, _sqlUtils.getSqlOrder)(null, groupName);
|
|
79
86
|
let summaryColumnName = "".concat(selectedColumn.name);
|
|
80
87
|
let selectedSummaryColumn = {};
|
|
81
88
|
if (isAdvanced) {
|
|
82
|
-
selectedSummaryColumn = TableUtils.getTableColumnByKey(selectedTable, y_axis_column_key);
|
|
89
|
+
selectedSummaryColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, y_axis_column_key);
|
|
83
90
|
if (!selectedSummaryColumn) return [];
|
|
84
91
|
summaryColumnName = "".concat(selectedSummaryColumn.name);
|
|
85
92
|
}
|
|
86
|
-
const summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
87
|
-
let sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
93
|
+
const summaryColumnMethod = (0, _commonUtils.getSummaryColumnMethod)(method, summaryColumnName);
|
|
94
|
+
let sqlCondition = (0, _dtableStore.filter2SqlCondition)(selectedTable, selectedView);
|
|
88
95
|
sqlCondition = this.getStatItemSqlCondition(chart, sqlCondition, "`".concat(selectedColumn.name, "`"));
|
|
89
96
|
sqlString = "select ".concat(groupName, ", ").concat(summaryColumnMethod, " from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by ").concat(groupName, " ").concat(sqlOrder, " limit 5000");
|
|
90
97
|
const result = await this.sqlQuery(sqlString);
|
|
@@ -96,7 +103,7 @@ class CompareBarCalculator extends BaseCalculator {
|
|
|
96
103
|
const valueKey = isAdvanced ? "".concat(method, "(").concat(summaryColumnName, ")") : "".concat(method, "(").concat(selectedColumn.name, ")");
|
|
97
104
|
result.data.results.forEach(item => {
|
|
98
105
|
const name = item[groupName];
|
|
99
|
-
const label =
|
|
106
|
+
const label = _statUtils.default.getGroupLabel(name, item, selectedColumn, x_axis_date_granularity, '', this.value);
|
|
100
107
|
const value = item[valueKey];
|
|
101
108
|
if (name >= x_axis_date_range_start && name <= x_axis_date_range_end) {
|
|
102
109
|
const currentValue = dateRangeResult.get(label);
|
|
@@ -137,8 +144,8 @@ class CompareBarCalculator extends BaseCalculator {
|
|
|
137
144
|
let value = item[1];
|
|
138
145
|
let formatted_value = value;
|
|
139
146
|
if (isAdvanced) {
|
|
140
|
-
value = getSummaryResult(item[1], y_axis_summary_method, data.precision);
|
|
141
|
-
formatted_value =
|
|
147
|
+
value = (0, _commonUtils.getSummaryResult)(item[1], y_axis_summary_method, data.precision);
|
|
148
|
+
formatted_value = _statUtils.default.getFormattedValue(value, selectedSummaryColumn, y_axis_summary_method);
|
|
142
149
|
}
|
|
143
150
|
rangeResult.push({
|
|
144
151
|
name: item[0],
|
|
@@ -157,8 +164,8 @@ class CompareBarCalculator extends BaseCalculator {
|
|
|
157
164
|
let value = item[1];
|
|
158
165
|
let formatted_value = value;
|
|
159
166
|
if (isAdvanced) {
|
|
160
|
-
value = getSummaryResult(item[1], y_axis_summary_method, data.precision);
|
|
161
|
-
formatted_value =
|
|
167
|
+
value = (0, _commonUtils.getSummaryResult)(item[1], y_axis_summary_method, data.precision);
|
|
168
|
+
formatted_value = _statUtils.default.getFormattedValue(value, selectedSummaryColumn, y_axis_summary_method);
|
|
162
169
|
}
|
|
163
170
|
const newItem = {
|
|
164
171
|
name: dateRangeItem.name,
|
|
@@ -193,9 +200,9 @@ class CompareBarCalculator extends BaseCalculator {
|
|
|
193
200
|
x_axis_compared_date_range_end
|
|
194
201
|
} = chart;
|
|
195
202
|
const newSqlCondition = sqlCondition.length === 0 ? 'where ' : sqlCondition + ' AND';
|
|
196
|
-
const formattedXAxisDateRangeEnd =
|
|
197
|
-
const formattedXAxisComparedDateRangeEnd =
|
|
203
|
+
const formattedXAxisDateRangeEnd = (0, _dayjs.default)(x_axis_date_range_end).add(1, 'days').format('YYYY-MM-DD');
|
|
204
|
+
const formattedXAxisComparedDateRangeEnd = (0, _dayjs.default)(x_axis_compared_date_range_end).add(1, 'days').format('YYYY-MM-DD');
|
|
198
205
|
return newSqlCondition + " ((".concat(name, " >= '").concat(x_axis_date_range_start, "' AND ").concat(name, " < '").concat(formattedXAxisDateRangeEnd, "') Or (").concat(name, " >= '").concat(x_axis_compared_date_range_start, "' AND ").concat(name, " < '").concat(formattedXAxisComparedDateRangeEnd, "'))");
|
|
199
206
|
}
|
|
200
207
|
}
|
|
201
|
-
|
|
208
|
+
var _default = exports.default = CompareBarCalculator;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _dtableStore = require("dtable-store");
|
|
9
|
+
var _baseCalculator = _interopRequireDefault(require("./base-calculator"));
|
|
10
|
+
var _sqlUtils = require("../utils/sql-utils");
|
|
11
|
+
var _constants = require("../constants");
|
|
12
|
+
var _commonUtils = require("../utils/common-utils");
|
|
13
|
+
var _statUtils = _interopRequireDefault(require("../utils/stat-utils"));
|
|
14
|
+
var _rowUtils = require("../utils/row-utils");
|
|
15
|
+
class CompletenessCalculator extends _baseCalculator.default {
|
|
9
16
|
constructor(_ref) {
|
|
10
17
|
let {
|
|
11
18
|
value,
|
|
@@ -33,16 +40,16 @@ class CompletenessCalculator extends BaseCalculator {
|
|
|
33
40
|
group_column
|
|
34
41
|
} = chart;
|
|
35
42
|
const table = this.getTableById(table_id);
|
|
36
|
-
if (!TableUtils.getTableColumnByKey(table, name_column)) {
|
|
43
|
+
if (!_dtableStore.TableUtils.getTableColumnByKey(table, name_column)) {
|
|
37
44
|
return false;
|
|
38
45
|
}
|
|
39
|
-
if (!TableUtils.getTableColumnByKey(table, completed_column)) {
|
|
46
|
+
if (!_dtableStore.TableUtils.getTableColumnByKey(table, completed_column)) {
|
|
40
47
|
return false;
|
|
41
48
|
}
|
|
42
|
-
if (!TableUtils.getTableColumnByKey(table, target_column)) {
|
|
49
|
+
if (!_dtableStore.TableUtils.getTableColumnByKey(table, target_column)) {
|
|
43
50
|
return false;
|
|
44
51
|
}
|
|
45
|
-
if (type === STAT_TYPE.GROUP_COMPLETENESS_CHART && (!group_column || !TableUtils.getTableColumnByKey(table, group_column))) {
|
|
52
|
+
if (type === _constants.STAT_TYPE.GROUP_COMPLETENESS_CHART && (!group_column || !_dtableStore.TableUtils.getTableColumnByKey(table, group_column))) {
|
|
46
53
|
return false;
|
|
47
54
|
}
|
|
48
55
|
return true;
|
|
@@ -69,14 +76,14 @@ class CompletenessCalculator extends BaseCalculator {
|
|
|
69
76
|
if (!selectedView) {
|
|
70
77
|
return [];
|
|
71
78
|
}
|
|
72
|
-
const selectedColumn = TableUtils.getTableColumnByKey(selectedTable, name_column);
|
|
79
|
+
const selectedColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, name_column);
|
|
73
80
|
const groupName = "`".concat(selectedColumn.name, "`");
|
|
74
|
-
const sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
75
|
-
const completedColumn = TableUtils.getTableColumnByKey(selectedTable, completed_column);
|
|
76
|
-
const targetColumn = TableUtils.getTableColumnByKey(selectedTable, target_column);
|
|
77
|
-
const groupColumn = TableUtils.getTableColumnByKey(selectedTable, group_column);
|
|
78
|
-
const sqlOrder = getSqlOrder(null, groupName);
|
|
79
|
-
const isColumnDataAsAnArray = isArrayCellValue(selectedColumn);
|
|
81
|
+
const sqlCondition = (0, _dtableStore.filter2SqlCondition)(selectedTable, selectedView);
|
|
82
|
+
const completedColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, completed_column);
|
|
83
|
+
const targetColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, target_column);
|
|
84
|
+
const groupColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, group_column);
|
|
85
|
+
const sqlOrder = (0, _sqlUtils.getSqlOrder)(null, groupName);
|
|
86
|
+
const isColumnDataAsAnArray = (0, _commonUtils.isArrayCellValue)(selectedColumn);
|
|
80
87
|
const memo = new Map();
|
|
81
88
|
const resultList = [];
|
|
82
89
|
if (!groupColumn) {
|
|
@@ -91,11 +98,11 @@ class CompletenessCalculator extends BaseCalculator {
|
|
|
91
98
|
const name = item[selectedColumn.key];
|
|
92
99
|
let label;
|
|
93
100
|
if (name || Number.isFinite(name)) {
|
|
94
|
-
label =
|
|
101
|
+
label = _statUtils.default.getGroupLabel(name, item, selectedColumn, '', '', this.value);
|
|
95
102
|
if (isColumnDataAsAnArray) {
|
|
96
103
|
label = label[0];
|
|
97
104
|
}
|
|
98
|
-
label = getFormattedLabel(selectedColumn, label, this.value.collaborators);
|
|
105
|
+
label = (0, _rowUtils.getFormattedLabel)(selectedColumn, label, this.value.collaborators);
|
|
99
106
|
if (!memo.get(label)) {
|
|
100
107
|
const completedValue = item[completedColumn.key] || 0;
|
|
101
108
|
const targetValue = item[targetColumn.key] || 0;
|
|
@@ -130,13 +137,13 @@ class CompletenessCalculator extends BaseCalculator {
|
|
|
130
137
|
}
|
|
131
138
|
});
|
|
132
139
|
} else {
|
|
133
|
-
const isTimeGroupColumn = TIME_COLUMN_LIST.includes(groupColumn.type);
|
|
134
|
-
const isGroupColumnDataAsAnArray = isArrayCellValue(groupColumn);
|
|
140
|
+
const isTimeGroupColumn = _constants.TIME_COLUMN_LIST.includes(groupColumn.type);
|
|
141
|
+
const isGroupColumnDataAsAnArray = (0, _commonUtils.isArrayCellValue)(groupColumn);
|
|
135
142
|
const completedColumnName = "`".concat(completedColumn.name, "`");
|
|
136
143
|
const targetColumnName = "`".concat(targetColumn.name, "`");
|
|
137
144
|
let groupColumnName = "`".concat(groupColumn.name, "`");
|
|
138
145
|
if (isTimeGroupColumn) {
|
|
139
|
-
groupColumnName = getSqlGroup(date_granularity, groupColumn);
|
|
146
|
+
groupColumnName = (0, _sqlUtils.getSqlGroup)(date_granularity, groupColumn);
|
|
140
147
|
}
|
|
141
148
|
const sqlString = "select ".concat(groupName, ", ").concat(completedColumnName, ", ").concat(targetColumnName, ", ").concat(groupColumnName, " from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by ").concat(groupName, ", ").concat(completedColumnName, ", ").concat(targetColumnName, ", ").concat(groupColumnName, " ").concat(sqlOrder, " desc limit 5000");
|
|
142
149
|
const result = await this.sqlQuery(sqlString);
|
|
@@ -152,21 +159,21 @@ class CompletenessCalculator extends BaseCalculator {
|
|
|
152
159
|
|
|
153
160
|
// get and format name
|
|
154
161
|
if (name || Number.isFinite(name)) {
|
|
155
|
-
label =
|
|
162
|
+
label = _statUtils.default.getGroupLabel(name, item, selectedColumn, '', '', this.value);
|
|
156
163
|
if (isColumnDataAsAnArray) {
|
|
157
164
|
label = label[0];
|
|
158
165
|
}
|
|
159
|
-
label = getFormattedLabel(selectedColumn, label, this.value.collaborators);
|
|
166
|
+
label = (0, _rowUtils.getFormattedLabel)(selectedColumn, label, this.value.collaborators);
|
|
160
167
|
}
|
|
161
168
|
|
|
162
169
|
// get and format group name
|
|
163
170
|
if (!isTimeGroupColumn) {
|
|
164
171
|
groupLabel = item[groupColumn.key];
|
|
165
|
-
groupLabel =
|
|
172
|
+
groupLabel = _statUtils.default.getGroupLabel(groupLabel, item, groupColumn, '', '', this.value);
|
|
166
173
|
if (groupLabel && isGroupColumnDataAsAnArray) {
|
|
167
174
|
groupLabel = groupLabel[0];
|
|
168
175
|
}
|
|
169
|
-
groupLabel = getFormattedLabel(groupColumn, groupLabel, this.value.collaborators);
|
|
176
|
+
groupLabel = (0, _rowUtils.getFormattedLabel)(groupColumn, groupLabel, this.value.collaborators);
|
|
170
177
|
} else {
|
|
171
178
|
groupLabel = item[groupColumnName] + '';
|
|
172
179
|
}
|
|
@@ -174,7 +181,7 @@ class CompletenessCalculator extends BaseCalculator {
|
|
|
174
181
|
// get group color
|
|
175
182
|
let color = colorMap[groupLabel];
|
|
176
183
|
if (!color) {
|
|
177
|
-
color = PIE_CHART_COLORS[colorIndex % 12];
|
|
184
|
+
color = _constants.PIE_CHART_COLORS[colorIndex % 12];
|
|
178
185
|
colorMap[groupLabel] = color;
|
|
179
186
|
colorIndex++;
|
|
180
187
|
}
|
|
@@ -219,4 +226,4 @@ class CompletenessCalculator extends BaseCalculator {
|
|
|
219
226
|
return resultList;
|
|
220
227
|
}
|
|
221
228
|
}
|
|
222
|
-
|
|
229
|
+
var _default = exports.default = CompletenessCalculator;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
1
7
|
const IGNORE_KEYS = ['description', 'format_version', 'plugin_settings', 'plugins', 'statistics', 'version', 'scripts', 'settings'];
|
|
2
8
|
const TABLE_IGNORE_KEYS = ['summary_configs', 'is_header_locked'];
|
|
3
9
|
const copyValue = value => {
|
|
@@ -44,4 +50,4 @@ const copyValue = value => {
|
|
|
44
50
|
newValue.tables = newTables;
|
|
45
51
|
return newValue;
|
|
46
52
|
};
|
|
47
|
-
|
|
53
|
+
var _default = exports.default = copyValue;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _dtableStore = require("dtable-store");
|
|
9
|
+
var _constants = require("../constants");
|
|
10
|
+
var _commonUtils = require("../utils/common-utils");
|
|
11
|
+
var _baseCalculator = _interopRequireDefault(require("./base-calculator"));
|
|
12
|
+
class DashboardCalculator extends _baseCalculator.default {
|
|
6
13
|
constructor(_ref) {
|
|
7
14
|
let {
|
|
8
15
|
value,
|
|
@@ -27,8 +34,8 @@ class DashboardCalculator extends BaseCalculator {
|
|
|
27
34
|
total_value_column
|
|
28
35
|
} = chart;
|
|
29
36
|
const table = this.getTableById(table_id);
|
|
30
|
-
const selectedColumn1 = TableUtils.getTableColumnByKey(table, target_value_column);
|
|
31
|
-
const selectedColumn2 = TableUtils.getTableColumnByKey(table, total_value_column);
|
|
37
|
+
const selectedColumn1 = _dtableStore.TableUtils.getTableColumnByKey(table, target_value_column);
|
|
38
|
+
const selectedColumn2 = _dtableStore.TableUtils.getTableColumnByKey(table, total_value_column);
|
|
32
39
|
if (!selectedColumn1 || !selectedColumn2) {
|
|
33
40
|
return false;
|
|
34
41
|
}
|
|
@@ -52,11 +59,11 @@ class DashboardCalculator extends BaseCalculator {
|
|
|
52
59
|
} = chart;
|
|
53
60
|
const selectedTable = this.getTableById(table_id);
|
|
54
61
|
const selectedView = this.getViewById(view_id, selectedTable);
|
|
55
|
-
const selectedColumn1 = TableUtils.getTableColumnByKey(selectedTable, target_value_column);
|
|
56
|
-
const selectedColumn2 = TableUtils.getTableColumnByKey(selectedTable, total_value_column);
|
|
57
|
-
const sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
58
|
-
const key1 = getSummaryColumnMethod(DTABLE_DB_SUMMARY_METHOD[target_value_column_summary_method], selectedColumn1.name);
|
|
59
|
-
const key2 = getSummaryColumnMethod(DTABLE_DB_SUMMARY_METHOD[total_value_column_summary_method], selectedColumn2.name);
|
|
62
|
+
const selectedColumn1 = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, target_value_column);
|
|
63
|
+
const selectedColumn2 = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, total_value_column);
|
|
64
|
+
const sqlCondition = (0, _dtableStore.filter2SqlCondition)(selectedTable, selectedView);
|
|
65
|
+
const key1 = (0, _commonUtils.getSummaryColumnMethod)(_constants.DTABLE_DB_SUMMARY_METHOD[target_value_column_summary_method], selectedColumn1.name);
|
|
66
|
+
const key2 = (0, _commonUtils.getSummaryColumnMethod)(_constants.DTABLE_DB_SUMMARY_METHOD[total_value_column_summary_method], selectedColumn2.name);
|
|
60
67
|
const sqlString = "select ".concat(key1, ", ").concat(key2, " from `").concat(selectedTable.name, "` ").concat(sqlCondition, " limit 5000");
|
|
61
68
|
const result = await this.sqlQuery(sqlString);
|
|
62
69
|
if (result.status === 200 && result.data.success) {
|
|
@@ -74,4 +81,4 @@ class DashboardCalculator extends BaseCalculator {
|
|
|
74
81
|
return 0;
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
|
-
|
|
84
|
+
var _default = exports.default = DashboardCalculator;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
+
var _dtableStore = require("dtable-store");
|
|
10
|
+
var _baseCalculator = _interopRequireDefault(require("./base-calculator"));
|
|
11
|
+
var _commonUtils = require("../utils/common-utils");
|
|
12
|
+
var _constants = require("../constants");
|
|
13
|
+
class HeatMapCalculator extends _baseCalculator.default {
|
|
7
14
|
constructor(_ref) {
|
|
8
15
|
let {
|
|
9
16
|
value,
|
|
@@ -28,10 +35,10 @@ class HeatMapCalculator extends BaseCalculator {
|
|
|
28
35
|
summary_column
|
|
29
36
|
} = chart;
|
|
30
37
|
const table = this.getTableById(table_id);
|
|
31
|
-
if (!TableUtils.getTableColumnByKey(table, time_column)) {
|
|
38
|
+
if (!_dtableStore.TableUtils.getTableColumnByKey(table, time_column)) {
|
|
32
39
|
return false;
|
|
33
40
|
}
|
|
34
|
-
if (summary_column && !TableUtils.getTableColumnByKey(table, summary_column)) {
|
|
41
|
+
if (summary_column && !_dtableStore.TableUtils.getTableColumnByKey(table, summary_column)) {
|
|
35
42
|
return false;
|
|
36
43
|
}
|
|
37
44
|
return true;
|
|
@@ -49,7 +56,7 @@ class HeatMapCalculator extends BaseCalculator {
|
|
|
49
56
|
data.push(item);
|
|
50
57
|
return;
|
|
51
58
|
}
|
|
52
|
-
const year =
|
|
59
|
+
const year = (0, _dayjs.default)(item.name).year();
|
|
53
60
|
data.push({
|
|
54
61
|
...item,
|
|
55
62
|
year
|
|
@@ -75,21 +82,21 @@ class HeatMapCalculator extends BaseCalculator {
|
|
|
75
82
|
} = chart;
|
|
76
83
|
const selectedTable = this.getTableById(table_id);
|
|
77
84
|
const selectedView = this.getViewById(view_id, selectedTable);
|
|
78
|
-
const selectedColumn = TableUtils.getTableColumnByKey(selectedTable, time_column);
|
|
85
|
+
const selectedColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, time_column);
|
|
79
86
|
const columnName = selectedColumn.name;
|
|
80
87
|
const isAdvanced = summary_type === 'advanced';
|
|
81
|
-
const method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[summary_method] : 'COUNT';
|
|
82
|
-
const sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
88
|
+
const method = isAdvanced ? _constants.DTABLE_DB_SUMMARY_METHOD[summary_method] : 'COUNT';
|
|
89
|
+
const sqlCondition = (0, _dtableStore.filter2SqlCondition)(selectedTable, selectedView);
|
|
83
90
|
let summaryColumnName = '';
|
|
84
91
|
let summaryColumn;
|
|
85
92
|
let sqlString = '';
|
|
86
93
|
if (isAdvanced) {
|
|
87
|
-
summaryColumn = TableUtils.getTableColumnByKey(selectedTable, summary_column);
|
|
94
|
+
summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(selectedTable, summary_column);
|
|
88
95
|
if (!summaryColumn) {
|
|
89
96
|
return [];
|
|
90
97
|
}
|
|
91
98
|
summaryColumnName = summaryColumn.name;
|
|
92
|
-
const summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
99
|
+
const summaryColumnMethod = (0, _commonUtils.getSummaryColumnMethod)(method, summaryColumnName);
|
|
93
100
|
sqlString = "select `".concat(columnName, "`, ").concat(summaryColumnMethod, " from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by `").concat(columnName, "` limit 5000");
|
|
94
101
|
} else {
|
|
95
102
|
sqlString = "select `".concat(columnName, "`, ").concat(method, "(").concat(columnName, ") from `").concat(selectedTable.name, "` ").concat(sqlCondition, " group by `").concat(columnName, "` limit 5000");
|
|
@@ -99,18 +106,18 @@ class HeatMapCalculator extends BaseCalculator {
|
|
|
99
106
|
const data = result.data;
|
|
100
107
|
if (!data.results) return [];
|
|
101
108
|
const newResult = [];
|
|
102
|
-
const summaryColumnMethod = getSummaryColumnMethod(method, summaryColumnName);
|
|
109
|
+
const summaryColumnMethod = (0, _commonUtils.getSummaryColumnMethod)(method, summaryColumnName);
|
|
103
110
|
const valueKey = isAdvanced ? "".concat(summaryColumnMethod) : "".concat(method, "(").concat(columnName, ")");
|
|
104
111
|
data.results.forEach(item => {
|
|
105
112
|
const currentValue = item[time_column];
|
|
106
113
|
if (currentValue) {
|
|
107
114
|
let value = item[valueKey];
|
|
108
115
|
if (isAdvanced) {
|
|
109
|
-
value = formatNumericValue(value, summaryColumn);
|
|
116
|
+
value = (0, _commonUtils.formatNumericValue)(value, summaryColumn);
|
|
110
117
|
}
|
|
111
118
|
const name = typeof currentValue === 'string' ? currentValue : currentValue.country_region;
|
|
112
119
|
newResult.push({
|
|
113
|
-
name:
|
|
120
|
+
name: (0, _dayjs.default)(name).format('YYYY-MM-DD'),
|
|
114
121
|
value
|
|
115
122
|
});
|
|
116
123
|
}
|
|
@@ -152,4 +159,4 @@ class HeatMapCalculator extends BaseCalculator {
|
|
|
152
159
|
});
|
|
153
160
|
}
|
|
154
161
|
}
|
|
155
|
-
|
|
162
|
+
var _default = exports.default = HeatMapCalculator;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _basicChartCalculator = _interopRequireDefault(require("./basic-chart-calculator"));
|
|
9
|
+
var _constants = require("../constants");
|
|
3
10
|
class HorizontalBarCalculator {
|
|
4
11
|
constructor(_ref) {
|
|
5
12
|
let {
|
|
@@ -8,7 +15,7 @@ class HorizontalBarCalculator {
|
|
|
8
15
|
username,
|
|
9
16
|
userId
|
|
10
17
|
} = _ref;
|
|
11
|
-
this.basicChartCalculator = new
|
|
18
|
+
this.basicChartCalculator = new _basicChartCalculator.default({
|
|
12
19
|
value,
|
|
13
20
|
username,
|
|
14
21
|
userId,
|
|
@@ -42,10 +49,10 @@ class HorizontalBarCalculator {
|
|
|
42
49
|
column_groupby_numeric_columns
|
|
43
50
|
} = chart;
|
|
44
51
|
let sortType = chart.sort_type;
|
|
45
|
-
if (sortType === DATA_SORT_TYPE.ASCENDING) {
|
|
46
|
-
sortType = DATA_SORT_TYPE.DESCENDING;
|
|
47
|
-
} else if (sortType === DATA_SORT_TYPE.DESCENDING) {
|
|
48
|
-
sortType = DATA_SORT_TYPE.ASCENDING;
|
|
52
|
+
if (sortType === _constants.DATA_SORT_TYPE.ASCENDING) {
|
|
53
|
+
sortType = _constants.DATA_SORT_TYPE.DESCENDING;
|
|
54
|
+
} else if (sortType === _constants.DATA_SORT_TYPE.DESCENDING) {
|
|
55
|
+
sortType = _constants.DATA_SORT_TYPE.ASCENDING;
|
|
49
56
|
}
|
|
50
57
|
return {
|
|
51
58
|
type: 'bar',
|
|
@@ -68,4 +75,4 @@ class HorizontalBarCalculator {
|
|
|
68
75
|
};
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
|
-
|
|
78
|
+
var _default = exports.default = HorizontalBarCalculator;
|
package/es/calculator/index.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _pivotTableCalculator = _interopRequireDefault(require("./pivot-table-calculator"));
|
|
9
|
+
var _basicChartCalculator = _interopRequireDefault(require("./basic-chart-calculator"));
|
|
10
|
+
var _compareBarCalculator = _interopRequireDefault(require("./compare-bar-calculator"));
|
|
11
|
+
var _horizontalBarCalculator = _interopRequireDefault(require("./horizontal-bar-calculator"));
|
|
12
|
+
var _completenessCalculator = _interopRequireDefault(require("./completeness-calculator"));
|
|
13
|
+
var _scatterCalculator = _interopRequireDefault(require("./scatter-calculator"));
|
|
14
|
+
var _combinationCalculator = _interopRequireDefault(require("./combination-calculator"));
|
|
15
|
+
var _mapCalculator = _interopRequireDefault(require("./map-calculator"));
|
|
16
|
+
var _worldMapCalculator = _interopRequireDefault(require("./world-map-calculator"));
|
|
17
|
+
var _heatMapCalculator = _interopRequireDefault(require("./heat-map-calculator"));
|
|
18
|
+
var _mirrorCalculator = _interopRequireDefault(require("./mirror-calculator"));
|
|
19
|
+
var _numberCardCalculator = _interopRequireDefault(require("./number-card-calculator"));
|
|
20
|
+
var _trendCalculator = _interopRequireDefault(require("./trend-calculator"));
|
|
21
|
+
var _dashboardCalculator = _interopRequireDefault(require("./dashboard-calculator"));
|
|
22
|
+
var _constants = require("../constants");
|
|
16
23
|
const BASIC_CHART = 'basic_chart';
|
|
17
24
|
class ChartCalculator {
|
|
18
25
|
constructor(_ref) {
|
|
@@ -29,25 +36,25 @@ class ChartCalculator {
|
|
|
29
36
|
statisticThreadManager
|
|
30
37
|
};
|
|
31
38
|
this.chartCalculationMap = {
|
|
32
|
-
[STAT_TYPE.PIVOT_TABLE]: new
|
|
33
|
-
[BASIC_CHART]: new
|
|
34
|
-
[STAT_TYPE.COMPARE_BAR]: new
|
|
35
|
-
[STAT_TYPE.HORIZONTAL_BAR]: new
|
|
36
|
-
[STAT_TYPE.HORIZONTAL_GROUP_BAR]: new
|
|
37
|
-
[STAT_TYPE.STACKED_HORIZONTAL_BAR]: new
|
|
38
|
-
[STAT_TYPE.COMPLETENESS_CHART]: new
|
|
39
|
-
[STAT_TYPE.GROUP_COMPLETENESS_CHART]: new
|
|
40
|
-
[STAT_TYPE.SCATTER]: new
|
|
41
|
-
[STAT_TYPE.COMBINATION_CHART]: new
|
|
42
|
-
[STAT_TYPE.MAP]: new
|
|
43
|
-
[STAT_TYPE.MAP_BUBBLE]: new
|
|
44
|
-
[STAT_TYPE.WORLD_MAP]: new
|
|
45
|
-
[STAT_TYPE.WORLD_MAP_BUBBLE]: new
|
|
46
|
-
[STAT_TYPE.HEAT_MAP]: new
|
|
47
|
-
[STAT_TYPE.MIRROR]: new
|
|
48
|
-
[STAT_TYPE.BASIC_NUMBER_CARD]: new
|
|
49
|
-
[STAT_TYPE.TREND_CHART]: new
|
|
50
|
-
[STAT_TYPE.DASHBOARD]: new
|
|
39
|
+
[_constants.STAT_TYPE.PIVOT_TABLE]: new _pivotTableCalculator.default(configs),
|
|
40
|
+
[BASIC_CHART]: new _basicChartCalculator.default(configs),
|
|
41
|
+
[_constants.STAT_TYPE.COMPARE_BAR]: new _compareBarCalculator.default(configs),
|
|
42
|
+
[_constants.STAT_TYPE.HORIZONTAL_BAR]: new _horizontalBarCalculator.default(configs),
|
|
43
|
+
[_constants.STAT_TYPE.HORIZONTAL_GROUP_BAR]: new _horizontalBarCalculator.default(configs),
|
|
44
|
+
[_constants.STAT_TYPE.STACKED_HORIZONTAL_BAR]: new _horizontalBarCalculator.default(configs),
|
|
45
|
+
[_constants.STAT_TYPE.COMPLETENESS_CHART]: new _completenessCalculator.default(configs),
|
|
46
|
+
[_constants.STAT_TYPE.GROUP_COMPLETENESS_CHART]: new _completenessCalculator.default(configs),
|
|
47
|
+
[_constants.STAT_TYPE.SCATTER]: new _scatterCalculator.default(configs),
|
|
48
|
+
[_constants.STAT_TYPE.COMBINATION_CHART]: new _combinationCalculator.default(configs),
|
|
49
|
+
[_constants.STAT_TYPE.MAP]: new _mapCalculator.default(configs),
|
|
50
|
+
[_constants.STAT_TYPE.MAP_BUBBLE]: new _mapCalculator.default(configs),
|
|
51
|
+
[_constants.STAT_TYPE.WORLD_MAP]: new _worldMapCalculator.default(configs),
|
|
52
|
+
[_constants.STAT_TYPE.WORLD_MAP_BUBBLE]: new _worldMapCalculator.default(configs),
|
|
53
|
+
[_constants.STAT_TYPE.HEAT_MAP]: new _heatMapCalculator.default(configs),
|
|
54
|
+
[_constants.STAT_TYPE.MIRROR]: new _mirrorCalculator.default(configs),
|
|
55
|
+
[_constants.STAT_TYPE.BASIC_NUMBER_CARD]: new _numberCardCalculator.default(configs),
|
|
56
|
+
[_constants.STAT_TYPE.TREND_CHART]: new _trendCalculator.default(configs),
|
|
57
|
+
[_constants.STAT_TYPE.DASHBOARD]: new _dashboardCalculator.default(configs)
|
|
51
58
|
};
|
|
52
59
|
}
|
|
53
60
|
isValidChart(chart) {
|
|
@@ -69,4 +76,4 @@ class ChartCalculator {
|
|
|
69
76
|
return chartCalculation.calculate(chart);
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
|
-
|
|
79
|
+
var _default = exports.default = ChartCalculator;
|