dtable-statistic 4.0.7 → 4.0.8
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/calculator/basic-chart-calculator.js +27 -18
- package/es/calculator/combination-calculator.js +34 -9
- package/es/calculator/compare-bar-calculator.js +37 -30
- package/es/calculator/heat-map-calculator.js +25 -14
- package/es/calculator/map-calculator.js +25 -14
- package/es/calculator/mirror-calculator.js +29 -14
- package/es/calculator/pivot-table-calculator.js +78 -51
- package/es/calculator/workers/basic-chart-calculator-worker.js +21 -6
- package/es/calculator/workers/combination-calculator-worker.js +20 -5
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +12 -6
- package/es/calculator/workers/mirror-calculator-worker.js +15 -6
- package/es/calculator/workers/pivot-table-calculator-worker.js +87 -41
- package/es/calculator/world-map-calculator.js +25 -14
- package/es/components/dialog/enlarged-chart-dialog.js +2 -2
- package/es/components/dialog/statistic-record-dialog/index.js +71 -41
- package/es/constants/index.js +30 -29
- package/es/dashboard.js +57 -43
- package/es/desktop-dashboard.js +16 -51
- package/es/index.js +34 -2
- package/es/locale/lang/de.js +2 -0
- package/es/locale/lang/en.js +2 -0
- package/es/locale/lang/fr.js +2 -0
- package/es/locale/lang/zh_CN.js +2 -0
- package/es/mobile-dashboard.js +5 -5
- package/es/model/horizontal-bar-group.js +2 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +1 -2
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +1 -1
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +20 -3
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +2 -8
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +23 -2
- package/es/stat-list/chart-preview.js +3 -4
- package/es/stat-list/index.js +10 -4
- package/es/stat-view/area-chart.js +177 -162
- package/es/stat-view/bar-chart.js +221 -222
- package/es/stat-view/base-chart.js +79 -7
- package/es/stat-view/basic-number-card.js +11 -19
- package/es/stat-view/combination-chart.js +100 -83
- package/es/stat-view/compare-chart.js +133 -144
- package/es/stat-view/completeness-chart.js +108 -102
- package/es/stat-view/custom-bar.js +79 -99
- package/es/stat-view/dashboard-chart.js +57 -57
- package/es/stat-view/heat-map.js +13 -32
- package/es/stat-view/horizontal-bar-chart.js +200 -230
- package/es/stat-view/index.js +2 -2
- package/es/stat-view/line-chart.js +162 -158
- package/es/stat-view/map.js +26 -40
- package/es/stat-view/mirror.js +88 -94
- package/es/stat-view/pie-chart.js +11 -39
- package/es/stat-view/pivot-table/index.js +4 -16
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +22 -15
- package/es/stat-view/ring-chart.js +24 -42
- package/es/stat-view/scatter-chart.js +4 -21
- package/es/stat-view/treemap-chart.js +3 -12
- package/es/stat-view/trend-chart.js +6 -17
- package/es/stat-view/world-map.js +39 -50
- package/es/tabs/tab.js +2 -1
- package/es/utils/common-utils.js +24 -6
- package/es/utils/sql-utils.js +10 -9
- package/es/utils/stat-utils.js +8 -5
- package/package.json +1 -1
|
@@ -7,15 +7,12 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import intl from 'react-intl-universal';
|
|
10
|
-
import { TableUtils
|
|
10
|
+
import { TableUtils } from 'dtable-store';
|
|
11
11
|
import BaseChart from './base-chart';
|
|
12
12
|
import { Chart } from '../custom-g2';
|
|
13
|
-
import {
|
|
14
|
-
import { EMPTY_NAME, STAT_ITEM_THEME_COLORS } from '../constants';
|
|
13
|
+
import { EMPTY_NAME, SUMMARY_METHOD_MAP } from '../constants';
|
|
15
14
|
var propTypes = {
|
|
16
15
|
isPreview: PropTypes.bool,
|
|
17
|
-
isEnlarge: PropTypes.bool,
|
|
18
|
-
theme: PropTypes.string,
|
|
19
16
|
statItem: PropTypes.object,
|
|
20
17
|
chartCalculator: PropTypes.object,
|
|
21
18
|
getTableById: PropTypes.func
|
|
@@ -116,9 +113,7 @@ var BasicNumericCard = /*#__PURE__*/function (_BaseChart) {
|
|
|
116
113
|
_this.drawChart = function (data) {
|
|
117
114
|
var _this$props3 = _this.props,
|
|
118
115
|
isPreview = _this$props3.isPreview,
|
|
119
|
-
statItem = _this$props3.statItem
|
|
120
|
-
isEnlarge = _this$props3.isEnlarge,
|
|
121
|
-
theme = _this$props3.theme;
|
|
116
|
+
statItem = _this$props3.statItem;
|
|
122
117
|
if (isPreview) {
|
|
123
118
|
_this.chart = new Chart({
|
|
124
119
|
container: _this.container,
|
|
@@ -132,8 +127,7 @@ var BasicNumericCard = /*#__PURE__*/function (_BaseChart) {
|
|
|
132
127
|
width: 700
|
|
133
128
|
});
|
|
134
129
|
}
|
|
135
|
-
var
|
|
136
|
-
var content = summary_method === 'Distinct_values' ? data : _this.formatData(data);
|
|
130
|
+
var content = _this.formatData(data);
|
|
137
131
|
var fontSize = _this.getFontSize(content);
|
|
138
132
|
var labelFontSize = fontSize - 35;
|
|
139
133
|
if (labelFontSize > 20) {
|
|
@@ -142,10 +136,7 @@ var BasicNumericCard = /*#__PURE__*/function (_BaseChart) {
|
|
|
142
136
|
if (labelFontSize < 12) {
|
|
143
137
|
labelFontSize = 12;
|
|
144
138
|
}
|
|
145
|
-
var themeColors =
|
|
146
|
-
if (theme === 'dark' && !isEnlarge && isPreview) {
|
|
147
|
-
themeColors = STAT_ITEM_THEME_COLORS.dark;
|
|
148
|
-
}
|
|
139
|
+
var themeColors = _this.getThemeColors();
|
|
149
140
|
_this.chart.annotation().html({
|
|
150
141
|
position: ['50%', '50%'],
|
|
151
142
|
html: "\n <div style=\"color: ".concat(themeColors.cardColor, "; text-align: center;\">\n <p class=\"text-content\" style=\"font-size: ").concat(fontSize, "px; margin: -15px 0 2px 0;\">").concat(content, "</p>\n <p style=\"font-size: ").concat(labelFontSize, "px;margin: 0;\">").concat(statItem.name || '', "</p>\n </div>\n ")
|
|
@@ -153,17 +144,20 @@ var BasicNumericCard = /*#__PURE__*/function (_BaseChart) {
|
|
|
153
144
|
_this.chart.render();
|
|
154
145
|
};
|
|
155
146
|
_this.formatData = function (data) {
|
|
156
|
-
if (!data) return intl.get(EMPTY_NAME);
|
|
157
147
|
var _this$props4 = _this.props,
|
|
158
148
|
getTableById = _this$props4.getTableById,
|
|
159
149
|
statItem = _this$props4.statItem;
|
|
160
150
|
var summary_method = statItem.summary_method,
|
|
161
151
|
table_id = statItem.table_id,
|
|
162
152
|
numeric_column = statItem.numeric_column;
|
|
153
|
+
if (summary_method === SUMMARY_METHOD_MAP.Distinct_values) {
|
|
154
|
+
return data;
|
|
155
|
+
}
|
|
156
|
+
if (!data) return intl.get(EMPTY_NAME);
|
|
163
157
|
if (summary_method !== 'Row_count') {
|
|
164
158
|
var table = getTableById(table_id);
|
|
165
159
|
var selectedColumn = TableUtils.getTableColumnByKey(table, numeric_column);
|
|
166
|
-
var formattedContent = getNumberDisplayString(data, selectedColumn.data || {});
|
|
160
|
+
var formattedContent = _this.getNumberDisplayString(data, selectedColumn.data || {});
|
|
167
161
|
return formattedContent;
|
|
168
162
|
}
|
|
169
163
|
var string = data + '';
|
|
@@ -239,9 +233,7 @@ var BasicNumericCard = /*#__PURE__*/function (_BaseChart) {
|
|
|
239
233
|
value: function render() {
|
|
240
234
|
var _this2 = this;
|
|
241
235
|
var isCalculatingData = this.state.isCalculatingData;
|
|
242
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && /*#__PURE__*/React.createElement("div", {
|
|
243
|
-
className: 'statistic-chart-loading-container'
|
|
244
|
-
}, /*#__PURE__*/React.createElement(Loading, null)), /*#__PURE__*/React.createElement("div", {
|
|
236
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), /*#__PURE__*/React.createElement("div", {
|
|
245
237
|
ref: function ref(_ref3) {
|
|
246
238
|
return _this2.container = _ref3;
|
|
247
239
|
},
|
|
@@ -7,15 +7,13 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import intl from 'react-intl-universal';
|
|
10
|
-
import { TableUtils
|
|
10
|
+
import { TableUtils } from 'dtable-store';
|
|
11
11
|
import BaseChart from './base-chart';
|
|
12
12
|
import { Chart } from '../custom-g2';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_COLORS, STATISTICS_COUNT_SHOW, STAT_ITEM_THEME_COLORS, LABEL_CONFIG_CHANGED, SUMMARY_TYPE, NO_STATISTIC_RESULTS, TITLE_AMOUNT, LEGEND_LEFT, LEGEND_RIGHT } from '../constants';
|
|
13
|
+
import { getCurrentTheme } from '../utils/common-utils';
|
|
14
|
+
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
15
|
var propTypes = {
|
|
17
16
|
isPreview: PropTypes.bool,
|
|
18
|
-
isEnlarge: PropTypes.bool,
|
|
19
17
|
isEdit: PropTypes.bool,
|
|
20
18
|
theme: PropTypes.string,
|
|
21
19
|
colorThemeName: PropTypes.string,
|
|
@@ -136,10 +134,7 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
136
134
|
_this.renderAxisLabel = function (newStatItem) {
|
|
137
135
|
var _this$props3 = _this.props,
|
|
138
136
|
getTableById = _this$props3.getTableById,
|
|
139
|
-
statItem = _this$props3.statItem
|
|
140
|
-
theme = _this$props3.theme,
|
|
141
|
-
isEnlarge = _this$props3.isEnlarge,
|
|
142
|
-
isPreview = _this$props3.isPreview;
|
|
137
|
+
statItem = _this$props3.statItem;
|
|
143
138
|
if (newStatItem && newStatItem._id !== statItem._id) {
|
|
144
139
|
return;
|
|
145
140
|
}
|
|
@@ -160,10 +155,7 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
160
155
|
y_axis_right_summary_method = _statItem.y_axis_right_summary_method;
|
|
161
156
|
var table = getTableById(table_id);
|
|
162
157
|
var autoPadding = _this.chart.autoPadding;
|
|
163
|
-
var themeColors =
|
|
164
|
-
if (theme === 'dark' && !isEnlarge && isPreview) {
|
|
165
|
-
themeColors = STAT_ITEM_THEME_COLORS.dark;
|
|
166
|
-
}
|
|
158
|
+
var themeColors = _this.getThemeColors();
|
|
167
159
|
var xAxisID = "chart-x-axis-label_".concat(statItem._id);
|
|
168
160
|
var chartContainer = _this.chart.getCanvas().get('container');
|
|
169
161
|
var xLabel = chartContainer.querySelector("#".concat(xAxisID));
|
|
@@ -238,20 +230,59 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
238
230
|
_this.drawChart = function (data) {
|
|
239
231
|
var _this$props4 = _this.props,
|
|
240
232
|
getTableById = _this$props4.getTableById,
|
|
241
|
-
isPreview = _this$props4.isPreview,
|
|
242
233
|
statItem = _this$props4.statItem,
|
|
243
|
-
isEnlarge = _this$props4.isEnlarge,
|
|
244
|
-
theme = _this$props4.theme,
|
|
245
234
|
colorThemeName = _this$props4.colorThemeName;
|
|
246
|
-
var currentTheme = getCurrentTheme(colorThemeName);
|
|
247
235
|
var table_id = statItem.table_id,
|
|
248
236
|
y_axis_left_summary_column = statItem.y_axis_left_summary_column,
|
|
249
|
-
y_axis_right_summary_column = statItem.y_axis_right_summary_column
|
|
250
|
-
|
|
237
|
+
y_axis_right_summary_column = statItem.y_axis_right_summary_column;
|
|
238
|
+
_this.initChartHandler();
|
|
239
|
+
_this.chart.data(data);
|
|
240
|
+
_this.chart.coordinate('rect');
|
|
241
|
+
_this.chart.on('element:click', function (e) {
|
|
242
|
+
if (e.data.data) {
|
|
243
|
+
_this.props.toggleStatisticRecordsDialog(e.data.data, statItem);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
var table = getTableById(table_id);
|
|
247
|
+
var leftColumn = TableUtils.getTableColumnByKey(table, y_axis_left_summary_column) || {};
|
|
248
|
+
var rightColumn = TableUtils.getTableColumnByKey(table, y_axis_right_summary_column) || {};
|
|
249
|
+
_this.handleAutoRange(leftColumn, rightColumn);
|
|
250
|
+
var themeColors = _this.getThemeColors();
|
|
251
|
+
var currentTheme = getCurrentTheme(colorThemeName);
|
|
252
|
+
_this.setNameAxis(themeColors);
|
|
253
|
+
_this.setValueAxis(themeColors);
|
|
254
|
+
_this.setLegend(themeColors, table, currentTheme);
|
|
255
|
+
_this.drawLeft({
|
|
256
|
+
currentTheme: currentTheme
|
|
257
|
+
});
|
|
258
|
+
_this.drawRight({
|
|
259
|
+
currentTheme: currentTheme,
|
|
260
|
+
themeColors: themeColors
|
|
261
|
+
});
|
|
262
|
+
_this.chart.removeInteraction('legend-filter');
|
|
263
|
+
_this.chart.render();
|
|
264
|
+
_this.renderAxisLabel();
|
|
265
|
+
};
|
|
266
|
+
_this.initChartHandler = function () {
|
|
267
|
+
var _this$props5 = _this.props,
|
|
268
|
+
isPreview = _this$props5.isPreview,
|
|
269
|
+
statItem = _this$props5.statItem;
|
|
270
|
+
var display_data = statItem.display_data;
|
|
271
|
+
var config = {
|
|
272
|
+
container: _this.container,
|
|
273
|
+
autoFit: true,
|
|
274
|
+
appendPadding: [display_data ? 20 : 3, 0, 0, 0]
|
|
275
|
+
};
|
|
276
|
+
if (!isPreview) {
|
|
277
|
+
config.height = 400;
|
|
278
|
+
config.width = 700;
|
|
279
|
+
}
|
|
280
|
+
_this.chart = new Chart(config);
|
|
281
|
+
};
|
|
282
|
+
_this.handleAutoRange = function (leftColumn, rightColumn) {
|
|
283
|
+
var statItem = _this.props.statItem;
|
|
284
|
+
var y_axis_left_summary_method = statItem.y_axis_left_summary_method,
|
|
251
285
|
y_axis_right_summary_method = statItem.y_axis_right_summary_method,
|
|
252
|
-
y_axis_left_summary_type = statItem.y_axis_left_summary_type,
|
|
253
|
-
y_axis_right_summary_type = statItem.y_axis_right_summary_type,
|
|
254
|
-
y_axis_left_group_by_multiple_numeric_column = statItem.y_axis_left_group_by_multiple_numeric_column,
|
|
255
286
|
_statItem$y_axis_auto = statItem.y_axis_auto_range_left,
|
|
256
287
|
y_axis_auto_range_left = _statItem$y_axis_auto === void 0 ? true : _statItem$y_axis_auto,
|
|
257
288
|
_statItem$y_axis_min_ = statItem.y_axis_min_left,
|
|
@@ -263,56 +294,27 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
263
294
|
_statItem$y_axis_min_2 = statItem.y_axis_min_right,
|
|
264
295
|
y_axis_min_right = _statItem$y_axis_min_2 === void 0 ? 0 : _statItem$y_axis_min_2,
|
|
265
296
|
_statItem$y_axis_max_2 = statItem.y_axis_max_right,
|
|
266
|
-
y_axis_max_right = _statItem$y_axis_max_2 === void 0 ? 0 : _statItem$y_axis_max_2
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
_statItem$label_font_ = statItem.label_font_size,
|
|
270
|
-
label_font_size = _statItem$label_font_ === void 0 ? 12 : _statItem$label_font_;
|
|
271
|
-
if (isPreview) {
|
|
272
|
-
_this.chart = new Chart({
|
|
273
|
-
container: _this.container,
|
|
274
|
-
autoFit: true,
|
|
275
|
-
appendPadding: [display_data ? 20 : 3, 0, 0, 0]
|
|
276
|
-
});
|
|
277
|
-
} else {
|
|
278
|
-
_this.chart = new Chart({
|
|
279
|
-
container: _this.container,
|
|
280
|
-
autoFit: true,
|
|
281
|
-
height: 400,
|
|
282
|
-
width: 700,
|
|
283
|
-
appendPadding: [display_data ? 20 : 3, 0, 0, 0]
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
_this.chart.data(data);
|
|
287
|
-
_this.chart.coordinate('rect');
|
|
288
|
-
_this.chart.on('element:click', function (e) {
|
|
289
|
-
if (e.data.data) {
|
|
290
|
-
_this.props.toggleStatisticRecordsDialog(e.data.data, statItem);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
var table = getTableById(table_id);
|
|
294
|
-
var column1 = TableUtils.getTableColumnByKey(table, y_axis_left_summary_column) || {};
|
|
295
|
-
var column2 = TableUtils.getTableColumnByKey(table, y_axis_right_summary_column) || {};
|
|
296
|
-
var column1Data = column1.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
297
|
-
var column2Data = column2.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
297
|
+
y_axis_max_right = _statItem$y_axis_max_2 === void 0 ? 0 : _statItem$y_axis_max_2;
|
|
298
|
+
var leftColumnData = leftColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
299
|
+
var rightColumnData = rightColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
298
300
|
var leftValueScaleOptions = {
|
|
299
301
|
formatter: function formatter(value) {
|
|
300
|
-
return getNumberDisplayString(value,
|
|
302
|
+
return _this.getNumberDisplayString(value, leftColumnData, y_axis_left_summary_method);
|
|
301
303
|
}
|
|
302
304
|
};
|
|
303
305
|
var rightValueScaleOptions = {
|
|
304
306
|
formatter: function formatter(value) {
|
|
305
|
-
return getNumberDisplayString(value,
|
|
307
|
+
return _this.getNumberDisplayString(value, rightColumnData, y_axis_right_summary_method);
|
|
306
308
|
}
|
|
307
309
|
};
|
|
308
310
|
if (!y_axis_auto_range_left) {
|
|
309
|
-
leftValueScaleOptions = Object.assign(
|
|
311
|
+
leftValueScaleOptions = Object.assign(leftValueScaleOptions, {
|
|
310
312
|
min: y_axis_min_left,
|
|
311
313
|
max: y_axis_max_left
|
|
312
314
|
});
|
|
313
315
|
}
|
|
314
316
|
if (!y_axis_auto_range_right) {
|
|
315
|
-
rightValueScaleOptions = Object.assign(
|
|
317
|
+
rightValueScaleOptions = Object.assign(rightValueScaleOptions, {
|
|
316
318
|
min: y_axis_min_right,
|
|
317
319
|
max: y_axis_max_right
|
|
318
320
|
});
|
|
@@ -326,10 +328,8 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
326
328
|
value_left: leftValueScaleOptions,
|
|
327
329
|
value_right: rightValueScaleOptions
|
|
328
330
|
});
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
themeColors = STAT_ITEM_THEME_COLORS.dark;
|
|
332
|
-
}
|
|
331
|
+
};
|
|
332
|
+
_this.setNameAxis = function (themeColors) {
|
|
333
333
|
_this.chart.axis('name', {
|
|
334
334
|
label: {
|
|
335
335
|
style: {
|
|
@@ -346,6 +346,8 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
346
346
|
style: themeColors.gridColor
|
|
347
347
|
}
|
|
348
348
|
});
|
|
349
|
+
};
|
|
350
|
+
_this.setValueAxis = function (themeColors) {
|
|
349
351
|
_this.chart.axis('value_left', {
|
|
350
352
|
grid: {
|
|
351
353
|
line: {
|
|
@@ -368,6 +370,8 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
368
370
|
}
|
|
369
371
|
}
|
|
370
372
|
});
|
|
373
|
+
};
|
|
374
|
+
_this.setLegend = function (themeColors, table, currentTheme) {
|
|
371
375
|
var legendPosition = 'bottom';
|
|
372
376
|
_this.chart.legend({
|
|
373
377
|
custom: true,
|
|
@@ -379,43 +383,60 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
379
383
|
},
|
|
380
384
|
items: _this.getLegend(table, currentTheme)
|
|
381
385
|
});
|
|
386
|
+
};
|
|
387
|
+
_this.drawLeft = function (_ref3) {
|
|
388
|
+
var currentTheme = _ref3.currentTheme;
|
|
389
|
+
var statItem = _this.props.statItem;
|
|
390
|
+
var y_axis_left_summary_method = statItem.y_axis_left_summary_method,
|
|
391
|
+
y_axis_left_summary_type = statItem.y_axis_left_summary_type,
|
|
392
|
+
y_axis_left_group_by_multiple_numeric_column = statItem.y_axis_left_group_by_multiple_numeric_column;
|
|
382
393
|
_this.chart.interval().position('name*value_left').color('color', function (color) {
|
|
383
394
|
if (!y_axis_left_group_by_multiple_numeric_column) {
|
|
384
395
|
return currentTheme && currentTheme.colors[0];
|
|
385
396
|
}
|
|
386
397
|
return color;
|
|
387
|
-
}).adjust('dodge').tooltip('name*
|
|
398
|
+
}).adjust('dodge').tooltip('name*formatted_value_left', function (name, value) {
|
|
388
399
|
return {
|
|
400
|
+
value: value,
|
|
389
401
|
title: y_axis_left_summary_type == SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_left_summary_method]),
|
|
390
|
-
value: getNumberDisplayString(value, column1Data),
|
|
391
402
|
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
392
403
|
};
|
|
393
404
|
});
|
|
394
405
|
_this.chart.tooltip({
|
|
395
406
|
showMarkers: false
|
|
396
407
|
});
|
|
397
|
-
|
|
408
|
+
};
|
|
409
|
+
_this.drawRight = function (_ref4) {
|
|
410
|
+
var currentTheme = _ref4.currentTheme,
|
|
411
|
+
themeColors = _ref4.themeColors;
|
|
412
|
+
var statItem = _this.props.statItem;
|
|
413
|
+
var y_axis_right_summary_type = statItem.y_axis_right_summary_type,
|
|
414
|
+
y_axis_right_summary_method = statItem.y_axis_right_summary_method,
|
|
415
|
+
_statItem$display_dat = statItem.display_data,
|
|
416
|
+
display_data = _statItem$display_dat === void 0 ? false : _statItem$display_dat;
|
|
417
|
+
|
|
418
|
+
// line
|
|
419
|
+
_this.chart.line().position('name*value_right').color(currentTheme && currentTheme.colors[1]).size(3).tooltip('name*formatted_value_right', function (name, value) {
|
|
398
420
|
return {
|
|
421
|
+
value: value,
|
|
399
422
|
title: y_axis_right_summary_type == SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_right_summary_method]),
|
|
400
|
-
value: getNumberDisplayString(value, column2Data),
|
|
401
423
|
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
402
424
|
};
|
|
403
425
|
});
|
|
404
|
-
|
|
426
|
+
|
|
427
|
+
// point on the line
|
|
428
|
+
_this.chart.point().position('name*value_right').color(currentTheme && currentTheme.colors[1]).size(3).shape('circle').label(display_data ? 'formatted_value_right' : false, {
|
|
405
429
|
style: {
|
|
406
|
-
fontSize: getLabelFontSize(
|
|
430
|
+
fontSize: _this.getLabelFontSize(),
|
|
407
431
|
fill: themeColors.textColor
|
|
408
432
|
}
|
|
409
|
-
}).tooltip('name*
|
|
433
|
+
}).tooltip('name*formatted_value_right', function (name, value) {
|
|
410
434
|
return {
|
|
435
|
+
value: value,
|
|
411
436
|
title: y_axis_right_summary_type == SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_right_summary_method]),
|
|
412
|
-
value: getNumberDisplayString(value, column2Data),
|
|
413
437
|
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name
|
|
414
438
|
};
|
|
415
439
|
});
|
|
416
|
-
_this.chart.removeInteraction('legend-filter');
|
|
417
|
-
_this.chart.render();
|
|
418
|
-
_this.renderAxisLabel();
|
|
419
440
|
};
|
|
420
441
|
_this.getLegend = function (table, colorTheme) {
|
|
421
442
|
var statItem = _this.props.statItem;
|
|
@@ -504,9 +525,9 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
504
525
|
_createClass(CombinationChart, [{
|
|
505
526
|
key: "shouldComponentUpdate",
|
|
506
527
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
507
|
-
var _this$
|
|
508
|
-
theme = _this$
|
|
509
|
-
colorThemeName = _this$
|
|
528
|
+
var _this$props6 = this.props,
|
|
529
|
+
theme = _this$props6.theme,
|
|
530
|
+
colorThemeName = _this$props6.colorThemeName;
|
|
510
531
|
if (this.canUpdate(this.props, nextProps)) {
|
|
511
532
|
return true;
|
|
512
533
|
}
|
|
@@ -537,13 +558,9 @@ var CombinationChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
537
558
|
showResultDescription = _this$state.showResultDescription;
|
|
538
559
|
var show_y_axis_left_label = statItem.show_y_axis_left_label,
|
|
539
560
|
show_x_axis_label = statItem.show_x_axis_label;
|
|
540
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && /*#__PURE__*/React.createElement("div", {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
className: 'statistic-chart-text'
|
|
544
|
-
}, intl.get(NO_STATISTIC_RESULTS)), /*#__PURE__*/React.createElement("div", {
|
|
545
|
-
ref: function ref(_ref3) {
|
|
546
|
-
return _this2.container = _ref3;
|
|
561
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
|
|
562
|
+
ref: function ref(_ref5) {
|
|
563
|
+
return _this2.container = _ref5;
|
|
547
564
|
},
|
|
548
565
|
style: {
|
|
549
566
|
padding: show_y_axis_left_label || show_x_axis_label ? 30 : 20
|