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,30 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
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");
|
|
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 { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_COLORS, STATISTICS_COUNT_SHOW, LABEL_CONFIG_CHANGED, SUMMARY_TYPE, TITLE_AMOUNT, LEGEND_LEFT, LEGEND_RIGHT } from '../constants';
|
|
16
9
|
const propTypes = {
|
|
17
|
-
isPreview:
|
|
18
|
-
isEdit:
|
|
19
|
-
theme:
|
|
20
|
-
colorThemeName:
|
|
21
|
-
statItem:
|
|
22
|
-
chartCalculator:
|
|
23
|
-
eventBus:
|
|
24
|
-
getTableById:
|
|
25
|
-
toggleStatisticRecordsDialog:
|
|
10
|
+
isPreview: PropTypes.bool,
|
|
11
|
+
isEdit: PropTypes.bool,
|
|
12
|
+
theme: PropTypes.string,
|
|
13
|
+
colorThemeName: PropTypes.string,
|
|
14
|
+
statItem: PropTypes.object,
|
|
15
|
+
chartCalculator: PropTypes.object,
|
|
16
|
+
eventBus: PropTypes.object,
|
|
17
|
+
getTableById: PropTypes.func,
|
|
18
|
+
toggleStatisticRecordsDialog: PropTypes.func
|
|
26
19
|
};
|
|
27
|
-
class CombinationChart extends
|
|
20
|
+
class CombinationChart extends BaseChart {
|
|
28
21
|
constructor(props) {
|
|
29
22
|
super(props);
|
|
30
23
|
this.componentDidMount = async () => {
|
|
@@ -33,7 +26,7 @@ class CombinationChart extends _baseChart.default {
|
|
|
33
26
|
chartCalculator,
|
|
34
27
|
eventBus
|
|
35
28
|
} = this.props;
|
|
36
|
-
this.unsubscribeStyleChange = eventBus.subscribe(
|
|
29
|
+
this.unsubscribeStyleChange = eventBus.subscribe(LABEL_CONFIG_CHANGED, newStatItem => {
|
|
37
30
|
this.renderAxisLabel(newStatItem);
|
|
38
31
|
});
|
|
39
32
|
if (!this.container) return;
|
|
@@ -121,7 +114,7 @@ class CombinationChart extends _baseChart.default {
|
|
|
121
114
|
const div = document.createElement('div');
|
|
122
115
|
div.id = xAxisID;
|
|
123
116
|
div.className = 'statistic-chart-axis-label';
|
|
124
|
-
const column =
|
|
117
|
+
const column = TableUtils.getTableColumnByKey(table, x_axis_column_key);
|
|
125
118
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
126
119
|
div.setAttribute('style', "color:".concat(themeColors.textColor, "; width: 100%; padding-left: ").concat(autoPadding.left, "px; text-align: ").concat(x_axis_label_position, "; bottom: -20px"));
|
|
127
120
|
chartContainer.appendChild(div);
|
|
@@ -138,8 +131,8 @@ class CombinationChart extends _baseChart.default {
|
|
|
138
131
|
const div = document.createElement('div');
|
|
139
132
|
div.id = yAxisLeftID;
|
|
140
133
|
div.className = 'statistic-chart-axis-label';
|
|
141
|
-
const yAxisColumn =
|
|
142
|
-
const labeContent = yAxisColumn ?
|
|
134
|
+
const yAxisColumn = TableUtils.getTableColumnByKey(table, y_axis_left_summary_column);
|
|
135
|
+
const labeContent = yAxisColumn ? intl.get(STATISTICS_COUNT_SHOW[y_axis_left_summary_method]) : intl.get(STATISTICS_COUNT_SHOW.count);
|
|
143
136
|
div.innerHTML = labeContent;
|
|
144
137
|
const containerHeight = chartContainer.offsetHeight;
|
|
145
138
|
let textAlign = 'center';
|
|
@@ -164,8 +157,8 @@ class CombinationChart extends _baseChart.default {
|
|
|
164
157
|
const div = document.createElement('div');
|
|
165
158
|
div.id = yAxisRightID;
|
|
166
159
|
div.className = 'statistic-chart-axis-label';
|
|
167
|
-
const yAxisColumn =
|
|
168
|
-
const labeContent = yAxisColumn ?
|
|
160
|
+
const yAxisColumn = TableUtils.getTableColumnByKey(table, y_axis_right_summary_column);
|
|
161
|
+
const labeContent = yAxisColumn ? intl.get(STATISTICS_COUNT_SHOW[y_axis_right_summary_method]) : intl.get(STATISTICS_COUNT_SHOW.count);
|
|
169
162
|
div.innerHTML = labeContent;
|
|
170
163
|
const containerHeight = chartContainer.offsetHeight;
|
|
171
164
|
let textAlign = 'center';
|
|
@@ -205,11 +198,11 @@ class CombinationChart extends _baseChart.default {
|
|
|
205
198
|
}
|
|
206
199
|
});
|
|
207
200
|
const table = getTableById(table_id);
|
|
208
|
-
const leftColumn =
|
|
209
|
-
const rightColumn =
|
|
201
|
+
const leftColumn = TableUtils.getTableColumnByKey(table, y_axis_left_summary_column) || {};
|
|
202
|
+
const rightColumn = TableUtils.getTableColumnByKey(table, y_axis_right_summary_column) || {};
|
|
210
203
|
this.handleAutoRange(leftColumn, rightColumn);
|
|
211
204
|
const themeColors = this.getThemeColors();
|
|
212
|
-
const currentTheme =
|
|
205
|
+
const currentTheme = getCurrentTheme(colorThemeName);
|
|
213
206
|
this.setNameAxis(themeColors);
|
|
214
207
|
this.setValueAxis(themeColors);
|
|
215
208
|
this.setLegend(themeColors, table, currentTheme);
|
|
@@ -241,7 +234,7 @@ class CombinationChart extends _baseChart.default {
|
|
|
241
234
|
config.height = 400;
|
|
242
235
|
config.width = 700;
|
|
243
236
|
}
|
|
244
|
-
this.chart = new
|
|
237
|
+
this.chart = new Chart(config);
|
|
245
238
|
};
|
|
246
239
|
this.handleAutoRange = (leftColumn, rightColumn) => {
|
|
247
240
|
const {
|
|
@@ -257,8 +250,8 @@ class CombinationChart extends _baseChart.default {
|
|
|
257
250
|
y_axis_min_right = 0,
|
|
258
251
|
y_axis_max_right = 0
|
|
259
252
|
} = statItem;
|
|
260
|
-
const leftColumnData = leftColumn.data ||
|
|
261
|
-
const rightColumnData = rightColumn.data ||
|
|
253
|
+
const leftColumnData = leftColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
254
|
+
const rightColumnData = rightColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
262
255
|
let leftValueScaleOptions = {
|
|
263
256
|
formatter: value => {
|
|
264
257
|
return this.getNumberDisplayString(value, leftColumnData, y_axis_left_summary_method);
|
|
@@ -299,7 +292,7 @@ class CombinationChart extends _baseChart.default {
|
|
|
299
292
|
},
|
|
300
293
|
formatter: name => {
|
|
301
294
|
if (name === '' || name === null || name === undefined) {
|
|
302
|
-
return
|
|
295
|
+
return intl.get(EMPTY_NAME);
|
|
303
296
|
}
|
|
304
297
|
return name;
|
|
305
298
|
}
|
|
@@ -366,8 +359,8 @@ class CombinationChart extends _baseChart.default {
|
|
|
366
359
|
}).adjust('dodge').tooltip('name*formatted_value_left', (name, value) => {
|
|
367
360
|
return {
|
|
368
361
|
value,
|
|
369
|
-
title: y_axis_left_summary_type ===
|
|
370
|
-
name: !name && typeof name !== 'number' ?
|
|
362
|
+
title: y_axis_left_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_left_summary_method]),
|
|
363
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
371
364
|
};
|
|
372
365
|
});
|
|
373
366
|
this.chart.tooltip({
|
|
@@ -392,8 +385,8 @@ class CombinationChart extends _baseChart.default {
|
|
|
392
385
|
this.chart.line().position('name*value_right').color(currentTheme && currentTheme.colors[1]).size(3).tooltip('name*formatted_value_right', (name, value) => {
|
|
393
386
|
return {
|
|
394
387
|
value,
|
|
395
|
-
title: y_axis_right_summary_type ===
|
|
396
|
-
name: !name && typeof name !== 'number' ?
|
|
388
|
+
title: y_axis_right_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_right_summary_method]),
|
|
389
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
397
390
|
};
|
|
398
391
|
});
|
|
399
392
|
|
|
@@ -406,8 +399,8 @@ class CombinationChart extends _baseChart.default {
|
|
|
406
399
|
}).tooltip('name*formatted_value_right', (name, value) => {
|
|
407
400
|
return {
|
|
408
401
|
value,
|
|
409
|
-
title: y_axis_right_summary_type ===
|
|
410
|
-
name: !name && typeof name !== 'number' ?
|
|
402
|
+
title: y_axis_right_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_right_summary_method]),
|
|
403
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
411
404
|
};
|
|
412
405
|
});
|
|
413
406
|
};
|
|
@@ -422,12 +415,12 @@ class CombinationChart extends _baseChart.default {
|
|
|
422
415
|
y_axis_left_group_by_numeric_columns
|
|
423
416
|
} = statItem;
|
|
424
417
|
const legendItems = [];
|
|
425
|
-
const column1 =
|
|
426
|
-
const column2 =
|
|
418
|
+
const column1 = TableUtils.getTableColumnByKey(table, y_axis_left_summary_column) || {};
|
|
419
|
+
const column2 = TableUtils.getTableColumnByKey(table, y_axis_right_summary_column) || {};
|
|
427
420
|
if (!y_axis_left_group_by_multiple_numeric_column) {
|
|
428
421
|
legendItems.push({
|
|
429
422
|
value: 'value_left',
|
|
430
|
-
name: column1.name ||
|
|
423
|
+
name: column1.name || intl.get(LEGEND_LEFT),
|
|
431
424
|
marker: {
|
|
432
425
|
symbol: 'square',
|
|
433
426
|
style: {
|
|
@@ -437,7 +430,7 @@ class CombinationChart extends _baseChart.default {
|
|
|
437
430
|
}
|
|
438
431
|
}, {
|
|
439
432
|
value: 'value_right',
|
|
440
|
-
name: column2.name ||
|
|
433
|
+
name: column2.name || intl.get(LEGEND_RIGHT),
|
|
441
434
|
marker: {
|
|
442
435
|
symbol: 'hyphen',
|
|
443
436
|
style: {
|
|
@@ -450,9 +443,9 @@ class CombinationChart extends _baseChart.default {
|
|
|
450
443
|
} else {
|
|
451
444
|
legendItems.push({
|
|
452
445
|
value: 'value_left',
|
|
453
|
-
name: column1.name ||
|
|
446
|
+
name: column1.name || intl.get(LEGEND_LEFT),
|
|
454
447
|
marker: {
|
|
455
|
-
fill:
|
|
448
|
+
fill: LABEL_COLORS[0],
|
|
456
449
|
symbol: 'square',
|
|
457
450
|
style: {
|
|
458
451
|
r: 5
|
|
@@ -460,14 +453,14 @@ class CombinationChart extends _baseChart.default {
|
|
|
460
453
|
}
|
|
461
454
|
});
|
|
462
455
|
y_axis_left_group_by_numeric_columns.forEach((item, index) => {
|
|
463
|
-
const column =
|
|
456
|
+
const column = TableUtils.getTableColumnByKey(table, item.column_key) || {};
|
|
464
457
|
legendItems.push({
|
|
465
458
|
value: 'group_name',
|
|
466
|
-
name: column.name ||
|
|
459
|
+
name: column.name || intl.get(LEGEND_LEFT),
|
|
467
460
|
marker: {
|
|
468
461
|
symbol: 'square',
|
|
469
462
|
style: {
|
|
470
|
-
fill:
|
|
463
|
+
fill: LABEL_COLORS[(index + 1) % 12],
|
|
471
464
|
r: 5
|
|
472
465
|
}
|
|
473
466
|
}
|
|
@@ -475,7 +468,7 @@ class CombinationChart extends _baseChart.default {
|
|
|
475
468
|
});
|
|
476
469
|
legendItems.push({
|
|
477
470
|
value: 'value_right',
|
|
478
|
-
name: column2.name ||
|
|
471
|
+
name: column2.name || intl.get(LEGEND_RIGHT),
|
|
479
472
|
marker: {
|
|
480
473
|
symbol: 'hyphen',
|
|
481
474
|
style: {
|
|
@@ -533,7 +526,7 @@ class CombinationChart extends _baseChart.default {
|
|
|
533
526
|
show_y_axis_left_label,
|
|
534
527
|
show_x_axis_label
|
|
535
528
|
} = statItem;
|
|
536
|
-
return /*#__PURE__*/
|
|
529
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
|
|
537
530
|
ref: ref => this.container = ref,
|
|
538
531
|
style: {
|
|
539
532
|
padding: show_y_axis_left_label || show_x_axis_label ? 30 : 20
|
|
@@ -543,4 +536,4 @@ class CombinationChart extends _baseChart.default {
|
|
|
543
536
|
}
|
|
544
537
|
}
|
|
545
538
|
CombinationChart.propTypes = propTypes;
|
|
546
|
-
|
|
539
|
+
export default CombinationChart;
|
|
@@ -1,30 +1,23 @@
|
|
|
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 _basicChartUtils = require("../utils/basic-chart-utils");
|
|
16
|
-
var _constants = require("../constants");
|
|
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 { getChartGroups } from '../utils/basic-chart-utils';
|
|
9
|
+
import { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, SUMMARY_TYPE, LABEL_CONFIG_CHANGED, STATISTICS_COUNT_SHOW, TITLE_AMOUNT, TITLE_INCREASE } from '../constants';
|
|
17
10
|
const propTypes = {
|
|
18
|
-
isPreview:
|
|
19
|
-
isEdit:
|
|
20
|
-
colorThemeName:
|
|
21
|
-
statItem:
|
|
22
|
-
chartCalculator:
|
|
23
|
-
eventBus:
|
|
24
|
-
getTableById:
|
|
25
|
-
toggleStatisticRecordsDialog:
|
|
11
|
+
isPreview: PropTypes.bool,
|
|
12
|
+
isEdit: PropTypes.bool,
|
|
13
|
+
colorThemeName: PropTypes.string,
|
|
14
|
+
statItem: PropTypes.object,
|
|
15
|
+
chartCalculator: PropTypes.object,
|
|
16
|
+
eventBus: PropTypes.object,
|
|
17
|
+
getTableById: PropTypes.func,
|
|
18
|
+
toggleStatisticRecordsDialog: PropTypes.func
|
|
26
19
|
};
|
|
27
|
-
class CompareChart extends
|
|
20
|
+
class CompareChart extends BaseChart {
|
|
28
21
|
constructor(props) {
|
|
29
22
|
super(props);
|
|
30
23
|
this.drawChart = data => {
|
|
@@ -43,11 +36,11 @@ class CompareChart extends _baseChart.default {
|
|
|
43
36
|
this.chart.on('interval:click', e => {
|
|
44
37
|
this.props.toggleStatisticRecordsDialog(e.data.data, statItem);
|
|
45
38
|
});
|
|
46
|
-
let summaryColumnData =
|
|
47
|
-
if (y_axis_summary_type ===
|
|
39
|
+
let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
40
|
+
if (y_axis_summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
48
41
|
const table = getTableById(table_id);
|
|
49
|
-
const summaryColumn =
|
|
50
|
-
summaryColumnData = summaryColumn.data ||
|
|
42
|
+
const summaryColumn = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
|
|
43
|
+
summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
51
44
|
}
|
|
52
45
|
this.chart.data(data, {
|
|
53
46
|
'name': {
|
|
@@ -58,7 +51,7 @@ class CompareChart extends _baseChart.default {
|
|
|
58
51
|
const {
|
|
59
52
|
width
|
|
60
53
|
} = this.chart.coordinateBBox;
|
|
61
|
-
const chartData =
|
|
54
|
+
const chartData = getChartGroups(data);
|
|
62
55
|
const ticks = this.getTicks(chartData, width);
|
|
63
56
|
if (ticks.length > 0) {
|
|
64
57
|
this.chart.scale('name', {
|
|
@@ -74,7 +67,7 @@ class CompareChart extends _baseChart.default {
|
|
|
74
67
|
type: 'cat'
|
|
75
68
|
}
|
|
76
69
|
});
|
|
77
|
-
const currentTheme =
|
|
70
|
+
const currentTheme = getCurrentTheme(colorThemeName);
|
|
78
71
|
const themeColors = this.getThemeColors();
|
|
79
72
|
this.drawBar({
|
|
80
73
|
currentTheme,
|
|
@@ -111,7 +104,7 @@ class CompareChart extends _baseChart.default {
|
|
|
111
104
|
config.height = 400;
|
|
112
105
|
config.width = 700;
|
|
113
106
|
}
|
|
114
|
-
this.chart = new
|
|
107
|
+
this.chart = new Chart(config);
|
|
115
108
|
};
|
|
116
109
|
this.handleAutoRange = (data, summaryColumnData) => {
|
|
117
110
|
const {
|
|
@@ -169,8 +162,8 @@ class CompareChart extends _baseChart.default {
|
|
|
169
162
|
fill: themeColors.textColor
|
|
170
163
|
}
|
|
171
164
|
}).position('name*value').color('group_name', currentTheme && currentTheme.colors).tooltip('name*formatted_value*raw_name', (name, value, raw_name) => {
|
|
172
|
-
const nameContent = !raw_name && typeof raw_name !== 'number' ?
|
|
173
|
-
const titleContent = y_axis_summary_type === 'count' ?
|
|
165
|
+
const nameContent = !raw_name && typeof raw_name !== 'number' ? intl.get(EMPTY_NAME) : raw_name;
|
|
166
|
+
const titleContent = y_axis_summary_type === 'count' ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method]);
|
|
174
167
|
return {
|
|
175
168
|
value,
|
|
176
169
|
title: titleContent,
|
|
@@ -206,11 +199,11 @@ class CompareChart extends _baseChart.default {
|
|
|
206
199
|
} = this.props.statItem;
|
|
207
200
|
this.chart.line().position('name*increase_value').size(3).color(increase_line_color || '#fbd44a').shape('smooth').tooltip('name*increase_value', (name, value) => {
|
|
208
201
|
return {
|
|
209
|
-
title:
|
|
202
|
+
title: intl.get(TITLE_INCREASE),
|
|
210
203
|
value: this.getNumberDisplayString(value || 0, {
|
|
211
204
|
format: 'percent'
|
|
212
205
|
}),
|
|
213
|
-
name: !name && typeof name !== 'number' ?
|
|
206
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
214
207
|
};
|
|
215
208
|
});
|
|
216
209
|
this.chart.point().label(display_increase_percentage ? 'increase_value' : false, value => {
|
|
@@ -224,11 +217,11 @@ class CompareChart extends _baseChart.default {
|
|
|
224
217
|
};
|
|
225
218
|
}).color(increase_line_color || '#fbd44a').position('name*increase_value').size(3).tooltip('name*increase_value', (name, value) => {
|
|
226
219
|
return {
|
|
227
|
-
title:
|
|
220
|
+
title: intl.get(TITLE_INCREASE),
|
|
228
221
|
value: this.getNumberDisplayString(value || 0, {
|
|
229
222
|
format: 'percent'
|
|
230
223
|
}),
|
|
231
|
-
name: !name && typeof name !== 'number' ?
|
|
224
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
232
225
|
};
|
|
233
226
|
});
|
|
234
227
|
this.chart.axis('increase_value', {
|
|
@@ -273,7 +266,7 @@ class CompareChart extends _baseChart.default {
|
|
|
273
266
|
fill: themeColors.textColor
|
|
274
267
|
},
|
|
275
268
|
formatter: name => {
|
|
276
|
-
return !name && typeof name !== 'number' ?
|
|
269
|
+
return !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name;
|
|
277
270
|
}
|
|
278
271
|
},
|
|
279
272
|
pageNavigator: {
|
|
@@ -322,7 +315,7 @@ class CompareChart extends _baseChart.default {
|
|
|
322
315
|
const div = document.createElement('div');
|
|
323
316
|
div.id = xAxisID;
|
|
324
317
|
div.className = 'statistic-chart-axis-label';
|
|
325
|
-
const column =
|
|
318
|
+
const column = TableUtils.getTableColumnByKey(table, x_axis_column_key);
|
|
326
319
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
327
320
|
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; padding-left: ").concat(autoPadding.left, "px; text-align: ").concat(x_axis_label_position, "; bottom: -20px"));
|
|
328
321
|
chartContainer.appendChild(div);
|
|
@@ -340,10 +333,10 @@ class CompareChart extends _baseChart.default {
|
|
|
340
333
|
const div = document.createElement('div');
|
|
341
334
|
div.id = yAxisID;
|
|
342
335
|
div.className = 'statistic-chart-axis-label';
|
|
343
|
-
if (y_axis_summary_type ===
|
|
344
|
-
div.innerHTML =
|
|
336
|
+
if (y_axis_summary_type === SUMMARY_TYPE.COUNT) {
|
|
337
|
+
div.innerHTML = intl.get(TITLE_AMOUNT);
|
|
345
338
|
} else {
|
|
346
|
-
const column =
|
|
339
|
+
const column = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
|
|
347
340
|
div.innerHTML = column.name || '';
|
|
348
341
|
}
|
|
349
342
|
const containerHeight = chartContainer.offsetHeight;
|
|
@@ -380,7 +373,7 @@ class CompareChart extends _baseChart.default {
|
|
|
380
373
|
chartCalculator,
|
|
381
374
|
eventBus
|
|
382
375
|
} = this.props;
|
|
383
|
-
this.unsubscribeStyleChange = eventBus.subscribe(
|
|
376
|
+
this.unsubscribeStyleChange = eventBus.subscribe(LABEL_CONFIG_CHANGED, newStatItem => {
|
|
384
377
|
this.renderAxisLabel(newStatItem);
|
|
385
378
|
});
|
|
386
379
|
if (this.container) {
|
|
@@ -470,7 +463,7 @@ class CompareChart extends _baseChart.default {
|
|
|
470
463
|
show_y_axis_label,
|
|
471
464
|
show_x_axis_label
|
|
472
465
|
} = statItem;
|
|
473
|
-
return /*#__PURE__*/
|
|
466
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
|
|
474
467
|
ref: ref => this.container = ref,
|
|
475
468
|
style: {
|
|
476
469
|
padding: show_y_axis_label || show_x_axis_label ? 30 : 20
|
|
@@ -480,4 +473,4 @@ class CompareChart extends _baseChart.default {
|
|
|
480
473
|
}
|
|
481
474
|
}
|
|
482
475
|
CompareChart.propTypes = propTypes;
|
|
483
|
-
|
|
476
|
+
export default CompareChart;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
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");
|
|
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, STAT_TYPE } from '../constants';
|
|
16
9
|
const propTypes = {
|
|
17
|
-
isPreview:
|
|
18
|
-
isEdit:
|
|
19
|
-
colorThemeName:
|
|
20
|
-
statItem:
|
|
21
|
-
chartCalculator:
|
|
22
|
-
getTableById:
|
|
23
|
-
toggleStatisticRecordsDialog:
|
|
10
|
+
isPreview: PropTypes.bool,
|
|
11
|
+
isEdit: PropTypes.bool,
|
|
12
|
+
colorThemeName: PropTypes.string,
|
|
13
|
+
statItem: PropTypes.object,
|
|
14
|
+
chartCalculator: PropTypes.object,
|
|
15
|
+
getTableById: PropTypes.func,
|
|
16
|
+
toggleStatisticRecordsDialog: PropTypes.func
|
|
24
17
|
};
|
|
25
|
-
class CompletenessChart extends
|
|
18
|
+
class CompletenessChart extends BaseChart {
|
|
26
19
|
constructor(props) {
|
|
27
20
|
super(props);
|
|
28
21
|
this.destroyChart = () => {
|
|
@@ -57,12 +50,12 @@ class CompletenessChart extends _baseChart.default {
|
|
|
57
50
|
target_column,
|
|
58
51
|
table_id
|
|
59
52
|
} = statItem;
|
|
60
|
-
const isGroupChart = statItem.type ===
|
|
61
|
-
const currentTheme =
|
|
53
|
+
const isGroupChart = statItem.type === STAT_TYPE.GROUP_COMPLETENESS_CHART;
|
|
54
|
+
const currentTheme = getCurrentTheme(colorThemeName);
|
|
62
55
|
this.initChartHandler();
|
|
63
56
|
const selectedTable = getTableById(table_id);
|
|
64
|
-
const completedColumn =
|
|
65
|
-
const targetColumn =
|
|
57
|
+
const completedColumn = TableUtils.getTableColumnByKey(selectedTable, completed_column);
|
|
58
|
+
const targetColumn = TableUtils.getTableColumnByKey(selectedTable, target_column);
|
|
66
59
|
|
|
67
60
|
// 数据颜色映射value设置当前主题色
|
|
68
61
|
if (isGroupChart) {
|
|
@@ -121,7 +114,7 @@ class CompletenessChart extends _baseChart.default {
|
|
|
121
114
|
config.height = 400;
|
|
122
115
|
config.width = 700;
|
|
123
116
|
}
|
|
124
|
-
this.chart = new
|
|
117
|
+
this.chart = new Chart(config);
|
|
125
118
|
};
|
|
126
119
|
this.handleAutoRange = targetColumn => {
|
|
127
120
|
const {
|
|
@@ -195,17 +188,17 @@ class CompletenessChart extends _baseChart.default {
|
|
|
195
188
|
}
|
|
196
189
|
return data.colorMap[group_label];
|
|
197
190
|
}).adjust(adjustType).tooltip('name*current_value*target_value*type', (name, current_value, target_value, type) => {
|
|
198
|
-
let tooltipName =
|
|
191
|
+
let tooltipName = intl.get('Completed');
|
|
199
192
|
let value;
|
|
200
193
|
if (type === 'uncompleted') {
|
|
201
|
-
tooltipName =
|
|
194
|
+
tooltipName = intl.get('Uncompleted');
|
|
202
195
|
value = this.getNumberDisplayString(target_value - current_value, targetColumn.data);
|
|
203
196
|
} else {
|
|
204
197
|
value = this.getNumberDisplayString(current_value, completedColumn.data);
|
|
205
198
|
}
|
|
206
199
|
let tooltipTitle = name;
|
|
207
200
|
if (!tooltipTitle && typeof tooltipTitle !== 'number') {
|
|
208
|
-
tooltipTitle =
|
|
201
|
+
tooltipTitle = intl.get(EMPTY_NAME);
|
|
209
202
|
}
|
|
210
203
|
return {
|
|
211
204
|
title: tooltipTitle,
|
|
@@ -238,7 +231,7 @@ class CompletenessChart extends _baseChart.default {
|
|
|
238
231
|
formatter: name => {
|
|
239
232
|
let label = name;
|
|
240
233
|
if (!name && typeof name !== 'number') {
|
|
241
|
-
label =
|
|
234
|
+
label = intl.get(EMPTY_NAME);
|
|
242
235
|
}
|
|
243
236
|
return label;
|
|
244
237
|
},
|
|
@@ -272,7 +265,7 @@ class CompletenessChart extends _baseChart.default {
|
|
|
272
265
|
fill: themeColors.textColor
|
|
273
266
|
},
|
|
274
267
|
formatter: name => {
|
|
275
|
-
return !name && typeof name !== 'number' ?
|
|
268
|
+
return !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name;
|
|
276
269
|
}
|
|
277
270
|
},
|
|
278
271
|
pageNavigator: {
|
|
@@ -377,7 +370,7 @@ class CompletenessChart extends _baseChart.default {
|
|
|
377
370
|
isCalculatingData,
|
|
378
371
|
showResultDescription
|
|
379
372
|
} = this.state;
|
|
380
|
-
return /*#__PURE__*/
|
|
373
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
|
|
381
374
|
ref: ref => this.container = ref,
|
|
382
375
|
style: {
|
|
383
376
|
padding: 20
|
|
@@ -387,4 +380,4 @@ class CompletenessChart extends _baseChart.default {
|
|
|
387
380
|
}
|
|
388
381
|
}
|
|
389
382
|
CompletenessChart.propTypes = propTypes;
|
|
390
|
-
|
|
383
|
+
export default CompletenessChart;
|