sea-chart 0.0.32 → 0.0.33-beta
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/map-settings/map-data-settings.js +3 -2
- 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 +72 -75
- package/dist/utils/sql/chart-data-sql.js +4 -5
- package/dist/view/wrapper/bar-group.js +0 -1
- package/dist/view/wrapper/heat-map.js +1 -1
- package/dist/view/wrapper/horizontal-component.js +1 -1
- package/dist/view/wrapper/line.js +0 -2
- package/dist/view/wrapper/scatter.js +1 -1
- package/dist/view/wrapper/treemap.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { getTableById } from 'dtable-utils';
|
|
2
3
|
import intl from '../../intl';
|
|
3
4
|
import Divider from '../widgets/divider';
|
|
4
5
|
import CommonDataSettings from '../widgets/common-data-settings';
|
|
@@ -28,8 +29,8 @@ const MapDataSettings = _ref => {
|
|
|
28
29
|
map_location
|
|
29
30
|
} = chart.config;
|
|
30
31
|
const isCountryLevel = map_level === MAP_LEVEL.COUNTRY;
|
|
31
|
-
const selectedTable = tables
|
|
32
|
-
const locationColumns = selectedTable.columns.filter(column => [CHART_TYPE.WORLD_MAP, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type) ? isWorldMapColumn(column) : isMapColumn(column));
|
|
32
|
+
const selectedTable = getTableById(tables, table_id);
|
|
33
|
+
const locationColumns = (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.columns.filter(column => [CHART_TYPE.WORLD_MAP, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type) ? isWorldMapColumn(column) : isMapColumn(column))) || [];
|
|
33
34
|
function handleYAxisGroupSettingsChange(value) {
|
|
34
35
|
const update = {};
|
|
35
36
|
Object.keys(value).forEach(key => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _BaseUtils;
|
|
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
|
+
_BaseUtils = 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 = _BaseUtils.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 = _BaseUtils.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 (_BaseUtils.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 (_BaseUtils.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 !_BaseUtils.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
|
+
_BaseUtils._isChartDataChange(prevProps, currentProps) || _BaseUtils.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 _BaseUtils._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 = _BaseUtils.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 = _BaseUtils.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
|
+
_BaseUtils.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
|
+
_BaseUtils.convertResultName(item, groupbyColumn, name, 'name', 'color');
|
|
753
753
|
}
|
|
754
754
|
if (columnGroupbyColumn) {
|
|
755
|
-
|
|
755
|
+
_BaseUtils.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 _BaseUtils.getMax(numericResults);
|
|
1180
1180
|
}
|
|
1181
1181
|
case CHART_SUMMARY_TYPE.MIN:
|
|
1182
1182
|
{
|
|
1183
|
-
return
|
|
1183
|
+
return _BaseUtils.getMin(numericResults);
|
|
1184
1184
|
}
|
|
1185
1185
|
case CHART_SUMMARY_TYPE.SUM:
|
|
1186
1186
|
{
|
|
1187
|
-
return
|
|
1187
|
+
return _BaseUtils.getSum(numericResults, precision);
|
|
1188
1188
|
}
|
|
1189
1189
|
case CHART_SUMMARY_TYPE.MEAN:
|
|
1190
1190
|
{
|
|
1191
|
-
return
|
|
1191
|
+
return _BaseUtils.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 = _BaseUtils.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 = _BaseUtils.getSummaryResult(comparedValue, summaryMethod);
|
|
1285
|
+
compareValue = _BaseUtils.getSummaryResult(compareValue, summaryMethod);
|
|
1286
1286
|
} else {
|
|
1287
|
-
compareValue =
|
|
1288
|
-
comparedValue =
|
|
1287
|
+
compareValue = _BaseUtils.getSummaryResult(compareValue, 'Sum');
|
|
1288
|
+
comparedValue = _BaseUtils.getSummaryResult(comparedValue, 'Sum');
|
|
1289
1289
|
}
|
|
1290
1290
|
return {
|
|
1291
1291
|
compareValue,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _OriginalDataUtils;
|
|
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
|
+
_OriginalDataUtils = 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 (!_OriginalDataUtils.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: _OriginalDataUtils.dataSources,
|
|
80
80
|
groupbyColumn,
|
|
81
81
|
columnGroupbyColumn,
|
|
82
82
|
summaryColumn,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _SQLStatisticsUtils;
|
|
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';
|
|
@@ -10,18 +10,8 @@ import { formatNumericValue, getFormattedValue, getSummaryResult } from '../colu
|
|
|
10
10
|
import { getCompareDate } from '../trend-utils';
|
|
11
11
|
import intl from '../../intl';
|
|
12
12
|
import BaseUtils from './base-utils';
|
|
13
|
-
class SQLStatisticsUtils {
|
|
14
|
-
|
|
15
|
-
this._get_completeness_name = (row, column) => {
|
|
16
|
-
let value = row[column.key];
|
|
17
|
-
if (Array.isArray(value)) {
|
|
18
|
-
value = value.join('、');
|
|
19
|
-
}
|
|
20
|
-
return value;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
_class = SQLStatisticsUtils;
|
|
13
|
+
class SQLStatisticsUtils {}
|
|
14
|
+
_SQLStatisticsUtils = SQLStatisticsUtils;
|
|
25
15
|
SQLStatisticsUtils.dataSources = 'sql_statistics';
|
|
26
16
|
SQLStatisticsUtils.getGroupLabelFromDB = (cellValue, column, tables) => {
|
|
27
17
|
const collaborators = context.getCollaboratorsFromCache();
|
|
@@ -240,7 +230,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
240
230
|
const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
|
|
241
231
|
let newSqlRows = sqlRows;
|
|
242
232
|
if (groupbyColumn.type === CellType.COLLABORATOR) {
|
|
243
|
-
newSqlRows =
|
|
233
|
+
newSqlRows = _SQLStatisticsUtils.formatedTableSqlRows(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
244
234
|
}
|
|
245
235
|
if (isCount) {
|
|
246
236
|
let allTotal = 0;
|
|
@@ -248,7 +238,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
248
238
|
const total = row[sqlSummaryColumnKey] || 0;
|
|
249
239
|
allTotal += total;
|
|
250
240
|
pivot_rows.push({
|
|
251
|
-
name:
|
|
241
|
+
name: _SQLStatisticsUtils.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, tables),
|
|
252
242
|
rows: [],
|
|
253
243
|
total: {
|
|
254
244
|
total
|
|
@@ -301,7 +291,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
301
291
|
}
|
|
302
292
|
});
|
|
303
293
|
pivot_rows.push({
|
|
304
|
-
name:
|
|
294
|
+
name: _SQLStatisticsUtils.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, tables),
|
|
305
295
|
rows: [row],
|
|
306
296
|
total: rowTotal
|
|
307
297
|
});
|
|
@@ -475,11 +465,11 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
475
465
|
sqlColumnGroupbyColumnKey,
|
|
476
466
|
sqlSummaryColumnKey
|
|
477
467
|
} = chartSQLMap;
|
|
478
|
-
if (!sqlColumnGroupbyColumnKey) return
|
|
468
|
+
if (!sqlColumnGroupbyColumnKey) return _SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
479
469
|
const summaryMethod = (summary_method || 'sum').toUpperCase();
|
|
480
470
|
let newSqlRows = sqlRows;
|
|
481
471
|
if (groupbyColumn.type === CellType.COLLABORATOR) {
|
|
482
|
-
newSqlRows =
|
|
472
|
+
newSqlRows = _SQLStatisticsUtils.formatedTableSqlRows(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
483
473
|
}
|
|
484
474
|
let pivot_columns = [];
|
|
485
475
|
let pivot_rows = [];
|
|
@@ -487,12 +477,12 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
487
477
|
const isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
488
478
|
newSqlRows.forEach(row => {
|
|
489
479
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
490
|
-
const groupbyColumnCellValueKey =
|
|
480
|
+
const groupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, tables);
|
|
491
481
|
const columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
492
|
-
const columnGroupbyColumnCellValueKey =
|
|
482
|
+
const columnGroupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, tables);
|
|
493
483
|
const count = !row[sqlSummaryColumnKey] && row[sqlSummaryColumnKey] !== 0 ? null : row[sqlSummaryColumnKey];
|
|
494
484
|
if (BaseUtils.isValidCellValue(columnGroupbyColumnCellValue, groupby_include_empty_cells)) {
|
|
495
|
-
|
|
485
|
+
_SQLStatisticsUtils.updateTwoDimensionColumns(pivot_columns, columnGroupbyColumnCellValueKey, {
|
|
496
486
|
isIncludeEmpty: groupby_include_empty_cells,
|
|
497
487
|
isCellValueAsAnArray: isRowGroupbyColumnDataAsAnArray
|
|
498
488
|
});
|
|
@@ -501,14 +491,14 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
501
491
|
if (MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[groupbyColumn]) {
|
|
502
492
|
if ((!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) && groupby_include_empty_cells) {
|
|
503
493
|
let pivotRowIndex = pivot_rows.findIndex(r => !r.name);
|
|
504
|
-
|
|
494
|
+
_SQLStatisticsUtils.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, null, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
505
495
|
summaryMethod,
|
|
506
496
|
summaryColumn
|
|
507
497
|
});
|
|
508
498
|
} else {
|
|
509
499
|
groupbyColumnCellValueKey.forEach(n => {
|
|
510
500
|
let pivotRowIndex = pivot_rows.findIndex(r => n === r.name);
|
|
511
|
-
|
|
501
|
+
_SQLStatisticsUtils.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, n, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
512
502
|
summaryMethod,
|
|
513
503
|
summaryColumn
|
|
514
504
|
});
|
|
@@ -519,14 +509,14 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
519
509
|
let resName = r.name;
|
|
520
510
|
return resName === null && groupbyColumnCellValueKey === null || resName === undefined && groupbyColumnCellValueKey === undefined || resName === 0 && groupbyColumnCellValueKey === 0 || resName === groupbyColumnCellValueKey;
|
|
521
511
|
});
|
|
522
|
-
|
|
512
|
+
_SQLStatisticsUtils.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, groupbyColumnCellValueKey, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
523
513
|
summaryMethod,
|
|
524
514
|
summaryColumn
|
|
525
515
|
});
|
|
526
516
|
}
|
|
527
517
|
}
|
|
528
518
|
});
|
|
529
|
-
let pivot_table_total =
|
|
519
|
+
let pivot_table_total = _SQLStatisticsUtils.getAndUpdateTwoDimensionTotal(pivot_columns_total, pivot_columns, pivot_rows, {
|
|
530
520
|
summaryMethod,
|
|
531
521
|
summaryColumn
|
|
532
522
|
});
|
|
@@ -568,7 +558,7 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap
|
|
|
568
558
|
formatted_value = getFormattedValue(cellValue, y_axis_summary_column_key, y_axis_summary_method);
|
|
569
559
|
}
|
|
570
560
|
if (BaseUtils.isValidCellValue(cellValue)) {
|
|
571
|
-
const key =
|
|
561
|
+
const key = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
572
562
|
if (isGroupbyColumnDataAsAnArray) {
|
|
573
563
|
if (!Array.isArray(key) || key.length === 0) {
|
|
574
564
|
let itemIdx = result.findIndex(v => v.name === null);
|
|
@@ -682,7 +672,7 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMa
|
|
|
682
672
|
let result = [];
|
|
683
673
|
sqlRows.forEach(row => {
|
|
684
674
|
const cellValue = row[sqlGroupbyColumnKey];
|
|
685
|
-
const label =
|
|
675
|
+
const label = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
686
676
|
const isEmpty = !label;
|
|
687
677
|
const groupItems = [];
|
|
688
678
|
summaryMethods.forEach((summaryMethod, index) => {
|
|
@@ -732,7 +722,7 @@ SQLStatisticsUtils.compareSQLResult2Javascript = (chart, sqlRows, chartSQLMap, c
|
|
|
732
722
|
const isAdvanced = y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED;
|
|
733
723
|
sqlRows.forEach(item => {
|
|
734
724
|
const name = item[sqlGroupbyColumnKey];
|
|
735
|
-
const label =
|
|
725
|
+
const label = _SQLStatisticsUtils.getGroupLabelFromDB(name, groupbyColumn, tables);
|
|
736
726
|
const value = item[sqlSummaryColumnKey];
|
|
737
727
|
if (name >= x_axis_date_range_start && name <= x_axis_date_range_end) {
|
|
738
728
|
const currentValue = dateRangeResult.get(label);
|
|
@@ -856,7 +846,7 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
856
846
|
sqlRows.forEach(row => {
|
|
857
847
|
const cellValue = row[sqlGroupbyColumnKey];
|
|
858
848
|
const summaryValue = row[sqlSummaryColumnKey];
|
|
859
|
-
const key =
|
|
849
|
+
const key = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
860
850
|
let valueLeft = row[sqlLeftSummaryColumnKey] || 0;
|
|
861
851
|
let valueRight = row[sqlRightSummaryColumnKey] || 0;
|
|
862
852
|
if (y_axis_left_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
@@ -943,7 +933,7 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
943
933
|
});
|
|
944
934
|
sqlRows.forEach((item, index) => {
|
|
945
935
|
const cellValue = item[sqlGroupbyColumnKey];
|
|
946
|
-
const key =
|
|
936
|
+
const key = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, tables);
|
|
947
937
|
let valueRight = item[sqlRightSummaryColumnKey] || 0;
|
|
948
938
|
if (y_axis_right_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
949
939
|
valueRight = BaseUtils.getPrecisionNumber(valueRight, rightSummaryColumn.data);
|
|
@@ -1016,15 +1006,15 @@ SQLStatisticsUtils.updateGroupingChartRow = (results, name, groupName, row, coun
|
|
|
1016
1006
|
SQLStatisticsUtils.updateGroupingChartRows = (results, name, row, count, isColumnGroupbyColumnDataAsAnArray, groupName) => {
|
|
1017
1007
|
if (isColumnGroupbyColumnDataAsAnArray) {
|
|
1018
1008
|
if (!Array.isArray(groupName) || groupName.length === 0) {
|
|
1019
|
-
|
|
1009
|
+
_SQLStatisticsUtils.updateGroupingChartRow(results, name, null, row, count);
|
|
1020
1010
|
return;
|
|
1021
1011
|
}
|
|
1022
1012
|
groupName.forEach(v => {
|
|
1023
|
-
|
|
1013
|
+
_SQLStatisticsUtils.updateGroupingChartRow(results, name, v, row, count);
|
|
1024
1014
|
});
|
|
1025
1015
|
return;
|
|
1026
1016
|
}
|
|
1027
|
-
|
|
1017
|
+
_SQLStatisticsUtils.updateGroupingChartRow(results, name, groupName, row, count);
|
|
1028
1018
|
};
|
|
1029
1019
|
SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1030
1020
|
const {
|
|
@@ -1044,21 +1034,21 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = (chart, sqlRo
|
|
|
1044
1034
|
const isColumnGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
1045
1035
|
sqlRows.forEach(row => {
|
|
1046
1036
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
1047
|
-
const groupbyColumnCellValueKey =
|
|
1037
|
+
const groupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, tables);
|
|
1048
1038
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValueKey, includeEmpty)) {
|
|
1049
1039
|
const columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
1050
|
-
const columnGroupbyColumnCellValueKey =
|
|
1040
|
+
const columnGroupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, tables);
|
|
1051
1041
|
const count = row[sqlSummaryColumnKey];
|
|
1052
1042
|
if (isGroupbyColumnDataAsAnArray) {
|
|
1053
1043
|
if (!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) {
|
|
1054
|
-
|
|
1044
|
+
_SQLStatisticsUtils.updateGroupingChartRows(result, null, row, count, isColumnGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey);
|
|
1055
1045
|
} else {
|
|
1056
1046
|
groupbyColumnCellValueKey.forEach(n => {
|
|
1057
|
-
|
|
1047
|
+
_SQLStatisticsUtils.updateGroupingChartRows(result, n, row, count, isColumnGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey);
|
|
1058
1048
|
});
|
|
1059
1049
|
}
|
|
1060
1050
|
} else {
|
|
1061
|
-
|
|
1051
|
+
_SQLStatisticsUtils.updateGroupingChartRows(result, groupbyColumnCellValueKey, row, count, isColumnGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey);
|
|
1062
1052
|
}
|
|
1063
1053
|
}
|
|
1064
1054
|
});
|
|
@@ -1075,15 +1065,15 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1075
1065
|
x_axis_include_empty_cells: includeEmpty
|
|
1076
1066
|
} = chart.config;
|
|
1077
1067
|
if (!column_groupby_column_key && !column_groupby_multiple_numeric_column) {
|
|
1078
|
-
return
|
|
1068
|
+
return _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1079
1069
|
}
|
|
1080
1070
|
const {
|
|
1081
1071
|
groupbyColumn,
|
|
1082
1072
|
columnGroupbyColumn
|
|
1083
1073
|
} = columnMap;
|
|
1084
1074
|
if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
1085
|
-
if (!columnGroupbyColumn) return
|
|
1086
|
-
return
|
|
1075
|
+
if (!columnGroupbyColumn) return _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1076
|
+
return _SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1087
1077
|
}
|
|
1088
1078
|
const {
|
|
1089
1079
|
sqlGroupbyColumnKey
|
|
@@ -1096,7 +1086,7 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1096
1086
|
const isGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[groupbyColumn.type];
|
|
1097
1087
|
sqlRows.forEach(row => {
|
|
1098
1088
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
1099
|
-
const groupbyColumnCellValueKey =
|
|
1089
|
+
const groupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, tables);
|
|
1100
1090
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValueKey, includeEmpty)) {
|
|
1101
1091
|
Object.keys(summaryColumns).forEach(sqlSummaryColumnName => {
|
|
1102
1092
|
const {
|
|
@@ -1106,14 +1096,14 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1106
1096
|
const numberColumnCellValue = row[sqlSummaryColumnKey];
|
|
1107
1097
|
if (isGroupbyColumnDataAsAnArray) {
|
|
1108
1098
|
if (!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) {
|
|
1109
|
-
|
|
1099
|
+
_SQLStatisticsUtils.updateGroupingChartRows(result, null, row, numberColumnCellValue, false, columnName);
|
|
1110
1100
|
} else {
|
|
1111
1101
|
groupbyColumnCellValueKey.forEach(n => {
|
|
1112
|
-
|
|
1102
|
+
_SQLStatisticsUtils.updateGroupingChartRows(result, n, row, numberColumnCellValue, false, columnName);
|
|
1113
1103
|
});
|
|
1114
1104
|
}
|
|
1115
1105
|
} else {
|
|
1116
|
-
|
|
1106
|
+
_SQLStatisticsUtils.updateGroupingChartRows(result, groupbyColumnCellValueKey, row, numberColumnCellValue, false, columnName);
|
|
1117
1107
|
}
|
|
1118
1108
|
});
|
|
1119
1109
|
}
|
|
@@ -1123,9 +1113,9 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1123
1113
|
return result;
|
|
1124
1114
|
}
|
|
1125
1115
|
if (!columnGroupbyColumn) {
|
|
1126
|
-
return
|
|
1116
|
+
return _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1127
1117
|
}
|
|
1128
|
-
return
|
|
1118
|
+
return _SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1129
1119
|
};
|
|
1130
1120
|
SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1131
1121
|
const {
|
|
@@ -1197,12 +1187,12 @@ SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQ
|
|
|
1197
1187
|
} = chartSQLMap;
|
|
1198
1188
|
const isAdvanced = summary_type === CHART_SUMMARY_TYPE.ADVANCED;
|
|
1199
1189
|
const newResult = [];
|
|
1200
|
-
const groupData =
|
|
1190
|
+
const groupData = _SQLStatisticsUtils.getGroupData(sqlRows, columnGroupbyColumn);
|
|
1201
1191
|
if (groupData.length > 0) {
|
|
1202
1192
|
const groupData0 = groupData[0] || {};
|
|
1203
1193
|
const groupData1 = groupData[1] || {};
|
|
1204
1194
|
sqlRows.forEach(item => {
|
|
1205
|
-
const label =
|
|
1195
|
+
const label = _SQLStatisticsUtils.getGroupLabelFromDB(item[column_key], groupbyColumn, tables);
|
|
1206
1196
|
const groupValue = item[group_column_key];
|
|
1207
1197
|
const equal2GroupData0 = groupData0.id === groupValue;
|
|
1208
1198
|
const equal2GroupData1 = groupData1.id === groupValue;
|
|
@@ -1297,11 +1287,11 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1297
1287
|
} = chart.config;
|
|
1298
1288
|
if (!column_groupby_column_key) {
|
|
1299
1289
|
return {
|
|
1300
|
-
result:
|
|
1290
|
+
result: _SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1301
1291
|
};
|
|
1302
1292
|
}
|
|
1303
1293
|
return {
|
|
1304
|
-
result:
|
|
1294
|
+
result: _SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1305
1295
|
};
|
|
1306
1296
|
}
|
|
1307
1297
|
case CHART_TYPE.PIE:
|
|
@@ -1309,19 +1299,19 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1309
1299
|
case CHART_TYPE.TREE_MAP:
|
|
1310
1300
|
{
|
|
1311
1301
|
return {
|
|
1312
|
-
result:
|
|
1302
|
+
result: _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1313
1303
|
};
|
|
1314
1304
|
}
|
|
1315
1305
|
case CHART_TYPE.BASIC_NUMBER_CARD:
|
|
1316
1306
|
{
|
|
1317
1307
|
return {
|
|
1318
|
-
result:
|
|
1308
|
+
result: _SQLStatisticsUtils.basicNumberCardSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1319
1309
|
};
|
|
1320
1310
|
}
|
|
1321
1311
|
case CHART_TYPE.DASHBOARD:
|
|
1322
1312
|
{
|
|
1323
1313
|
return {
|
|
1324
|
-
result:
|
|
1314
|
+
result: _SQLStatisticsUtils.dashboardSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1325
1315
|
};
|
|
1326
1316
|
}
|
|
1327
1317
|
case CHART_TYPE.BAR:
|
|
@@ -1330,13 +1320,13 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1330
1320
|
case CHART_TYPE.AREA:
|
|
1331
1321
|
{
|
|
1332
1322
|
return {
|
|
1333
|
-
result:
|
|
1323
|
+
result: _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1334
1324
|
};
|
|
1335
1325
|
}
|
|
1336
1326
|
case CHART_TYPE.COMPLETENESS:
|
|
1337
1327
|
case CHART_TYPE.COMPLETENESS_GROUP:
|
|
1338
1328
|
{
|
|
1339
|
-
const result =
|
|
1329
|
+
const result = _SQLStatisticsUtils.completenessSQlResult(chart, sqlRows, chartSQLMap, tables);
|
|
1340
1330
|
return {
|
|
1341
1331
|
result
|
|
1342
1332
|
};
|
|
@@ -1344,13 +1334,13 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1344
1334
|
case CHART_TYPE.COMBINATION:
|
|
1345
1335
|
{
|
|
1346
1336
|
return {
|
|
1347
|
-
result:
|
|
1337
|
+
result: _SQLStatisticsUtils.combinationSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1348
1338
|
};
|
|
1349
1339
|
}
|
|
1350
1340
|
case CHART_TYPE.COMPARE_BAR:
|
|
1351
1341
|
{
|
|
1352
1342
|
return {
|
|
1353
|
-
result:
|
|
1343
|
+
result: _SQLStatisticsUtils.compareSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1354
1344
|
};
|
|
1355
1345
|
}
|
|
1356
1346
|
case CHART_TYPE.BAR_GROUP:
|
|
@@ -1361,51 +1351,51 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1361
1351
|
case CHART_TYPE.STACKED_HORIZONTAL_BAR:
|
|
1362
1352
|
{
|
|
1363
1353
|
return {
|
|
1364
|
-
result:
|
|
1354
|
+
result: _SQLStatisticsUtils.groupingChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1365
1355
|
};
|
|
1366
1356
|
}
|
|
1367
1357
|
case CHART_TYPE.SCATTER:
|
|
1368
1358
|
{
|
|
1369
1359
|
return {
|
|
1370
|
-
result:
|
|
1360
|
+
result: _SQLStatisticsUtils.scatterSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1371
1361
|
};
|
|
1372
1362
|
}
|
|
1373
1363
|
case CHART_TYPE.BAR_CUSTOM:
|
|
1374
1364
|
{
|
|
1375
1365
|
return {
|
|
1376
|
-
result:
|
|
1366
|
+
result: _SQLStatisticsUtils.customChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables, params)
|
|
1377
1367
|
};
|
|
1378
1368
|
}
|
|
1379
1369
|
case CHART_TYPE.MAP:
|
|
1380
1370
|
case CHART_TYPE.MAP_BUBBLE:
|
|
1381
1371
|
{
|
|
1382
1372
|
return {
|
|
1383
|
-
result:
|
|
1373
|
+
result: _SQLStatisticsUtils.mapSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1384
1374
|
};
|
|
1385
1375
|
}
|
|
1386
1376
|
case CHART_TYPE.WORLD_MAP:
|
|
1387
1377
|
case CHART_TYPE.WORLD_MAP_BUBBLE:
|
|
1388
1378
|
{
|
|
1389
1379
|
return {
|
|
1390
|
-
result:
|
|
1380
|
+
result: _SQLStatisticsUtils.worldMapSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1391
1381
|
};
|
|
1392
1382
|
}
|
|
1393
1383
|
case CHART_TYPE.HEAT_MAP:
|
|
1394
1384
|
{
|
|
1395
1385
|
return {
|
|
1396
|
-
result:
|
|
1386
|
+
result: _SQLStatisticsUtils.heatMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1397
1387
|
};
|
|
1398
1388
|
}
|
|
1399
1389
|
case CHART_TYPE.MIRROR:
|
|
1400
1390
|
{
|
|
1401
1391
|
return {
|
|
1402
|
-
result:
|
|
1392
|
+
result: _SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1403
1393
|
};
|
|
1404
1394
|
}
|
|
1405
1395
|
case CHART_TYPE.TREND:
|
|
1406
1396
|
{
|
|
1407
1397
|
return {
|
|
1408
|
-
result:
|
|
1398
|
+
result: _SQLStatisticsUtils.trendMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1409
1399
|
};
|
|
1410
1400
|
}
|
|
1411
1401
|
default:
|
|
@@ -1414,6 +1404,13 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1414
1404
|
}
|
|
1415
1405
|
}
|
|
1416
1406
|
};
|
|
1407
|
+
SQLStatisticsUtils._get_completeness_name = (row, column) => {
|
|
1408
|
+
let value = row[column.key];
|
|
1409
|
+
if (Array.isArray(value)) {
|
|
1410
|
+
value = value.join('、');
|
|
1411
|
+
}
|
|
1412
|
+
return value;
|
|
1413
|
+
};
|
|
1417
1414
|
SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables) => {
|
|
1418
1415
|
const {
|
|
1419
1416
|
config: {
|
|
@@ -1439,7 +1436,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1439
1436
|
let summedSqlRows;
|
|
1440
1437
|
if (!isGroup) {
|
|
1441
1438
|
const sumSqlRows = sqlRows.reduce((acc, row) => {
|
|
1442
|
-
const nameValue =
|
|
1439
|
+
const nameValue = _SQLStatisticsUtils._get_completeness_name(row, name_column);
|
|
1443
1440
|
if (!acc[nameValue]) {
|
|
1444
1441
|
acc[nameValue] = row;
|
|
1445
1442
|
} else {
|
|
@@ -1454,7 +1451,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1454
1451
|
summedSqlRows = Object.values(sumSqlRows);
|
|
1455
1452
|
} else {
|
|
1456
1453
|
const sumSqlRowsWithGroupBy = sqlRows.reduce((acc, row) => {
|
|
1457
|
-
const nameValue =
|
|
1454
|
+
const nameValue = _SQLStatisticsUtils._get_completeness_name(row, name_column);
|
|
1458
1455
|
const groupby = row[sqlColumnGroupByColumnKey];
|
|
1459
1456
|
const key = "".concat(nameValue, "_").concat(groupby);
|
|
1460
1457
|
if (!acc[key]) {
|
|
@@ -1472,7 +1469,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1472
1469
|
summedSqlRows = Object.values(sumSqlRowsWithGroupBy);
|
|
1473
1470
|
}
|
|
1474
1471
|
summedSqlRows.forEach(row => {
|
|
1475
|
-
const nameValue =
|
|
1472
|
+
const nameValue = _SQLStatisticsUtils._get_completeness_name(row, name_column);
|
|
1476
1473
|
let targetValue;
|
|
1477
1474
|
let completedValue;
|
|
1478
1475
|
let groupby;
|
|
@@ -1481,8 +1478,8 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1481
1478
|
completedValue = row["SUM(".concat(completed_column.name, ")")];
|
|
1482
1479
|
groupby = row[sqlColumnGroupByColumnKey] || intl.get('Empty');
|
|
1483
1480
|
} else {
|
|
1484
|
-
completedValue =
|
|
1485
|
-
targetValue =
|
|
1481
|
+
completedValue = _SQLStatisticsUtils._get_completeness_name(row, completed_column);
|
|
1482
|
+
targetValue = _SQLStatisticsUtils._get_completeness_name(row, target_column);
|
|
1486
1483
|
}
|
|
1487
1484
|
let completedRate;
|
|
1488
1485
|
if (!targetValue && completedValue) {
|
|
@@ -1643,7 +1640,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1643
1640
|
const result = [];
|
|
1644
1641
|
sqlRows.forEach((item, index) => {
|
|
1645
1642
|
if (item.length !== 0) {
|
|
1646
|
-
const chartResult =
|
|
1643
|
+
const chartResult = _SQLStatisticsUtils.sqlResult2JavaScript(newChart, item, chartSQLMap, columnMap, tables, {
|
|
1647
1644
|
index
|
|
1648
1645
|
});
|
|
1649
1646
|
result.push(...chartResult.result);
|
|
@@ -1655,7 +1652,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1655
1652
|
}
|
|
1656
1653
|
callback && callback('', '', {
|
|
1657
1654
|
result,
|
|
1658
|
-
data_sources:
|
|
1655
|
+
data_sources: _SQLStatisticsUtils.dataSources,
|
|
1659
1656
|
groupbyColumn,
|
|
1660
1657
|
columnGroupbyColumn,
|
|
1661
1658
|
summaryColumn,
|
|
@@ -1669,7 +1666,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1669
1666
|
callback && callback('', tipMessage, null);
|
|
1670
1667
|
return;
|
|
1671
1668
|
}
|
|
1672
|
-
const chartResult =
|
|
1669
|
+
const chartResult = _SQLStatisticsUtils.sqlResult2JavaScript(newChart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1673
1670
|
|
|
1674
1671
|
// map is special
|
|
1675
1672
|
if (BaseUtils.imEmptyChartResult(chartResult) && !chartType.includes('map')) {
|
|
@@ -1678,7 +1675,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1678
1675
|
}
|
|
1679
1676
|
callback && callback('', '', {
|
|
1680
1677
|
...chartResult,
|
|
1681
|
-
data_sources:
|
|
1678
|
+
data_sources: _SQLStatisticsUtils.dataSources,
|
|
1682
1679
|
groupbyColumn,
|
|
1683
1680
|
columnGroupbyColumn,
|
|
1684
1681
|
summaryColumn,
|
|
@@ -314,23 +314,22 @@ class ChartDataSQL {
|
|
|
314
314
|
x_axis_date_granularity,
|
|
315
315
|
x_axis_geolocation_granularity,
|
|
316
316
|
y_axis_summary_type,
|
|
317
|
-
|
|
318
|
-
y_axis_summary_method
|
|
319
|
-
x_axis_include_empty_cells
|
|
317
|
+
y_axis_summary_column_key,
|
|
318
|
+
y_axis_summary_method
|
|
320
319
|
} = this.chart;
|
|
321
320
|
const groupby_column = this._get_column_by_key(x_axis_column_key);
|
|
322
321
|
if (!groupby_column) {
|
|
323
322
|
this.error = 'Group_by_column_not_found';
|
|
324
323
|
return '';
|
|
325
324
|
}
|
|
326
|
-
this._update_filter_sql(
|
|
325
|
+
this._update_filter_sql(true, groupby_column);
|
|
327
326
|
const groupby_column_name = this._chart_column_name_to_sql(groupby_column, {
|
|
328
327
|
'date_granularity': x_axis_date_granularity,
|
|
329
328
|
'geolocation_granularity': x_axis_geolocation_granularity
|
|
330
329
|
});
|
|
331
330
|
let summary_column_name = this._summary_column_2_sql('COUNT', groupby_column);
|
|
332
331
|
if (y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
333
|
-
const summary_column = this._get_column_by_key(
|
|
332
|
+
const summary_column = this._get_column_by_key(y_axis_summary_column_key);
|
|
334
333
|
if (!summary_column) {
|
|
335
334
|
this.error = 'Summary_column_not_found';
|
|
336
335
|
return '';
|
|
@@ -5,11 +5,11 @@ import dayjs from 'dayjs';
|
|
|
5
5
|
import weekOfYear from 'dayjs/plugin/weekOfYear';
|
|
6
6
|
import { getTableById, getTableColumnByKey, getNumberDisplayString } from 'dtable-utils';
|
|
7
7
|
import { registerShape, getRectWithCornerRadius } from '../../utils/custom-g2';
|
|
8
|
-
import ChartComponent from './chart-component';
|
|
9
8
|
import intl from '../../intl';
|
|
10
9
|
import { BaseUtils } from '../../utils';
|
|
11
10
|
import { CHART_SUMMARY_TYPE, TITLE_AMOUNT, DEFAULT_GRID_SIZE, DEFAULT_GRID_DISTANCE, DEFAULT_NUMBER_FORMAT_OBJECT, MONTH_MIRROR } from '../../constants';
|
|
12
11
|
import { FILL_BORDER_COLOR_MAP, COLOR_OPTIONS } from '../../constants/style';
|
|
12
|
+
import ChartComponent from './chart-component';
|
|
13
13
|
dayjs.extend(weekOfYear);
|
|
14
14
|
class HeatMap extends ChartComponent {
|
|
15
15
|
constructor(props) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
-
import ChartComponent from './chart-component';
|
|
3
2
|
import { CHART_SUMMARY_TYPE, LABEL_POSITION_TYPE } from '../../constants';
|
|
4
3
|
import intl from '../../intl';
|
|
4
|
+
import ChartComponent from './chart-component';
|
|
5
5
|
export default class HorizontalComponent extends ChartComponent {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
5
4
|
import { BaseUtils, isFunction } from '../../utils';
|
|
6
5
|
import intl from '../../intl';
|
|
7
6
|
import { CHART_LINE_TYPES, CHART_SUMMARY_SHOW, CHART_SUMMARY_TYPE } from '../../constants';
|
|
@@ -55,7 +54,6 @@ class Line extends ChartComponent {
|
|
|
55
54
|
y_axis_show_value,
|
|
56
55
|
label_font_size,
|
|
57
56
|
line_type,
|
|
58
|
-
y_axis_column_key,
|
|
59
57
|
y_axis_summary_type,
|
|
60
58
|
y_axis_summary_method
|
|
61
59
|
} = chart.config;
|
|
@@ -6,8 +6,8 @@ import { getEllipsisText } from '@antv/g2/esm/util/text';
|
|
|
6
6
|
import { CHART_SUMMARY_TYPE, EMPTY_NAME } from '../../constants';
|
|
7
7
|
import { BaseUtils, isFunction } from '../../utils';
|
|
8
8
|
import { registerGeometryLabelLayout } from '../../utils/custom-g2';
|
|
9
|
-
import ChartComponent from './chart-component';
|
|
10
9
|
import intl from '../../intl';
|
|
10
|
+
import ChartComponent from './chart-component';
|
|
11
11
|
class Treemap extends ChartComponent {
|
|
12
12
|
constructor(props) {
|
|
13
13
|
super(props);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sea-chart",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33-beta",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@antv/data-set": "0.11.8",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@antv/scale": "0.3.14",
|
|
24
24
|
"babel-plugin-on-demand-loading": "^0.0.9",
|
|
25
|
-
"dtable-ui-component": "~4.4.
|
|
25
|
+
"dtable-ui-component": "~4.4.33",
|
|
26
26
|
"dtable-utils": "~4.4.*",
|
|
27
27
|
"prop-types": "15.8.1",
|
|
28
28
|
"react": "^17.0.0",
|