sea-chart 0.0.33-beta → 0.0.34
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/dist/settings/time-comparison-settings/style-settings.js +0 -1
- package/dist/utils/chart-utils/base-utils.js +23 -23
- package/dist/utils/chart-utils/original-data-utils/index.js +4 -4
- package/dist/utils/chart-utils/sql-statistics-utils.js +64 -64
- package/dist/view/wrapper/completeness.js +1 -8
- package/package.json +1 -1
|
@@ -91,7 +91,6 @@ const StyleSettings = _ref => {
|
|
|
91
91
|
});
|
|
92
92
|
}, [chart, onChange]);
|
|
93
93
|
const onDisplayValueChange = useCallback(update => {
|
|
94
|
-
console.log('update', update);
|
|
95
94
|
onChange && onChange(update);
|
|
96
95
|
}, [onChange]);
|
|
97
96
|
const onDisplayPercentageIncreaseChange = useCallback(event => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _class;
|
|
2
2
|
import shallowEqual from 'shallowequal';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, getDateDisplayString, getNumberDisplayString, getOption, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, isNumericColumn, isDateColumn, sortText, sortNumber, sortDate, sortSingleSelect, sortFormula, getColumnOptions, DateUtils, getGeolocationDisplayString, getFormulaDisplayString } from 'dtable-utils';
|
|
@@ -31,7 +31,7 @@ class BaseUtils {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
_class = BaseUtils;
|
|
35
35
|
// valid chart
|
|
36
36
|
BaseUtils.isValidCombinationChart = (config, table) => {
|
|
37
37
|
const summaryLeftColumnKey = config.y_axis_left_summary_column;
|
|
@@ -101,7 +101,7 @@ BaseUtils.isValidExistChart = (tables, chart) => {
|
|
|
101
101
|
if (!groupByColumnKey) return false;
|
|
102
102
|
if (!getTableColumnByKey(table, groupByColumnKey)) return false;
|
|
103
103
|
if (type === CHART_TYPE.COMBINATION) {
|
|
104
|
-
const isExist =
|
|
104
|
+
const isExist = _class.isValidCombinationChart(config, table);
|
|
105
105
|
if (!isExist) return false;
|
|
106
106
|
} else {
|
|
107
107
|
const summaryColumnKey = config.summary_column_key || config.y_axis_summary_column_key || config.horizontal_axis_column_key;
|
|
@@ -203,7 +203,7 @@ BaseUtils.getGroupName = (tables, chart) => {
|
|
|
203
203
|
config
|
|
204
204
|
} = chart;
|
|
205
205
|
const table = getTableById(tables, config.table_id);
|
|
206
|
-
const column =
|
|
206
|
+
const column = _class.getGroupColumn(table, chart);
|
|
207
207
|
return column.name;
|
|
208
208
|
};
|
|
209
209
|
BaseUtils.getChartGroups = charts => {
|
|
@@ -238,7 +238,7 @@ BaseUtils.getSummaryValueDisplayString = function (summaryColumn, summaryValue)
|
|
|
238
238
|
const {
|
|
239
239
|
data
|
|
240
240
|
} = summaryColumn;
|
|
241
|
-
if (
|
|
241
|
+
if (_class.isDateSummaryColumn(summaryColumn)) {
|
|
242
242
|
if (typeof summaryValue !== 'string') return summaryValue;
|
|
243
243
|
|
|
244
244
|
// Compatible with previous data
|
|
@@ -273,7 +273,7 @@ BaseUtils.getSummaryValue = (_ref, currentValue, nextValue) => {
|
|
|
273
273
|
summaryMethod,
|
|
274
274
|
summaryColumn
|
|
275
275
|
} = _ref;
|
|
276
|
-
if (
|
|
276
|
+
if (_class.isDateSummaryColumn(summaryColumn)) {
|
|
277
277
|
if (summaryMethod === 'MAX') {
|
|
278
278
|
if (currentValue && nextValue) {
|
|
279
279
|
return dayjs(currentValue).isBefore(nextValue) ? nextValue : currentValue;
|
|
@@ -350,7 +350,7 @@ BaseUtils.isChartStyleChanged = (prevElement, currElement) => {
|
|
|
350
350
|
return !shallowEqual(prevBorder, currBorder) || !shallowEqual(prevTitle, currTitle);
|
|
351
351
|
};
|
|
352
352
|
BaseUtils.shouldChartComponentUpdate = (prevProps, currentProps) => {
|
|
353
|
-
return !
|
|
353
|
+
return !_class.isChartEqual(prevProps.chart, currentProps.chart) ||
|
|
354
354
|
// chart attributes changed
|
|
355
355
|
!shallowEqual(prevProps.canvasStyle, currentProps.canvasStyle) ||
|
|
356
356
|
// canvasStyle
|
|
@@ -360,7 +360,7 @@ BaseUtils.shouldChartComponentUpdate = (prevProps, currentProps) => {
|
|
|
360
360
|
// columnGroupbyColumn's data、type changed or not exist
|
|
361
361
|
!shallowEqual(prevProps.summaryColumn, currentProps.summaryColumn) ||
|
|
362
362
|
// summaryColumn's data、type changed or not exist
|
|
363
|
-
|
|
363
|
+
_class._isChartDataChange(prevProps, currentProps) || _class.isChartStyleChanged(prevProps.chart, currentProps.chart);
|
|
364
364
|
};
|
|
365
365
|
BaseUtils._isCombinationDataChange = (prevResult, currentResult) => {
|
|
366
366
|
if (prevResult.value_left !== currentResult.value_left) return true;
|
|
@@ -376,7 +376,7 @@ BaseUtils._isChartDataChange = (prevProps, currentProps) => {
|
|
|
376
376
|
result: oldData
|
|
377
377
|
} = currentProps;
|
|
378
378
|
if (chart.config.type === CHART_TYPE.COMBINATION) {
|
|
379
|
-
return
|
|
379
|
+
return _class._isCombinationDataChange(newData, oldData);
|
|
380
380
|
}
|
|
381
381
|
if (!newData && !oldData) return false;
|
|
382
382
|
if (!newData && oldData || newData && !oldData) return true;
|
|
@@ -431,7 +431,7 @@ BaseUtils.getPieColorSet = (tables, chart, result) => {
|
|
|
431
431
|
table_id,
|
|
432
432
|
groupby_column_key: column_id
|
|
433
433
|
} = chart.config;
|
|
434
|
-
const column =
|
|
434
|
+
const column = _class.getColumn(tables, table_id, column_id);
|
|
435
435
|
const {
|
|
436
436
|
type: columnType
|
|
437
437
|
} = column || {};
|
|
@@ -498,7 +498,7 @@ BaseUtils.formatPieChartData = (data, chart, tables) => {
|
|
|
498
498
|
const value = item.value;
|
|
499
499
|
if (value >= threshold) {
|
|
500
500
|
item.percent = String(Number.parseFloat(value / sum * 100).toFixed(1)) + '%';
|
|
501
|
-
const color =
|
|
501
|
+
const color = _class.getPieColor(column, index, item);
|
|
502
502
|
item.color = color;
|
|
503
503
|
colorSet.push(color);
|
|
504
504
|
filteredData.push(item);
|
|
@@ -613,7 +613,7 @@ BaseUtils.updateTableViewListItemNameAndColor = (result, column, nameKey, colorK
|
|
|
613
613
|
};
|
|
614
614
|
BaseUtils.updateTableViewList = (result, column, nameKey, colorKey) => {
|
|
615
615
|
result.forEach(result => {
|
|
616
|
-
|
|
616
|
+
_class.updateTableViewListItemNameAndColor(result, column, nameKey, colorKey);
|
|
617
617
|
});
|
|
618
618
|
};
|
|
619
619
|
// sort chart
|
|
@@ -749,10 +749,10 @@ BaseUtils.formatGroupsLabel = (results, chart, tables) => {
|
|
|
749
749
|
group_name
|
|
750
750
|
} = item;
|
|
751
751
|
if (groupbyColumn) {
|
|
752
|
-
|
|
752
|
+
_class.convertResultName(item, groupbyColumn, name, 'name', 'color');
|
|
753
753
|
}
|
|
754
754
|
if (columnGroupbyColumn) {
|
|
755
|
-
|
|
755
|
+
_class.convertResultName(item, columnGroupbyColumn, group_name, 'group_name', 'group_color');
|
|
756
756
|
}
|
|
757
757
|
});
|
|
758
758
|
};
|
|
@@ -1176,19 +1176,19 @@ BaseUtils.getSummaryResult = function (results, summaryMethod) {
|
|
|
1176
1176
|
switch (summaryMethod) {
|
|
1177
1177
|
case CHART_SUMMARY_TYPE.MAX:
|
|
1178
1178
|
{
|
|
1179
|
-
return
|
|
1179
|
+
return _class.getMax(numericResults);
|
|
1180
1180
|
}
|
|
1181
1181
|
case CHART_SUMMARY_TYPE.MIN:
|
|
1182
1182
|
{
|
|
1183
|
-
return
|
|
1183
|
+
return _class.getMin(numericResults);
|
|
1184
1184
|
}
|
|
1185
1185
|
case CHART_SUMMARY_TYPE.SUM:
|
|
1186
1186
|
{
|
|
1187
|
-
return
|
|
1187
|
+
return _class.getSum(numericResults, precision);
|
|
1188
1188
|
}
|
|
1189
1189
|
case CHART_SUMMARY_TYPE.MEAN:
|
|
1190
1190
|
{
|
|
1191
|
-
return
|
|
1191
|
+
return _class.getMean(numericResults, precision);
|
|
1192
1192
|
}
|
|
1193
1193
|
case CHART_SUMMARY_TYPE.Distinct_values:
|
|
1194
1194
|
{
|
|
@@ -1235,7 +1235,7 @@ BaseUtils.getSum = function (list) {
|
|
|
1235
1235
|
BaseUtils.getMean = function (list) {
|
|
1236
1236
|
let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
|
|
1237
1237
|
if (list.length === 0) return 0;
|
|
1238
|
-
const sum =
|
|
1238
|
+
const sum = _class.getSum(list);
|
|
1239
1239
|
return Number.parseFloat((sum / list.length).toFixed(precision));
|
|
1240
1240
|
};
|
|
1241
1241
|
BaseUtils.summaryDurationResult = (result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) => {
|
|
@@ -1281,11 +1281,11 @@ BaseUtils.summaryDurationResult = (result, duration, summaryType, summaryMethod,
|
|
|
1281
1281
|
// }
|
|
1282
1282
|
|
|
1283
1283
|
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
1284
|
-
comparedValue =
|
|
1285
|
-
compareValue =
|
|
1284
|
+
comparedValue = _class.getSummaryResult(comparedValue, summaryMethod);
|
|
1285
|
+
compareValue = _class.getSummaryResult(compareValue, summaryMethod);
|
|
1286
1286
|
} else {
|
|
1287
|
-
compareValue =
|
|
1288
|
-
comparedValue =
|
|
1287
|
+
compareValue = _class.getSummaryResult(compareValue, 'Sum');
|
|
1288
|
+
comparedValue = _class.getSummaryResult(comparedValue, 'Sum');
|
|
1289
1289
|
}
|
|
1290
1290
|
return {
|
|
1291
1291
|
compareValue,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _class;
|
|
2
2
|
import { getTableById, getViewById } from 'dtable-utils';
|
|
3
3
|
import PivotTableCalculator from './pivot-table-calculator';
|
|
4
4
|
import BasicChartCalculator from './basic-chart-calculator';
|
|
@@ -34,7 +34,7 @@ const calculatorMap = {
|
|
|
34
34
|
[CHART_TYPE.DASHBOARD]: DashboardCalculator
|
|
35
35
|
};
|
|
36
36
|
class OriginalDataUtils {}
|
|
37
|
-
|
|
37
|
+
_class = OriginalDataUtils;
|
|
38
38
|
OriginalDataUtils.dataSources = 'original_data';
|
|
39
39
|
OriginalDataUtils.isValidExistChart = (tables, chart) => {
|
|
40
40
|
const isValid = BaseUtils.isValidExistChart(tables || [], chart);
|
|
@@ -49,7 +49,7 @@ OriginalDataUtils.isValidExistChart = (tables, chart) => {
|
|
|
49
49
|
return true;
|
|
50
50
|
};
|
|
51
51
|
OriginalDataUtils.calculateChart = async (chart, value, callback) => {
|
|
52
|
-
if (!
|
|
52
|
+
if (!_class.isValidExistChart((value === null || value === void 0 ? void 0 : value.tables) || [], chart)) {
|
|
53
53
|
const tip_message = 'Please_complete_the_chart_configuration_first';
|
|
54
54
|
return callback && callback('', tip_message, null);
|
|
55
55
|
}
|
|
@@ -76,7 +76,7 @@ OriginalDataUtils.calculateChart = async (chart, value, callback) => {
|
|
|
76
76
|
const chartTableColumns = table.columns;
|
|
77
77
|
return callback && callback('', '', {
|
|
78
78
|
result,
|
|
79
|
-
data_sources:
|
|
79
|
+
data_sources: _class.dataSources,
|
|
80
80
|
groupbyColumn,
|
|
81
81
|
columnGroupbyColumn,
|
|
82
82
|
summaryColumn,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _class;
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { CellType, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, getFormulaDisplayString, getPrecisionNumber, getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
4
4
|
import { CHART_SUMMARY_TYPE, CHART_TYPE, SUPPORT_DATA_SORT_CHART_TYPES, LABEL_COLORS, TABLE_DIMENSIONS, Y_AXIS_TYPE_PREFIX } from '../../constants';
|
|
@@ -11,7 +11,7 @@ import { getCompareDate } from '../trend-utils';
|
|
|
11
11
|
import intl from '../../intl';
|
|
12
12
|
import BaseUtils from './base-utils';
|
|
13
13
|
class SQLStatisticsUtils {}
|
|
14
|
-
|
|
14
|
+
_class = SQLStatisticsUtils;
|
|
15
15
|
SQLStatisticsUtils.dataSources = 'sql_statistics';
|
|
16
16
|
SQLStatisticsUtils.getGroupLabelFromDB = (cellValue, column, tables) => {
|
|
17
17
|
const collaborators = context.getCollaboratorsFromCache();
|
|
@@ -230,7 +230,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
230
230
|
const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
|
|
231
231
|
let newSqlRows = sqlRows;
|
|
232
232
|
if (groupbyColumn.type === CellType.COLLABORATOR) {
|
|
233
|
-
newSqlRows =
|
|
233
|
+
newSqlRows = _class.formatedTableSqlRows(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
234
234
|
}
|
|
235
235
|
if (isCount) {
|
|
236
236
|
let allTotal = 0;
|
|
@@ -238,7 +238,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
238
238
|
const total = row[sqlSummaryColumnKey] || 0;
|
|
239
239
|
allTotal += total;
|
|
240
240
|
pivot_rows.push({
|
|
241
|
-
name:
|
|
241
|
+
name: _class.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, tables),
|
|
242
242
|
rows: [],
|
|
243
243
|
total: {
|
|
244
244
|
total
|
|
@@ -291,7 +291,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
291
291
|
}
|
|
292
292
|
});
|
|
293
293
|
pivot_rows.push({
|
|
294
|
-
name:
|
|
294
|
+
name: _class.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, tables),
|
|
295
295
|
rows: [row],
|
|
296
296
|
total: rowTotal
|
|
297
297
|
});
|
|
@@ -465,11 +465,11 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
465
465
|
sqlColumnGroupbyColumnKey,
|
|
466
466
|
sqlSummaryColumnKey
|
|
467
467
|
} = chartSQLMap;
|
|
468
|
-
if (!sqlColumnGroupbyColumnKey) return
|
|
468
|
+
if (!sqlColumnGroupbyColumnKey) return _class.oneDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
469
469
|
const summaryMethod = (summary_method || 'sum').toUpperCase();
|
|
470
470
|
let newSqlRows = sqlRows;
|
|
471
471
|
if (groupbyColumn.type === CellType.COLLABORATOR) {
|
|
472
|
-
newSqlRows =
|
|
472
|
+
newSqlRows = _class.formatedTableSqlRows(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
473
473
|
}
|
|
474
474
|
let pivot_columns = [];
|
|
475
475
|
let pivot_rows = [];
|
|
@@ -477,12 +477,12 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
477
477
|
const isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
478
478
|
newSqlRows.forEach(row => {
|
|
479
479
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
480
|
-
const groupbyColumnCellValueKey =
|
|
480
|
+
const groupbyColumnCellValueKey = _class.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, tables);
|
|
481
481
|
const columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
482
|
-
const columnGroupbyColumnCellValueKey =
|
|
482
|
+
const columnGroupbyColumnCellValueKey = _class.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, tables);
|
|
483
483
|
const count = !row[sqlSummaryColumnKey] && row[sqlSummaryColumnKey] !== 0 ? null : row[sqlSummaryColumnKey];
|
|
484
484
|
if (BaseUtils.isValidCellValue(columnGroupbyColumnCellValue, groupby_include_empty_cells)) {
|
|
485
|
-
|
|
485
|
+
_class.updateTwoDimensionColumns(pivot_columns, columnGroupbyColumnCellValueKey, {
|
|
486
486
|
isIncludeEmpty: groupby_include_empty_cells,
|
|
487
487
|
isCellValueAsAnArray: isRowGroupbyColumnDataAsAnArray
|
|
488
488
|
});
|
|
@@ -491,14 +491,14 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
491
491
|
if (MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[groupbyColumn]) {
|
|
492
492
|
if ((!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) && groupby_include_empty_cells) {
|
|
493
493
|
let pivotRowIndex = pivot_rows.findIndex(r => !r.name);
|
|
494
|
-
|
|
494
|
+
_class.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, null, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
495
495
|
summaryMethod,
|
|
496
496
|
summaryColumn
|
|
497
497
|
});
|
|
498
498
|
} else {
|
|
499
499
|
groupbyColumnCellValueKey.forEach(n => {
|
|
500
500
|
let pivotRowIndex = pivot_rows.findIndex(r => n === r.name);
|
|
501
|
-
|
|
501
|
+
_class.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, n, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
502
502
|
summaryMethod,
|
|
503
503
|
summaryColumn
|
|
504
504
|
});
|
|
@@ -509,14 +509,14 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
509
509
|
let resName = r.name;
|
|
510
510
|
return resName === null && groupbyColumnCellValueKey === null || resName === undefined && groupbyColumnCellValueKey === undefined || resName === 0 && groupbyColumnCellValueKey === 0 || resName === groupbyColumnCellValueKey;
|
|
511
511
|
});
|
|
512
|
-
|
|
512
|
+
_class.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, groupbyColumnCellValueKey, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
513
513
|
summaryMethod,
|
|
514
514
|
summaryColumn
|
|
515
515
|
});
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
});
|
|
519
|
-
let pivot_table_total =
|
|
519
|
+
let pivot_table_total = _class.getAndUpdateTwoDimensionTotal(pivot_columns_total, pivot_columns, pivot_rows, {
|
|
520
520
|
summaryMethod,
|
|
521
521
|
summaryColumn
|
|
522
522
|
});
|
|
@@ -558,7 +558,7 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap
|
|
|
558
558
|
formatted_value = getFormattedValue(cellValue, y_axis_summary_column_key, y_axis_summary_method);
|
|
559
559
|
}
|
|
560
560
|
if (BaseUtils.isValidCellValue(cellValue)) {
|
|
561
|
-
const key =
|
|
561
|
+
const key = _class.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
562
562
|
if (isGroupbyColumnDataAsAnArray) {
|
|
563
563
|
if (!Array.isArray(key) || key.length === 0) {
|
|
564
564
|
let itemIdx = result.findIndex(v => v.name === null);
|
|
@@ -672,7 +672,7 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMa
|
|
|
672
672
|
let result = [];
|
|
673
673
|
sqlRows.forEach(row => {
|
|
674
674
|
const cellValue = row[sqlGroupbyColumnKey];
|
|
675
|
-
const label =
|
|
675
|
+
const label = _class.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
676
676
|
const isEmpty = !label;
|
|
677
677
|
const groupItems = [];
|
|
678
678
|
summaryMethods.forEach((summaryMethod, index) => {
|
|
@@ -722,7 +722,7 @@ SQLStatisticsUtils.compareSQLResult2Javascript = (chart, sqlRows, chartSQLMap, c
|
|
|
722
722
|
const isAdvanced = y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED;
|
|
723
723
|
sqlRows.forEach(item => {
|
|
724
724
|
const name = item[sqlGroupbyColumnKey];
|
|
725
|
-
const label =
|
|
725
|
+
const label = _class.getGroupLabelFromDB(name, groupbyColumn, tables);
|
|
726
726
|
const value = item[sqlSummaryColumnKey];
|
|
727
727
|
if (name >= x_axis_date_range_start && name <= x_axis_date_range_end) {
|
|
728
728
|
const currentValue = dateRangeResult.get(label);
|
|
@@ -846,7 +846,7 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
846
846
|
sqlRows.forEach(row => {
|
|
847
847
|
const cellValue = row[sqlGroupbyColumnKey];
|
|
848
848
|
const summaryValue = row[sqlSummaryColumnKey];
|
|
849
|
-
const key =
|
|
849
|
+
const key = _class.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
850
850
|
let valueLeft = row[sqlLeftSummaryColumnKey] || 0;
|
|
851
851
|
let valueRight = row[sqlRightSummaryColumnKey] || 0;
|
|
852
852
|
if (y_axis_left_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
@@ -933,7 +933,7 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
933
933
|
});
|
|
934
934
|
sqlRows.forEach((item, index) => {
|
|
935
935
|
const cellValue = item[sqlGroupbyColumnKey];
|
|
936
|
-
const key =
|
|
936
|
+
const key = _class.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
937
937
|
let valueRight = item[sqlRightSummaryColumnKey] || 0;
|
|
938
938
|
if (y_axis_right_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
939
939
|
valueRight = BaseUtils.getPrecisionNumber(valueRight, rightSummaryColumn.data);
|
|
@@ -1006,15 +1006,15 @@ SQLStatisticsUtils.updateGroupingChartRow = (results, name, groupName, row, coun
|
|
|
1006
1006
|
SQLStatisticsUtils.updateGroupingChartRows = (results, name, row, count, isColumnGroupbyColumnDataAsAnArray, groupName) => {
|
|
1007
1007
|
if (isColumnGroupbyColumnDataAsAnArray) {
|
|
1008
1008
|
if (!Array.isArray(groupName) || groupName.length === 0) {
|
|
1009
|
-
|
|
1009
|
+
_class.updateGroupingChartRow(results, name, null, row, count);
|
|
1010
1010
|
return;
|
|
1011
1011
|
}
|
|
1012
1012
|
groupName.forEach(v => {
|
|
1013
|
-
|
|
1013
|
+
_class.updateGroupingChartRow(results, name, v, row, count);
|
|
1014
1014
|
});
|
|
1015
1015
|
return;
|
|
1016
1016
|
}
|
|
1017
|
-
|
|
1017
|
+
_class.updateGroupingChartRow(results, name, groupName, row, count);
|
|
1018
1018
|
};
|
|
1019
1019
|
SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1020
1020
|
const {
|
|
@@ -1034,21 +1034,21 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = (chart, sqlRo
|
|
|
1034
1034
|
const isColumnGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
1035
1035
|
sqlRows.forEach(row => {
|
|
1036
1036
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
1037
|
-
const groupbyColumnCellValueKey =
|
|
1037
|
+
const groupbyColumnCellValueKey = _class.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, tables);
|
|
1038
1038
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValueKey, includeEmpty)) {
|
|
1039
1039
|
const columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
1040
|
-
const columnGroupbyColumnCellValueKey =
|
|
1040
|
+
const columnGroupbyColumnCellValueKey = _class.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, tables);
|
|
1041
1041
|
const count = row[sqlSummaryColumnKey];
|
|
1042
1042
|
if (isGroupbyColumnDataAsAnArray) {
|
|
1043
1043
|
if (!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) {
|
|
1044
|
-
|
|
1044
|
+
_class.updateGroupingChartRows(result, null, row, count, isColumnGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey);
|
|
1045
1045
|
} else {
|
|
1046
1046
|
groupbyColumnCellValueKey.forEach(n => {
|
|
1047
|
-
|
|
1047
|
+
_class.updateGroupingChartRows(result, n, row, count, isColumnGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey);
|
|
1048
1048
|
});
|
|
1049
1049
|
}
|
|
1050
1050
|
} else {
|
|
1051
|
-
|
|
1051
|
+
_class.updateGroupingChartRows(result, groupbyColumnCellValueKey, row, count, isColumnGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey);
|
|
1052
1052
|
}
|
|
1053
1053
|
}
|
|
1054
1054
|
});
|
|
@@ -1065,15 +1065,15 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1065
1065
|
x_axis_include_empty_cells: includeEmpty
|
|
1066
1066
|
} = chart.config;
|
|
1067
1067
|
if (!column_groupby_column_key && !column_groupby_multiple_numeric_column) {
|
|
1068
|
-
return
|
|
1068
|
+
return _class.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1069
1069
|
}
|
|
1070
1070
|
const {
|
|
1071
1071
|
groupbyColumn,
|
|
1072
1072
|
columnGroupbyColumn
|
|
1073
1073
|
} = columnMap;
|
|
1074
1074
|
if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
1075
|
-
if (!columnGroupbyColumn) return
|
|
1076
|
-
return
|
|
1075
|
+
if (!columnGroupbyColumn) return _class.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1076
|
+
return _class.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1077
1077
|
}
|
|
1078
1078
|
const {
|
|
1079
1079
|
sqlGroupbyColumnKey
|
|
@@ -1086,7 +1086,7 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1086
1086
|
const isGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[groupbyColumn.type];
|
|
1087
1087
|
sqlRows.forEach(row => {
|
|
1088
1088
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
1089
|
-
const groupbyColumnCellValueKey =
|
|
1089
|
+
const groupbyColumnCellValueKey = _class.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, tables);
|
|
1090
1090
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValueKey, includeEmpty)) {
|
|
1091
1091
|
Object.keys(summaryColumns).forEach(sqlSummaryColumnName => {
|
|
1092
1092
|
const {
|
|
@@ -1096,14 +1096,14 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1096
1096
|
const numberColumnCellValue = row[sqlSummaryColumnKey];
|
|
1097
1097
|
if (isGroupbyColumnDataAsAnArray) {
|
|
1098
1098
|
if (!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) {
|
|
1099
|
-
|
|
1099
|
+
_class.updateGroupingChartRows(result, null, row, numberColumnCellValue, false, columnName);
|
|
1100
1100
|
} else {
|
|
1101
1101
|
groupbyColumnCellValueKey.forEach(n => {
|
|
1102
|
-
|
|
1102
|
+
_class.updateGroupingChartRows(result, n, row, numberColumnCellValue, false, columnName);
|
|
1103
1103
|
});
|
|
1104
1104
|
}
|
|
1105
1105
|
} else {
|
|
1106
|
-
|
|
1106
|
+
_class.updateGroupingChartRows(result, groupbyColumnCellValueKey, row, numberColumnCellValue, false, columnName);
|
|
1107
1107
|
}
|
|
1108
1108
|
});
|
|
1109
1109
|
}
|
|
@@ -1113,9 +1113,9 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1113
1113
|
return result;
|
|
1114
1114
|
}
|
|
1115
1115
|
if (!columnGroupbyColumn) {
|
|
1116
|
-
return
|
|
1116
|
+
return _class.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1117
1117
|
}
|
|
1118
|
-
return
|
|
1118
|
+
return _class.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1119
1119
|
};
|
|
1120
1120
|
SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1121
1121
|
const {
|
|
@@ -1187,12 +1187,12 @@ SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQ
|
|
|
1187
1187
|
} = chartSQLMap;
|
|
1188
1188
|
const isAdvanced = summary_type === CHART_SUMMARY_TYPE.ADVANCED;
|
|
1189
1189
|
const newResult = [];
|
|
1190
|
-
const groupData =
|
|
1190
|
+
const groupData = _class.getGroupData(sqlRows, columnGroupbyColumn);
|
|
1191
1191
|
if (groupData.length > 0) {
|
|
1192
1192
|
const groupData0 = groupData[0] || {};
|
|
1193
1193
|
const groupData1 = groupData[1] || {};
|
|
1194
1194
|
sqlRows.forEach(item => {
|
|
1195
|
-
const label =
|
|
1195
|
+
const label = _class.getGroupLabelFromDB(item[column_key], groupbyColumn, tables);
|
|
1196
1196
|
const groupValue = item[group_column_key];
|
|
1197
1197
|
const equal2GroupData0 = groupData0.id === groupValue;
|
|
1198
1198
|
const equal2GroupData1 = groupData1.id === groupValue;
|
|
@@ -1287,11 +1287,11 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1287
1287
|
} = chart.config;
|
|
1288
1288
|
if (!column_groupby_column_key) {
|
|
1289
1289
|
return {
|
|
1290
|
-
result:
|
|
1290
|
+
result: _class.oneDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1291
1291
|
};
|
|
1292
1292
|
}
|
|
1293
1293
|
return {
|
|
1294
|
-
result:
|
|
1294
|
+
result: _class.twoDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1295
1295
|
};
|
|
1296
1296
|
}
|
|
1297
1297
|
case CHART_TYPE.PIE:
|
|
@@ -1299,19 +1299,19 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1299
1299
|
case CHART_TYPE.TREE_MAP:
|
|
1300
1300
|
{
|
|
1301
1301
|
return {
|
|
1302
|
-
result:
|
|
1302
|
+
result: _class.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1303
1303
|
};
|
|
1304
1304
|
}
|
|
1305
1305
|
case CHART_TYPE.BASIC_NUMBER_CARD:
|
|
1306
1306
|
{
|
|
1307
1307
|
return {
|
|
1308
|
-
result:
|
|
1308
|
+
result: _class.basicNumberCardSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1309
1309
|
};
|
|
1310
1310
|
}
|
|
1311
1311
|
case CHART_TYPE.DASHBOARD:
|
|
1312
1312
|
{
|
|
1313
1313
|
return {
|
|
1314
|
-
result:
|
|
1314
|
+
result: _class.dashboardSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1315
1315
|
};
|
|
1316
1316
|
}
|
|
1317
1317
|
case CHART_TYPE.BAR:
|
|
@@ -1320,13 +1320,13 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1320
1320
|
case CHART_TYPE.AREA:
|
|
1321
1321
|
{
|
|
1322
1322
|
return {
|
|
1323
|
-
result:
|
|
1323
|
+
result: _class.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1324
1324
|
};
|
|
1325
1325
|
}
|
|
1326
1326
|
case CHART_TYPE.COMPLETENESS:
|
|
1327
1327
|
case CHART_TYPE.COMPLETENESS_GROUP:
|
|
1328
1328
|
{
|
|
1329
|
-
const result =
|
|
1329
|
+
const result = _class.completenessSQlResult(chart, sqlRows, chartSQLMap, tables);
|
|
1330
1330
|
return {
|
|
1331
1331
|
result
|
|
1332
1332
|
};
|
|
@@ -1334,13 +1334,13 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1334
1334
|
case CHART_TYPE.COMBINATION:
|
|
1335
1335
|
{
|
|
1336
1336
|
return {
|
|
1337
|
-
result:
|
|
1337
|
+
result: _class.combinationSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1338
1338
|
};
|
|
1339
1339
|
}
|
|
1340
1340
|
case CHART_TYPE.COMPARE_BAR:
|
|
1341
1341
|
{
|
|
1342
1342
|
return {
|
|
1343
|
-
result:
|
|
1343
|
+
result: _class.compareSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1344
1344
|
};
|
|
1345
1345
|
}
|
|
1346
1346
|
case CHART_TYPE.BAR_GROUP:
|
|
@@ -1351,51 +1351,51 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1351
1351
|
case CHART_TYPE.STACKED_HORIZONTAL_BAR:
|
|
1352
1352
|
{
|
|
1353
1353
|
return {
|
|
1354
|
-
result:
|
|
1354
|
+
result: _class.groupingChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1355
1355
|
};
|
|
1356
1356
|
}
|
|
1357
1357
|
case CHART_TYPE.SCATTER:
|
|
1358
1358
|
{
|
|
1359
1359
|
return {
|
|
1360
|
-
result:
|
|
1360
|
+
result: _class.scatterSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1361
1361
|
};
|
|
1362
1362
|
}
|
|
1363
1363
|
case CHART_TYPE.BAR_CUSTOM:
|
|
1364
1364
|
{
|
|
1365
1365
|
return {
|
|
1366
|
-
result:
|
|
1366
|
+
result: _class.customChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables, params)
|
|
1367
1367
|
};
|
|
1368
1368
|
}
|
|
1369
1369
|
case CHART_TYPE.MAP:
|
|
1370
1370
|
case CHART_TYPE.MAP_BUBBLE:
|
|
1371
1371
|
{
|
|
1372
1372
|
return {
|
|
1373
|
-
result:
|
|
1373
|
+
result: _class.mapSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1374
1374
|
};
|
|
1375
1375
|
}
|
|
1376
1376
|
case CHART_TYPE.WORLD_MAP:
|
|
1377
1377
|
case CHART_TYPE.WORLD_MAP_BUBBLE:
|
|
1378
1378
|
{
|
|
1379
1379
|
return {
|
|
1380
|
-
result:
|
|
1380
|
+
result: _class.worldMapSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1381
1381
|
};
|
|
1382
1382
|
}
|
|
1383
1383
|
case CHART_TYPE.HEAT_MAP:
|
|
1384
1384
|
{
|
|
1385
1385
|
return {
|
|
1386
|
-
result:
|
|
1386
|
+
result: _class.heatMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1387
1387
|
};
|
|
1388
1388
|
}
|
|
1389
1389
|
case CHART_TYPE.MIRROR:
|
|
1390
1390
|
{
|
|
1391
1391
|
return {
|
|
1392
|
-
result:
|
|
1392
|
+
result: _class.mirrorMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1393
1393
|
};
|
|
1394
1394
|
}
|
|
1395
1395
|
case CHART_TYPE.TREND:
|
|
1396
1396
|
{
|
|
1397
1397
|
return {
|
|
1398
|
-
result:
|
|
1398
|
+
result: _class.trendMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1399
1399
|
};
|
|
1400
1400
|
}
|
|
1401
1401
|
default:
|
|
@@ -1436,7 +1436,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1436
1436
|
let summedSqlRows;
|
|
1437
1437
|
if (!isGroup) {
|
|
1438
1438
|
const sumSqlRows = sqlRows.reduce((acc, row) => {
|
|
1439
|
-
const nameValue =
|
|
1439
|
+
const nameValue = _class._get_completeness_name(row, name_column);
|
|
1440
1440
|
if (!acc[nameValue]) {
|
|
1441
1441
|
acc[nameValue] = row;
|
|
1442
1442
|
} else {
|
|
@@ -1451,7 +1451,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1451
1451
|
summedSqlRows = Object.values(sumSqlRows);
|
|
1452
1452
|
} else {
|
|
1453
1453
|
const sumSqlRowsWithGroupBy = sqlRows.reduce((acc, row) => {
|
|
1454
|
-
const nameValue =
|
|
1454
|
+
const nameValue = _class._get_completeness_name(row, name_column);
|
|
1455
1455
|
const groupby = row[sqlColumnGroupByColumnKey];
|
|
1456
1456
|
const key = "".concat(nameValue, "_").concat(groupby);
|
|
1457
1457
|
if (!acc[key]) {
|
|
@@ -1469,7 +1469,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1469
1469
|
summedSqlRows = Object.values(sumSqlRowsWithGroupBy);
|
|
1470
1470
|
}
|
|
1471
1471
|
summedSqlRows.forEach(row => {
|
|
1472
|
-
const nameValue =
|
|
1472
|
+
const nameValue = _class._get_completeness_name(row, name_column);
|
|
1473
1473
|
let targetValue;
|
|
1474
1474
|
let completedValue;
|
|
1475
1475
|
let groupby;
|
|
@@ -1478,8 +1478,8 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1478
1478
|
completedValue = row["SUM(".concat(completed_column.name, ")")];
|
|
1479
1479
|
groupby = row[sqlColumnGroupByColumnKey] || intl.get('Empty');
|
|
1480
1480
|
} else {
|
|
1481
|
-
completedValue =
|
|
1482
|
-
targetValue =
|
|
1481
|
+
completedValue = _class._get_completeness_name(row, completed_column);
|
|
1482
|
+
targetValue = _class._get_completeness_name(row, target_column);
|
|
1483
1483
|
}
|
|
1484
1484
|
let completedRate;
|
|
1485
1485
|
if (!targetValue && completedValue) {
|
|
@@ -1640,7 +1640,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1640
1640
|
const result = [];
|
|
1641
1641
|
sqlRows.forEach((item, index) => {
|
|
1642
1642
|
if (item.length !== 0) {
|
|
1643
|
-
const chartResult =
|
|
1643
|
+
const chartResult = _class.sqlResult2JavaScript(newChart, item, chartSQLMap, columnMap, tables, {
|
|
1644
1644
|
index
|
|
1645
1645
|
});
|
|
1646
1646
|
result.push(...chartResult.result);
|
|
@@ -1652,7 +1652,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
callback && callback('', '', {
|
|
1654
1654
|
result,
|
|
1655
|
-
data_sources:
|
|
1655
|
+
data_sources: _class.dataSources,
|
|
1656
1656
|
groupbyColumn,
|
|
1657
1657
|
columnGroupbyColumn,
|
|
1658
1658
|
summaryColumn,
|
|
@@ -1666,7 +1666,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1666
1666
|
callback && callback('', tipMessage, null);
|
|
1667
1667
|
return;
|
|
1668
1668
|
}
|
|
1669
|
-
const chartResult =
|
|
1669
|
+
const chartResult = _class.sqlResult2JavaScript(newChart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1670
1670
|
|
|
1671
1671
|
// map is special
|
|
1672
1672
|
if (BaseUtils.imEmptyChartResult(chartResult) && !chartType.includes('map')) {
|
|
@@ -1675,7 +1675,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1675
1675
|
}
|
|
1676
1676
|
callback && callback('', '', {
|
|
1677
1677
|
...chartResult,
|
|
1678
|
-
data_sources:
|
|
1678
|
+
data_sources: _class.dataSources,
|
|
1679
1679
|
groupbyColumn,
|
|
1680
1680
|
columnGroupbyColumn,
|
|
1681
1681
|
summaryColumn,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
2
|
import React, { useEffect, useRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { maxBy } from 'lodash-es';
|
|
4
4
|
import { BaseUtils, isBoolean } from '../../utils';
|
|
5
5
|
import intl from '../../intl';
|
|
6
6
|
import { CHART_STYLE_COLORS, CHART_TYPE } from '../../constants';
|
|
@@ -15,12 +15,6 @@ export default function Completeness(props) {
|
|
|
15
15
|
chartRef.current = chartComponent;
|
|
16
16
|
}
|
|
17
17
|
const currentChart = chartRef.current;
|
|
18
|
-
const handleReize = debounce(() => {
|
|
19
|
-
currentChart.chart.destroy();
|
|
20
|
-
createChart();
|
|
21
|
-
drawChart();
|
|
22
|
-
}, 300);
|
|
23
|
-
window.addEventListener('resize', handleReize);
|
|
24
18
|
let chartPaddingTop;
|
|
25
19
|
// avoid closure trap
|
|
26
20
|
function createChart() {
|
|
@@ -156,7 +150,6 @@ export default function Completeness(props) {
|
|
|
156
150
|
drawChart();
|
|
157
151
|
return () => {
|
|
158
152
|
currentChart.chart.destroy();
|
|
159
|
-
window.removeEventListener('resize', handleReize);
|
|
160
153
|
};
|
|
161
154
|
}, [props]);
|
|
162
155
|
const {
|