dtable-statistic 4.3.3 → 4.3.4
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 +3 -10
- package/es/calculator/base-calculator.js +12 -20
- package/es/calculator/basic-chart-calculator.js +65 -72
- package/es/calculator/combination-calculator.js +57 -64
- package/es/calculator/compare-bar-calculator.js +26 -33
- package/es/calculator/completeness-calculator.js +30 -37
- package/es/calculator/copy-value.js +1 -7
- package/es/calculator/dashboard-calculator.js +13 -20
- package/es/calculator/heat-map-calculator.js +18 -25
- package/es/calculator/horizontal-bar-calculator.js +8 -15
- package/es/calculator/index.js +35 -42
- package/es/calculator/map-calculator.js +22 -29
- package/es/calculator/mirror-calculator.js +20 -27
- package/es/calculator/number-card-calculator.js +10 -17
- package/es/calculator/pivot-table-calculator.js +58 -65
- package/es/calculator/scatter-calculator.js +14 -21
- package/es/calculator/thread-manager.js +1 -7
- package/es/calculator/trend-calculator.js +22 -29
- package/es/calculator/workers/basic-chart-calculator-worker.js +76 -83
- package/es/calculator/workers/calculator.worker.js +30 -33
- package/es/calculator/workers/card-calculator-worker.js +13 -19
- package/es/calculator/workers/combination-calculator-worker.js +46 -53
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +22 -29
- package/es/calculator/workers/completeness-calculator-worker.js +34 -41
- package/es/calculator/workers/dashboard-calculator-worker.js +18 -24
- package/es/calculator/workers/mirror-calculator-worker.js +22 -29
- package/es/calculator/workers/pivot-table-calculator-worker.js +77 -84
- package/es/calculator/workers/scatter-calculator-worker.js +20 -27
- package/es/calculator/workers/trend-calculator-worker.js +27 -34
- package/es/calculator/world-map-calculator.js +17 -24
- package/es/components/common-add-tool.js +5 -12
- package/es/components/dialog/chart-addition-edit-dialog.js +12 -20
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +101 -108
- package/es/components/dialog/color-theme-dialog.js +15 -22
- package/es/components/dialog/delete-confirmation-dialog.js +11 -18
- package/es/components/dialog/enlarged-chart-dialog.js +20 -28
- package/es/components/dialog/new-table-dialog.js +16 -23
- package/es/components/dialog/new-view-dialog.js +14 -21
- package/es/components/dialog/rename-view-dialog.js +14 -22
- package/es/components/dialog/statistic-record-dialog/index.js +37 -45
- package/es/components/dialog/statistic-types-dialog/index.js +14 -22
- package/es/components/dialog/table-select-dialog.js +15 -23
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +41 -49
- package/es/components/dtable-popover.js +12 -19
- package/es/components/dtable-search-input.js +13 -21
- package/es/components/dtable-select.js +15 -21
- package/es/components/icon.js +4 -11
- package/es/components/index.js +11 -76
- package/es/components/loading.js +3 -10
- package/es/components/modal-portal.js +5 -12
- package/es/components/popover/color-rules/color-rule.js +25 -33
- package/es/components/popover/color-rules/index.js +6 -14
- package/es/components/popover/color-rules/rule-filters/filter.js +27 -34
- package/es/components/popover/color-rules/rule-filters/index.js +17 -25
- package/es/components/popover/color-rules/rule-filters/number-input.js +9 -17
- package/es/components/popover/color-rules-popover.js +24 -32
- package/es/components/popover/color-selector-popover.js +10 -17
- package/es/components/seatable-radio/index.js +9 -16
- package/es/components/select/index.js +2 -9
- package/es/components/select/option-group.js +19 -27
- package/es/components/select/option.js +6 -14
- package/es/components/select/select.js +17 -25
- package/es/components/toast/alert.js +24 -31
- package/es/components/toast/index.js +3 -10
- package/es/components/toast/toast.js +12 -20
- package/es/components/toast/toastManager.js +9 -17
- package/es/components/toast/toaster.js +6 -14
- package/es/constants/color-rules.js +6 -12
- package/es/constants/dtable-select-style.js +4 -9
- package/es/constants/event-types.js +4 -10
- package/es/constants/index.js +67 -96
- package/es/constants/key-codes.js +0 -2
- package/es/constants/map.js +2 -8
- package/es/constants/model.js +20 -26
- package/es/constants/regions.js +3 -8
- package/es/constants/zIndexes.js +1 -7
- package/es/custom-g2.js +208 -236
- package/es/dashboard.js +50 -58
- package/es/desktop-dashboard.js +47 -55
- package/es/index.js +3 -6
- package/es/locale/index.js +10 -13
- package/es/locale/lang/de.js +1 -7
- package/es/locale/lang/en.js +1 -7
- package/es/locale/lang/fr.js +1 -7
- package/es/locale/lang/zh_CN.js +1 -7
- package/es/mobile-dashboard.js +38 -46
- package/es/model/bar-group.js +11 -19
- package/es/model/bar.js +10 -18
- package/es/model/base-model.js +2 -9
- package/es/model/basic-number-card.js +8 -16
- package/es/model/collaborators.js +2 -9
- package/es/model/combination.js +12 -20
- package/es/model/compare-bar.js +16 -24
- package/es/model/completeness-group.js +8 -16
- package/es/model/completeness.js +5 -13
- package/es/model/custom-bar.js +6 -14
- package/es/model/dashboard.js +6 -14
- package/es/model/generic-model.js +133 -141
- package/es/model/heat-map.js +11 -19
- package/es/model/horizontal-bar-group.js +10 -18
- package/es/model/horizontal-bar.js +10 -18
- package/es/model/index.js +53 -185
- package/es/model/map.js +15 -23
- package/es/model/mirror.js +13 -21
- package/es/model/pie.js +10 -18
- package/es/model/ring.js +11 -19
- package/es/model/scatter.js +6 -14
- package/es/model/statistic-dashboard.js +2 -9
- package/es/model/table.js +10 -18
- package/es/model/trend.js +12 -20
- package/es/model/world-map.js +13 -21
- package/es/service/chart-service.js +7 -14
- package/es/service/dashboard-service.js +34 -41
- package/es/service/map-json.js +8 -14
- package/es/stat-editor/chart-name-editor.js +8 -15
- package/es/stat-editor/index.js +16 -24
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +21 -29
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +49 -57
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +4 -11
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +43 -51
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +37 -45
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +26 -34
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +47 -55
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +22 -30
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +27 -35
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +24 -32
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +33 -41
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +22 -30
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +27 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +46 -54
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +23 -31
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +26 -34
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +77 -85
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +21 -29
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +73 -81
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +16 -24
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +19 -27
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +49 -57
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +47 -55
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +11 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +45 -53
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +9 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +20 -28
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +30 -38
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +50 -58
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +47 -55
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +11 -19
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +12 -19
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +62 -70
- package/es/stat-editor/stat-settings/map/map-level.js +13 -20
- package/es/stat-editor/stat-settings/map/map-province-city.js +20 -27
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +20 -28
- package/es/stat-editor/stat-settings/public-setting/calender.js +22 -29
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +6 -13
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +9 -16
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +13 -21
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +27 -35
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +18 -26
- package/es/stat-list/chart-preview.js +20 -28
- package/es/stat-list/index.js +27 -35
- package/es/stat-view/area-chart.js +43 -50
- package/es/stat-view/bar-chart.js +47 -54
- package/es/stat-view/base-chart.js +24 -32
- package/es/stat-view/basic-number-card.js +19 -26
- package/es/stat-view/combination-chart.js +49 -56
- package/es/stat-view/compare-chart.js +39 -46
- package/es/stat-view/completeness-chart.js +28 -35
- package/es/stat-view/custom-bar.js +31 -38
- package/es/stat-view/dashboard-chart.js +15 -22
- package/es/stat-view/heat-map.js +43 -50
- package/es/stat-view/horizontal-bar-chart.js +51 -58
- package/es/stat-view/index.js +73 -80
- package/es/stat-view/line-chart.js +39 -46
- package/es/stat-view/map.js +33 -40
- package/es/stat-view/mirror.js +21 -28
- package/es/stat-view/pie-chart.js +29 -36
- package/es/stat-view/pivot-table/index.js +32 -39
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +31 -39
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +29 -37
- package/es/stat-view/pivot-table/pivot-table-display-name.js +46 -54
- package/es/stat-view/pivot-table/two-dimension-table.js +62 -70
- package/es/stat-view/ring-chart.js +38 -45
- package/es/stat-view/scatter-chart.js +30 -37
- package/es/stat-view/treemap-chart.js +37 -44
- package/es/stat-view/trend-chart.js +32 -39
- package/es/stat-view/world-map.js +33 -40
- package/es/tabs/index.js +32 -40
- package/es/tabs/tab.js +26 -34
- package/es/utils/basic-chart-utils.js +2 -9
- package/es/utils/cell-format.js +14 -22
- package/es/utils/cell-value.js +7 -14
- package/es/utils/collaborator.js +4 -13
- package/es/utils/color-utils.js +18 -29
- package/es/utils/column-utils.js +18 -29
- package/es/utils/column.js +4 -11
- package/es/utils/common-utils.js +41 -65
- package/es/utils/date-format.js +2 -8
- package/es/utils/export-table-utils.js +82 -91
- package/es/utils/index.js +11 -100
- package/es/utils/map.js +26 -36
- package/es/utils/model.js +6 -14
- package/es/utils/object.js +6 -15
- package/es/utils/pivot-table.js +16 -23
- package/es/utils/row-utils.js +23 -33
- package/es/utils/search.js +21 -29
- package/es/utils/sql-utils.js +65 -75
- package/es/utils/stat-utils.js +60 -66
- package/es/utils/trend-utils.js +32 -40
- package/package.json +1 -1
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
-
var _dtableStore = require("dtable-store");
|
|
12
|
-
var _pivotTableDisplayName = _interopRequireDefault(require("./pivot-table-display-name"));
|
|
13
|
-
var _utils = require("../../utils");
|
|
14
|
-
var _pivotTable = require("../../utils/pivot-table");
|
|
15
|
-
var _constants = require("../../constants");
|
|
16
|
-
var _statisticPivotTableModule = _interopRequireDefault(require("./statistic-pivot-table.module.css"));
|
|
17
|
-
class TwoDimensionTable extends _react.PureComponent {
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import intl from 'react-intl-universal';
|
|
3
|
+
import { isNumber, TableUtils, Views } from 'dtable-store';
|
|
4
|
+
import PivotTableDisplayName from './pivot-table-display-name';
|
|
5
|
+
import { isMobile } from '../../utils';
|
|
6
|
+
import { getPivotTableSummaryTotal } from '../../utils/pivot-table';
|
|
7
|
+
import { STATISTICS_COUNT_TYPE, TITLE_TOTAL } from '../../constants';
|
|
8
|
+
import styles from './statistic-pivot-table.module.css';
|
|
9
|
+
class TwoDimensionTable extends PureComponent {
|
|
18
10
|
constructor() {
|
|
19
11
|
var _this;
|
|
20
12
|
super(...arguments);
|
|
@@ -24,7 +16,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
24
16
|
isColumn = false,
|
|
25
17
|
isRow = false
|
|
26
18
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
-
if (
|
|
19
|
+
if (isMobile) return;
|
|
28
20
|
_this.props.toggleStatisticRecordsDialog(cell, _this.props.statItem, {
|
|
29
21
|
isColumn,
|
|
30
22
|
isRow
|
|
@@ -34,7 +26,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
34
26
|
let {
|
|
35
27
|
isCurrentView
|
|
36
28
|
} = _ref;
|
|
37
|
-
if (
|
|
29
|
+
if (isMobile) return;
|
|
38
30
|
const {
|
|
39
31
|
getTableById,
|
|
40
32
|
statItem
|
|
@@ -44,9 +36,9 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
44
36
|
view_id
|
|
45
37
|
} = statItem;
|
|
46
38
|
const table = getTableById(table_id);
|
|
47
|
-
const view =
|
|
39
|
+
const view = Views.getViewById(table.views, view_id);
|
|
48
40
|
let rows = [];
|
|
49
|
-
if (!
|
|
41
|
+
if (!Views.isArchiveView(view)) {
|
|
50
42
|
rows = recordsList.flat();
|
|
51
43
|
}
|
|
52
44
|
this.props.toggleStatisticRecordsDialog({
|
|
@@ -56,7 +48,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
56
48
|
});
|
|
57
49
|
};
|
|
58
50
|
this.getNumberValue = val => {
|
|
59
|
-
if (
|
|
51
|
+
if (isNumber(val)) {
|
|
60
52
|
return val;
|
|
61
53
|
}
|
|
62
54
|
return 0;
|
|
@@ -91,7 +83,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
91
83
|
method
|
|
92
84
|
} = column;
|
|
93
85
|
if (Array.isArray(rowData)) {
|
|
94
|
-
const sum =
|
|
86
|
+
const sum = getPivotTableSummaryTotal(type, key, sqlKey, STATISTICS_COUNT_TYPE.ADVANCED, method, rowData, formulaRows, isSqlQuery);
|
|
95
87
|
summary_multiple_columns.push(sum);
|
|
96
88
|
formatted_summary_multiple_columns.push(getSummaryValueDisplayString(column, sum, method));
|
|
97
89
|
return;
|
|
@@ -134,36 +126,36 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
134
126
|
pivot_summary_multiple_columns
|
|
135
127
|
} = pivotResult;
|
|
136
128
|
const isMultipleColumnHeader = column_groupby_multiple_numeric_column && column_groupby_column_key && pivot_summary_multiple_columns.length !== 0;
|
|
137
|
-
return /*#__PURE__*/
|
|
129
|
+
return /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
138
130
|
className: "pivot-table-header"
|
|
139
131
|
}, !rowGroupName && groupName), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
|
|
140
132
|
const {
|
|
141
133
|
original_key
|
|
142
134
|
} = item;
|
|
143
|
-
return /*#__PURE__*/
|
|
135
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
144
136
|
className: 'pivot-table-header',
|
|
145
137
|
key: "pivot-column-".concat(index)
|
|
146
|
-
}, /*#__PURE__*/
|
|
138
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
147
139
|
value: original_key,
|
|
148
140
|
column: columnGroupbyColumn
|
|
149
141
|
}));
|
|
150
|
-
}), display_total && /*#__PURE__*/
|
|
142
|
+
}), display_total && /*#__PURE__*/React.createElement("th", {
|
|
151
143
|
className: 'pivot-table-header'
|
|
152
|
-
}, /*#__PURE__*/
|
|
144
|
+
}, /*#__PURE__*/React.createElement("div", null, intl.get(TITLE_TOTAL)))), isMultipleColumnHeader && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
153
145
|
className: "pivot-table-header"
|
|
154
146
|
}), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
|
|
155
|
-
return /*#__PURE__*/
|
|
156
|
-
className: "pivot-table-header ".concat(
|
|
147
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
148
|
+
className: "pivot-table-header ".concat(styles['pivot-summary-multiple-columns-th']),
|
|
157
149
|
key: "pivot-column-".concat(index)
|
|
158
|
-
}, /*#__PURE__*/
|
|
159
|
-
className:
|
|
150
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: styles['pivot-summary-multiple-columns-div']
|
|
160
152
|
}, pivot_summary_multiple_columns.map((item, index) => {
|
|
161
|
-
return /*#__PURE__*/
|
|
153
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
162
154
|
key: index
|
|
163
155
|
}, item.column_name);
|
|
164
156
|
})));
|
|
165
|
-
}), display_total && /*#__PURE__*/
|
|
166
|
-
className: "pivot-table-header ".concat(
|
|
157
|
+
}), display_total && /*#__PURE__*/React.createElement("th", {
|
|
158
|
+
className: "pivot-table-header ".concat(styles['pivot-empty-cell'])
|
|
167
159
|
})));
|
|
168
160
|
};
|
|
169
161
|
this.renderRowTotal = (isValidSummaryDisplayValue, summaryDisplayValue, cells, pivotRowCells, rowItem, firstSummaryColumnFromMultiple) => {
|
|
@@ -171,8 +163,8 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
171
163
|
if (firstSummaryColumnFromMultiple) {
|
|
172
164
|
rowTotal = this.props.getSummaryValueDisplayString(firstSummaryColumnFromMultiple, summaryDisplayValue, firstSummaryColumnFromMultiple.method);
|
|
173
165
|
}
|
|
174
|
-
return /*#__PURE__*/
|
|
175
|
-
className: "".concat(
|
|
166
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
167
|
+
className: "".concat(styles['pivot-cell'], " ").concat(isValidSummaryDisplayValue ? '' : styles['pivot-empty-cell']),
|
|
176
168
|
title: isValidSummaryDisplayValue ? rowTotal : '',
|
|
177
169
|
onClick: () => this.toggleRecords({
|
|
178
170
|
rows: Array.isArray(cells) && cells.length > 0 ? pivotRowCells : rowItem.rows,
|
|
@@ -182,7 +174,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
182
174
|
}, {
|
|
183
175
|
isRow: true
|
|
184
176
|
})
|
|
185
|
-
}, isValidSummaryDisplayValue ? /*#__PURE__*/
|
|
177
|
+
}, isValidSummaryDisplayValue ? /*#__PURE__*/React.createElement("div", null, rowTotal) : /*#__PURE__*/React.createElement("i", null));
|
|
186
178
|
};
|
|
187
179
|
this.renderAllTotal = (allTotalDisplay, pivotColumnCells, firstSummaryColumnFromMultiple) => {
|
|
188
180
|
const isValidAllTotalDisplay = this.props.isValidValue(allTotalDisplay);
|
|
@@ -190,13 +182,13 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
190
182
|
if (firstSummaryColumnFromMultiple) {
|
|
191
183
|
allTotal = this.props.getSummaryValueDisplayString(firstSummaryColumnFromMultiple, allTotalDisplay, firstSummaryColumnFromMultiple.method);
|
|
192
184
|
}
|
|
193
|
-
return /*#__PURE__*/
|
|
194
|
-
className: "".concat(
|
|
185
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
186
|
+
className: "".concat(styles['pivot-cell'], " pivot-table-total ").concat(isValidAllTotalDisplay ? '' : styles['pivot-empty-cell']),
|
|
195
187
|
onClick: () => this.onClickTotals(pivotColumnCells, {
|
|
196
188
|
isCurrentView: true
|
|
197
189
|
}),
|
|
198
190
|
title: isValidAllTotalDisplay ? allTotal : ''
|
|
199
|
-
}, isValidAllTotalDisplay ? /*#__PURE__*/
|
|
191
|
+
}, isValidAllTotalDisplay ? /*#__PURE__*/React.createElement("div", null, allTotal) : /*#__PURE__*/React.createElement("i", null));
|
|
200
192
|
};
|
|
201
193
|
this.renderRows = _ref3 => {
|
|
202
194
|
let {
|
|
@@ -223,11 +215,11 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
223
215
|
formulaRows,
|
|
224
216
|
isSqlQuery = false
|
|
225
217
|
} = pivotResult;
|
|
226
|
-
const summaryColumn =
|
|
218
|
+
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
227
219
|
let allTotalDisplay = column_groupby_multiple_numeric_column ? 0 : getSummaryValueDisplayString(summaryColumn, pivot_table_total, summary_method);
|
|
228
220
|
let firstSummaryColumnFromMultiple = column_groupby_multiple_numeric_column && pivot_summary_multiple_columns[0] || null;
|
|
229
221
|
let pivotColumnCells = [];
|
|
230
|
-
return /*#__PURE__*/
|
|
222
|
+
return /*#__PURE__*/React.createElement("tbody", null, pivot_rows.map((rowItem, rowIdx) => {
|
|
231
223
|
const {
|
|
232
224
|
name,
|
|
233
225
|
original_name,
|
|
@@ -243,11 +235,11 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
243
235
|
summaryDisplayValue = 0;
|
|
244
236
|
}
|
|
245
237
|
const isValidSummaryDisplayValue = this.props.isValidValue(summaryDisplayValue);
|
|
246
|
-
return /*#__PURE__*/
|
|
238
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
247
239
|
key: 'table-row' + rowIdx
|
|
248
|
-
}, /*#__PURE__*/
|
|
240
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
249
241
|
className: 'pivot-row-name'
|
|
250
|
-
}, /*#__PURE__*/
|
|
242
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
251
243
|
value: original_name,
|
|
252
244
|
column: groupbyColumn
|
|
253
245
|
})), Array.isArray(cells) && cells.map((c, cellIdx) => {
|
|
@@ -267,8 +259,8 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
267
259
|
summary_multiple_columns.forEach(item => {
|
|
268
260
|
summaryDisplayValue += this.getNumberValue(item);
|
|
269
261
|
});
|
|
270
|
-
return /*#__PURE__*/
|
|
271
|
-
className: "".concat(
|
|
262
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
263
|
+
className: "".concat(styles['pivot-cell'], " ").concat(styles['pivot-summary-multiple-columns-td']),
|
|
272
264
|
key: "table-cell-".concat(cellIdx),
|
|
273
265
|
onClick: () => this.toggleRecords({
|
|
274
266
|
rows: c.rows,
|
|
@@ -278,19 +270,19 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
278
270
|
group_original_name: c.group_original_name,
|
|
279
271
|
original_name: rowItem.original_name
|
|
280
272
|
})
|
|
281
|
-
}, /*#__PURE__*/
|
|
282
|
-
className:
|
|
273
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
274
|
+
className: styles['pivot-summary-multiple-columns-div']
|
|
283
275
|
}, formatted_summary_multiple_columns.map((label, index) => {
|
|
284
|
-
return /*#__PURE__*/
|
|
276
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
285
277
|
key: index,
|
|
286
278
|
title: label
|
|
287
279
|
}, label);
|
|
288
|
-
})), /*#__PURE__*/
|
|
280
|
+
})), /*#__PURE__*/React.createElement("span", null));
|
|
289
281
|
}
|
|
290
282
|
const displayValue = getSummaryValueDisplayString(c.column, c.total, summary_method);
|
|
291
283
|
const isValidDisplayValue = this.props.isValidValue(displayValue);
|
|
292
|
-
return /*#__PURE__*/
|
|
293
|
-
className: "".concat(
|
|
284
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
285
|
+
className: "".concat(styles['pivot-cell'], " ").concat(isValidDisplayValue ? '' : styles['pivot-empty-cell']),
|
|
294
286
|
key: "table-cell-".concat(cellIdx),
|
|
295
287
|
title: isValidDisplayValue ? displayValue : '',
|
|
296
288
|
onClick: () => this.toggleRecords({
|
|
@@ -301,11 +293,11 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
301
293
|
group_original_name: c.group_original_name,
|
|
302
294
|
original_name: rowItem.original_name
|
|
303
295
|
})
|
|
304
|
-
}, isValidDisplayValue ? /*#__PURE__*/
|
|
296
|
+
}, isValidDisplayValue ? /*#__PURE__*/React.createElement("div", null, displayValue) : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", null));
|
|
305
297
|
}), display_total && this.renderRowTotal(isValidSummaryDisplayValue, summaryDisplayValue, cells, pivotRowCells, rowItem, firstSummaryColumnFromMultiple));
|
|
306
|
-
}), display_total && /*#__PURE__*/
|
|
298
|
+
}), display_total && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
307
299
|
className: 'pivot-column-total'
|
|
308
|
-
}, /*#__PURE__*/
|
|
300
|
+
}, /*#__PURE__*/React.createElement("div", null, intl.get(TITLE_TOTAL))), Array.isArray(pivot_columns) && pivot_columns.map((c, index) => {
|
|
309
301
|
const pivotColumnCell = pivotColumnCells[index] || [];
|
|
310
302
|
const pivotColumnTotal = pivot_columns_total[c.key];
|
|
311
303
|
let totalDisplayValue = 0;
|
|
@@ -319,7 +311,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
319
311
|
sqlKey,
|
|
320
312
|
method
|
|
321
313
|
} = summaryCol;
|
|
322
|
-
total +=
|
|
314
|
+
total += getPivotTableSummaryTotal(type, key, sqlKey, STATISTICS_COUNT_TYPE.ADVANCED, method, pivotColumnCell, formulaRows, isSqlQuery);
|
|
323
315
|
});
|
|
324
316
|
totalDisplayValue = total;
|
|
325
317
|
allTotalDisplay += total;
|
|
@@ -331,8 +323,8 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
331
323
|
totalDisplayValue = getSummaryValueDisplayString(summaryColumn, pivotColumnTotal, summary_method);
|
|
332
324
|
isValidTotalDisplayValue = this.props.isValidValue(totalDisplayValue);
|
|
333
325
|
}
|
|
334
|
-
return /*#__PURE__*/
|
|
335
|
-
className: "".concat(
|
|
326
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
327
|
+
className: "".concat(styles['pivot-cell'], " ").concat(isValidTotalDisplayValue ? '' : styles['pivot-empty-cell']),
|
|
336
328
|
key: "total-cell-".concat(index),
|
|
337
329
|
title: isValidTotalDisplayValue ? totalDisplayValue : '',
|
|
338
330
|
onClick: () => this.toggleRecords({
|
|
@@ -342,7 +334,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
342
334
|
}, {
|
|
343
335
|
isColumn: true
|
|
344
336
|
})
|
|
345
|
-
}, isValidTotalDisplayValue ? /*#__PURE__*/
|
|
337
|
+
}, isValidTotalDisplayValue ? /*#__PURE__*/React.createElement("div", null, totalDisplayValue) : /*#__PURE__*/React.createElement("i", null));
|
|
346
338
|
}), this.renderAllTotal(allTotalDisplay, pivotColumnCells, firstSummaryColumnFromMultiple)));
|
|
347
339
|
};
|
|
348
340
|
}
|
|
@@ -361,17 +353,17 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
361
353
|
column_groupby_column_key
|
|
362
354
|
} = statItem;
|
|
363
355
|
const table = getTableById(table_id);
|
|
364
|
-
const groupbyColumn =
|
|
365
|
-
const columnGroupbyColumn =
|
|
366
|
-
return /*#__PURE__*/
|
|
356
|
+
const groupbyColumn = TableUtils.getTableColumnByKey(table, groupby_column_key) || {};
|
|
357
|
+
const columnGroupbyColumn = TableUtils.getTableColumnByKey(table, column_groupby_column_key) || {};
|
|
358
|
+
return /*#__PURE__*/React.createElement("table", {
|
|
367
359
|
style: {
|
|
368
360
|
color: textColor
|
|
369
361
|
},
|
|
370
|
-
className: "".concat(isPreview ?
|
|
371
|
-
}, /*#__PURE__*/
|
|
372
|
-
className:
|
|
373
|
-
}, columnGroupbyColumn.name), /*#__PURE__*/
|
|
374
|
-
className:
|
|
362
|
+
className: "".concat(isPreview ? styles['preview-pivot-table'] : styles['large-pivot-table'], " ").concat(styles['pivot-table'])
|
|
363
|
+
}, /*#__PURE__*/React.createElement("caption", {
|
|
364
|
+
className: styles['column-title']
|
|
365
|
+
}, columnGroupbyColumn.name), /*#__PURE__*/React.createElement("caption", {
|
|
366
|
+
className: styles['row-title']
|
|
375
367
|
}, groupbyColumn.name), this.renderHeader({
|
|
376
368
|
groupbyColumn,
|
|
377
369
|
columnGroupbyColumn
|
|
@@ -381,4 +373,4 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
381
373
|
}));
|
|
382
374
|
}
|
|
383
375
|
}
|
|
384
|
-
|
|
376
|
+
export default TwoDimensionTable;
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
-
var _dtableStore = require("dtable-store");
|
|
12
|
-
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
13
|
-
var _customG = require("../custom-g2");
|
|
14
|
-
var _commonUtils = require("../utils/common-utils");
|
|
15
|
-
var _constants = require("../constants");
|
|
16
|
-
var _statisticChartModule = _interopRequireDefault(require("../assets/css/statistic-chart.module.css"));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import intl from 'react-intl-universal';
|
|
4
|
+
import { TableUtils } from 'dtable-store';
|
|
5
|
+
import BaseChart from './base-chart';
|
|
6
|
+
import { Chart } from '../custom-g2';
|
|
7
|
+
import { formatPieChartData, getCurrentTheme } from '../utils/common-utils';
|
|
8
|
+
import { DEFAULT_ANNOTATION_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_FORMATS, LABEL_POSITIONS, SUMMARY_TYPE, TITLE_TOTAL } from '../constants';
|
|
9
|
+
import chartStyles from '../assets/css/statistic-chart.module.css';
|
|
17
10
|
const propTypes = {
|
|
18
|
-
isPreview:
|
|
19
|
-
colorThemeName:
|
|
20
|
-
statItem:
|
|
21
|
-
chartCalculator:
|
|
22
|
-
toggleStatisticRecordsDialog:
|
|
11
|
+
isPreview: PropTypes.bool,
|
|
12
|
+
colorThemeName: PropTypes.string,
|
|
13
|
+
statItem: PropTypes.object,
|
|
14
|
+
chartCalculator: PropTypes.object,
|
|
15
|
+
toggleStatisticRecordsDialog: PropTypes.func
|
|
23
16
|
};
|
|
24
|
-
class RingChart extends
|
|
17
|
+
class RingChart extends BaseChart {
|
|
25
18
|
constructor(props) {
|
|
26
19
|
super(props);
|
|
27
20
|
this.drawChart = data => {
|
|
@@ -30,13 +23,13 @@ class RingChart extends _baseChart.default {
|
|
|
30
23
|
statItem
|
|
31
24
|
} = this.props;
|
|
32
25
|
if (isPreview) {
|
|
33
|
-
this.chart = new
|
|
26
|
+
this.chart = new Chart({
|
|
34
27
|
container: this.container,
|
|
35
28
|
autoFit: true,
|
|
36
29
|
padding: [20, 0]
|
|
37
30
|
});
|
|
38
31
|
} else {
|
|
39
|
-
this.chart = new
|
|
32
|
+
this.chart = new Chart({
|
|
40
33
|
container: this.container,
|
|
41
34
|
autoFit: true,
|
|
42
35
|
height: 400,
|
|
@@ -61,7 +54,7 @@ class RingChart extends _baseChart.default {
|
|
|
61
54
|
colorThemeName
|
|
62
55
|
} = this.props;
|
|
63
56
|
let summaryColumn = null;
|
|
64
|
-
let summaryColumnData =
|
|
57
|
+
let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
65
58
|
const {
|
|
66
59
|
summary_type,
|
|
67
60
|
summary_method,
|
|
@@ -74,17 +67,17 @@ class RingChart extends _baseChart.default {
|
|
|
74
67
|
display_annotation
|
|
75
68
|
} = statItem;
|
|
76
69
|
const table = getTableById(table_id);
|
|
77
|
-
if (summary_type !==
|
|
78
|
-
summaryColumn = summary_column_key &&
|
|
79
|
-
summaryColumnData = summaryColumn && summaryColumn.data ||
|
|
70
|
+
if (summary_type !== SUMMARY_TYPE.COUNT) {
|
|
71
|
+
summaryColumn = summary_column_key && TableUtils.getTableColumnByKey(table, summary_column_key);
|
|
72
|
+
summaryColumnData = summaryColumn && summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
80
73
|
}
|
|
81
74
|
this.chart.coordinate('theta', {
|
|
82
75
|
radius: isCreating ? 0.75 : 0.95,
|
|
83
76
|
innerRadius: isCreating ? 0.6 : 0.7
|
|
84
77
|
});
|
|
85
|
-
const currentTheme =
|
|
78
|
+
const currentTheme = getCurrentTheme(colorThemeName);
|
|
86
79
|
const themeColors = this.getThemeColors();
|
|
87
|
-
const newData =
|
|
80
|
+
const newData = formatPieChartData(data, statItem, table, currentTheme);
|
|
88
81
|
this.chart.data(newData, {
|
|
89
82
|
'name': {
|
|
90
83
|
type: 'cat',
|
|
@@ -121,9 +114,9 @@ class RingChart extends _baseChart.default {
|
|
|
121
114
|
const colorIndex = sIndex.charAt(sIndex.length - 1);
|
|
122
115
|
let name = obj.name;
|
|
123
116
|
if (!obj.name && typeof obj.name !== 'number') {
|
|
124
|
-
name =
|
|
117
|
+
name = intl.get(EMPTY_NAME);
|
|
125
118
|
} else if (obj.name === 'Others') {
|
|
126
|
-
name =
|
|
119
|
+
name = intl.get('Others');
|
|
127
120
|
}
|
|
128
121
|
return {
|
|
129
122
|
name,
|
|
@@ -153,7 +146,7 @@ class RingChart extends _baseChart.default {
|
|
|
153
146
|
content: this.getLabel(value, percent)
|
|
154
147
|
};
|
|
155
148
|
}, {
|
|
156
|
-
offset: !label_position || label_position ===
|
|
149
|
+
offset: !label_position || label_position === LABEL_POSITIONS[0] ? isCreating ? -10 : -2 : undefined,
|
|
157
150
|
style: {
|
|
158
151
|
fill: themeColors.labelColor,
|
|
159
152
|
fontSize: this.getLabelFontSize(),
|
|
@@ -163,7 +156,7 @@ class RingChart extends _baseChart.default {
|
|
|
163
156
|
}).tooltip('name*formatted_value*percent', (name, value, percent) => {
|
|
164
157
|
let title = name;
|
|
165
158
|
if (!name || name === 'undefined') {
|
|
166
|
-
title =
|
|
159
|
+
title = intl.get(EMPTY_NAME);
|
|
167
160
|
}
|
|
168
161
|
return show_percent || display_label ? {
|
|
169
162
|
name: title,
|
|
@@ -189,7 +182,7 @@ class RingChart extends _baseChart.default {
|
|
|
189
182
|
this.chart.interaction('element-active');
|
|
190
183
|
if (display_annotation === undefined || display_annotation === null || display_annotation) {
|
|
191
184
|
this.setAnnotation({
|
|
192
|
-
name:
|
|
185
|
+
name: intl.get(TITLE_TOTAL),
|
|
193
186
|
value: summaryColumn ? this.getNumberDisplayString(this.sum, summaryColumnData, summary_method) : this.sum
|
|
194
187
|
}, themeColors.labelColor);
|
|
195
188
|
this.chart.on('interval:mouseenter', evt => this.onEnterRingChart(evt, themeColors.labelColor, summaryColumn, summaryColumnData));
|
|
@@ -213,13 +206,13 @@ class RingChart extends _baseChart.default {
|
|
|
213
206
|
}
|
|
214
207
|
}
|
|
215
208
|
switch (label_format) {
|
|
216
|
-
case
|
|
209
|
+
case LABEL_FORMATS[0]:
|
|
217
210
|
content = percent;
|
|
218
211
|
break;
|
|
219
|
-
case
|
|
212
|
+
case LABEL_FORMATS[1]:
|
|
220
213
|
content = value;
|
|
221
214
|
break;
|
|
222
|
-
case
|
|
215
|
+
case LABEL_FORMATS[2]:
|
|
223
216
|
content = "".concat(value, " (").concat(percent, ")");
|
|
224
217
|
break;
|
|
225
218
|
default:
|
|
@@ -234,7 +227,7 @@ class RingChart extends _baseChart.default {
|
|
|
234
227
|
const {
|
|
235
228
|
annotation_font_size
|
|
236
229
|
} = statItem;
|
|
237
|
-
const mainFontSize = annotation_font_size ||
|
|
230
|
+
const mainFontSize = annotation_font_size || DEFAULT_ANNOTATION_SIZE;
|
|
238
231
|
const subFontSize = Math.max(mainFontSize - 12, 12);
|
|
239
232
|
return {
|
|
240
233
|
mainFontSize,
|
|
@@ -247,9 +240,9 @@ class RingChart extends _baseChart.default {
|
|
|
247
240
|
} = this.props.statItem;
|
|
248
241
|
let name = content.name;
|
|
249
242
|
if (!name || name === 'undefined') {
|
|
250
|
-
name =
|
|
243
|
+
name = intl.get(EMPTY_NAME);
|
|
251
244
|
} else if (name === 'Others') {
|
|
252
|
-
name =
|
|
245
|
+
name = intl.get('Others');
|
|
253
246
|
}
|
|
254
247
|
const {
|
|
255
248
|
mainFontSize,
|
|
@@ -285,7 +278,7 @@ class RingChart extends _baseChart.default {
|
|
|
285
278
|
this.onLeaveRingChart = (ev, color, summaryColumn, summaryColumnData) => {
|
|
286
279
|
this.chart.annotation().clear(true);
|
|
287
280
|
this.setAnnotation({
|
|
288
|
-
name:
|
|
281
|
+
name: intl.get(TITLE_TOTAL),
|
|
289
282
|
value: this.sum
|
|
290
283
|
}, color, summaryColumn, summaryColumnData);
|
|
291
284
|
this.chart.render(true);
|
|
@@ -382,11 +375,11 @@ class RingChart extends _baseChart.default {
|
|
|
382
375
|
isCalculatingData,
|
|
383
376
|
showResultDescription
|
|
384
377
|
} = this.state;
|
|
385
|
-
return /*#__PURE__*/
|
|
378
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
|
|
386
379
|
ref: ref => this.container = ref,
|
|
387
|
-
className: "".concat(
|
|
380
|
+
className: "".concat(chartStyles['statistic-pie-chart-container'], " statistic-chart-container")
|
|
388
381
|
}));
|
|
389
382
|
}
|
|
390
383
|
}
|
|
391
384
|
RingChart.propTypes = propTypes;
|
|
392
|
-
|
|
385
|
+
export default RingChart;
|
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
-
var _dtableStore = require("dtable-store");
|
|
12
|
-
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
13
|
-
var _customG = require("../custom-g2");
|
|
14
|
-
var _commonUtils = require("../utils/common-utils");
|
|
15
|
-
var _constants = require("../constants");
|
|
16
|
-
var _statisticChartModule = _interopRequireDefault(require("../assets/css/statistic-chart.module.css"));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import intl from 'react-intl-universal';
|
|
4
|
+
import { TableUtils } from 'dtable-store';
|
|
5
|
+
import BaseChart from './base-chart';
|
|
6
|
+
import { Chart } from '../custom-g2';
|
|
7
|
+
import { getCurrentTheme } from '../utils/common-utils';
|
|
8
|
+
import { EMPTY_NAME, LABEL_CONFIG_CHANGED } from '../constants';
|
|
9
|
+
import chartStyles from '../assets/css/statistic-chart.module.css';
|
|
17
10
|
const propTypes = {
|
|
18
|
-
isPreview:
|
|
19
|
-
colorThemeName:
|
|
20
|
-
statItem:
|
|
21
|
-
chartCalculator:
|
|
22
|
-
eventBus:
|
|
23
|
-
getTableById:
|
|
24
|
-
toggleStatisticRecordsDialog:
|
|
11
|
+
isPreview: PropTypes.bool,
|
|
12
|
+
colorThemeName: PropTypes.string,
|
|
13
|
+
statItem: PropTypes.object,
|
|
14
|
+
chartCalculator: PropTypes.object,
|
|
15
|
+
eventBus: PropTypes.object,
|
|
16
|
+
getTableById: PropTypes.func,
|
|
17
|
+
toggleStatisticRecordsDialog: PropTypes.func
|
|
25
18
|
};
|
|
26
|
-
class ScatterChart extends
|
|
19
|
+
class ScatterChart extends BaseChart {
|
|
27
20
|
constructor(props) {
|
|
28
21
|
super(props);
|
|
29
22
|
this.componentDidMount = async () => {
|
|
@@ -40,7 +33,7 @@ class ScatterChart extends _baseChart.default {
|
|
|
40
33
|
this.drawChart(data);
|
|
41
34
|
this.calculateData = data;
|
|
42
35
|
}
|
|
43
|
-
this.unsubscribeStyleChange = eventBus.subscribe(
|
|
36
|
+
this.unsubscribeStyleChange = eventBus.subscribe(LABEL_CONFIG_CHANGED, newStatItem => {
|
|
44
37
|
this.renderAxisLabel(newStatItem);
|
|
45
38
|
});
|
|
46
39
|
};
|
|
@@ -84,22 +77,22 @@ class ScatterChart extends _baseChart.default {
|
|
|
84
77
|
statItem,
|
|
85
78
|
colorThemeName
|
|
86
79
|
} = this.props;
|
|
87
|
-
const currentTheme =
|
|
80
|
+
const currentTheme = getCurrentTheme(colorThemeName);
|
|
88
81
|
const {
|
|
89
82
|
table_id,
|
|
90
83
|
x_axis_column,
|
|
91
84
|
y_axis_column
|
|
92
85
|
} = statItem;
|
|
93
86
|
const selectedTable = getTableById(table_id);
|
|
94
|
-
const selectedXAxisColumn =
|
|
95
|
-
const selectedYAxisColumn =
|
|
87
|
+
const selectedXAxisColumn = TableUtils.getTableColumnByKey(selectedTable, x_axis_column);
|
|
88
|
+
const selectedYAxisColumn = TableUtils.getTableColumnByKey(selectedTable, y_axis_column);
|
|
96
89
|
if (isPreview) {
|
|
97
|
-
this.chart = new
|
|
90
|
+
this.chart = new Chart({
|
|
98
91
|
container: this.container,
|
|
99
92
|
autoFit: true
|
|
100
93
|
});
|
|
101
94
|
} else {
|
|
102
|
-
this.chart = new
|
|
95
|
+
this.chart = new Chart({
|
|
103
96
|
container: this.container,
|
|
104
97
|
height: 400,
|
|
105
98
|
width: 700
|
|
@@ -153,7 +146,7 @@ class ScatterChart extends _baseChart.default {
|
|
|
153
146
|
});
|
|
154
147
|
chart.point().position('x_axis*y_axis').color('group_by', currentTheme && currentTheme.colors).shape('circle').tooltip('group_by*x_axis*y_axis', (group_by, x_axis, y_axis) => {
|
|
155
148
|
return {
|
|
156
|
-
name: group_by || group_by === 0 ? group_by :
|
|
149
|
+
name: group_by || group_by === 0 ? group_by : intl.get(EMPTY_NAME),
|
|
157
150
|
valueX: "".concat(selectedXAxisColumn.name, ": ").concat(x_axis),
|
|
158
151
|
valueY: "".concat(selectedYAxisColumn.name, ": ").concat(y_axis)
|
|
159
152
|
};
|
|
@@ -164,7 +157,7 @@ class ScatterChart extends _baseChart.default {
|
|
|
164
157
|
position: 'bottom',
|
|
165
158
|
itemName: {
|
|
166
159
|
formatter: name => {
|
|
167
|
-
return name || name === 0 ? name :
|
|
160
|
+
return name || name === 0 ? name : intl.get(EMPTY_NAME);
|
|
168
161
|
},
|
|
169
162
|
style: {
|
|
170
163
|
fill: themeColors.textColor
|
|
@@ -218,7 +211,7 @@ class ScatterChart extends _baseChart.default {
|
|
|
218
211
|
const div = document.createElement('div');
|
|
219
212
|
div.id = xAxisID;
|
|
220
213
|
div.className = 'statistic-chart-axis-label';
|
|
221
|
-
const column =
|
|
214
|
+
const column = TableUtils.getTableColumnByKey(table, x_axis_column);
|
|
222
215
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
223
216
|
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; padding-left: ").concat(autoPadding.left, "px; text-align: ").concat(x_axis_label_position, "; bottom: -20px"));
|
|
224
217
|
chartContainer.appendChild(div);
|
|
@@ -236,7 +229,7 @@ class ScatterChart extends _baseChart.default {
|
|
|
236
229
|
const div = document.createElement('div');
|
|
237
230
|
div.id = yAxisID;
|
|
238
231
|
div.className = 'statistic-chart-axis-label';
|
|
239
|
-
const column =
|
|
232
|
+
const column = TableUtils.getTableColumnByKey(table, y_axis_column) || {};
|
|
240
233
|
div.innerHTML = column.name || '';
|
|
241
234
|
const containerHeight = chartContainer.offsetHeight;
|
|
242
235
|
let textAlign = 'center';
|
|
@@ -295,12 +288,12 @@ class ScatterChart extends _baseChart.default {
|
|
|
295
288
|
if (show_y_axis_label) {
|
|
296
289
|
style.paddingLeft = 38;
|
|
297
290
|
}
|
|
298
|
-
return /*#__PURE__*/
|
|
291
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), /*#__PURE__*/React.createElement("div", {
|
|
299
292
|
ref: ref => this.container = ref,
|
|
300
|
-
className: "".concat(
|
|
293
|
+
className: "".concat(chartStyles['statistic-scatter-chart-container'], " statistic-chart-container"),
|
|
301
294
|
style: style
|
|
302
295
|
}));
|
|
303
296
|
}
|
|
304
297
|
}
|
|
305
298
|
ScatterChart.propTypes = propTypes;
|
|
306
|
-
|
|
299
|
+
export default ScatterChart;
|