sea-chart 2.0.42 → 2.0.44

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.
Files changed (60) hide show
  1. package/dist/components/color-popover/color-rules/rule-filters/number-input.js +2 -2
  2. package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +2 -2
  3. package/dist/components/tooltip/index.js +11 -4
  4. package/dist/constants/index.js +8 -3
  5. package/dist/context.js +10 -7
  6. package/dist/model/base-model.js +4 -0
  7. package/dist/model/combination.js +4 -0
  8. package/dist/model/horizontal-bar.js +4 -0
  9. package/dist/model/horizontal-group-bar.js +5 -1
  10. package/dist/model/stacked-horizontal-bar.js +4 -0
  11. package/dist/settings/advance-bar-settings/style-settings.js +24 -7
  12. package/dist/settings/bar-settings/style-settings.js +24 -7
  13. package/dist/settings/combination-settings/style-settings.js +35 -10
  14. package/dist/settings/time-comparison-settings/style-settings.js +24 -7
  15. package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
  16. package/dist/utils/cell-format-utils.js +2 -2
  17. package/dist/utils/chart-utils/base-utils.js +49 -13
  18. package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +4 -3
  19. package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +3 -3
  20. package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +2 -2
  21. package/dist/utils/chart-utils/sql-statistics-utils.js +64 -18
  22. package/dist/utils/row-record-utils.js +21 -5
  23. package/dist/utils/sql/column-2-sql-column.js +2 -0
  24. package/dist/view/index.css +0 -17
  25. package/dist/view/wrapper/area-group.js +14 -25
  26. package/dist/view/wrapper/area.js +14 -27
  27. package/dist/view/wrapper/bar-compare.js +10 -15
  28. package/dist/view/wrapper/bar-custom-stack.js +19 -81
  29. package/dist/view/wrapper/bar-group.js +15 -50
  30. package/dist/view/wrapper/bar-stack.js +12 -40
  31. package/dist/view/wrapper/bar.js +10 -23
  32. package/dist/view/wrapper/basic-number-card.js +9 -2
  33. package/dist/view/wrapper/chart-component.js +461 -76
  34. package/dist/view/wrapper/combination.js +17 -29
  35. package/dist/view/wrapper/completeness-group.js +13 -59
  36. package/dist/view/wrapper/completeness.js +14 -60
  37. package/dist/view/wrapper/dashboard.js +8 -14
  38. package/dist/view/wrapper/funnel.js +6 -18
  39. package/dist/view/wrapper/heat-map.js +80 -50
  40. package/dist/view/wrapper/horizontal-bar-group.js +14 -25
  41. package/dist/view/wrapper/horizontal-bar-stack.js +16 -61
  42. package/dist/view/wrapper/horizontal-bar.js +10 -25
  43. package/dist/view/wrapper/index.js +3 -0
  44. package/dist/view/wrapper/line-group.js +11 -21
  45. package/dist/view/wrapper/line.js +11 -23
  46. package/dist/view/wrapper/map-bubble.js +9 -14
  47. package/dist/view/wrapper/map-world-bubble.js +9 -14
  48. package/dist/view/wrapper/map-world.js +9 -14
  49. package/dist/view/wrapper/map.js +9 -13
  50. package/dist/view/wrapper/mirror.js +7 -20
  51. package/dist/view/wrapper/pie.js +9 -12
  52. package/dist/view/wrapper/ring.js +10 -13
  53. package/dist/view/wrapper/scatter.js +13 -23
  54. package/dist/view/wrapper/table/pivot-table-display-name.js +2 -2
  55. package/dist/view/wrapper/table-element/components/formatter.js +2 -2
  56. package/dist/view/wrapper/table-element/components/records-body.js +8 -2
  57. package/dist/view/wrapper/table-element/components/records.js +2 -4
  58. package/dist/view/wrapper/treemap.js +8 -18
  59. package/dist/view/wrapper/trend.js +3 -2
  60. package/package.json +2 -2
@@ -2,8 +2,8 @@ var _BaseUtils;
2
2
  import shallowEqual from 'shallowequal';
3
3
  import dayjs from 'dayjs';
4
4
  import slugid from 'slugid';
5
- 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, isArchiveView, getViewById, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP } from 'dtable-utils';
6
- import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES, CHART_STYLE_CONFIG_SETTING_KEYS, MAP_CHART_TYPES } from '../../constants';
5
+ import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, getDateDisplayString, getNumberDisplayString, getOption, getMultipleOptionName, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, isEmpty, isNumericColumn, isDateColumn, sortText, sortNumber, sortDate, sortSingleSelect, sortFormula, getColumnOptions, DateUtils, getGeolocationDisplayString, getFormulaDisplayString, isArchiveView, getViewById, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP } from 'dtable-utils';
6
+ import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES, CHART_STYLE_CONFIG_SETTING_KEYS, MAP_CHART_TYPES, DEFAULT_ITEM_COLOR } from '../../constants';
7
7
  import { getClientFormulaDisplayString } from '../cell-format-utils';
8
8
  import { getKnownCollaboratorByEmail, generateDefaultUser } from '../collaborator-utils';
9
9
  import { getDateColumnFormat, getColumnByKey } from '../column-utils';
@@ -625,7 +625,7 @@ BaseUtils.getPieColor = (column, index, data, currentTheme, useColumnColor) => {
625
625
  const selectedItem = columnData.options.find(item => {
626
626
  return item.name === data.name.trim();
627
627
  }) || {};
628
- return selectedItem.color || '#dbdbdb';
628
+ return selectedItem.color || DEFAULT_ITEM_COLOR;
629
629
  }
630
630
  } else {
631
631
  const pieChartColorsLength = colors.length - 1;
@@ -678,11 +678,11 @@ BaseUtils.formatPieChartData = (data, chart, tables, currentTheme, useColumnColo
678
678
  filteredData.push({
679
679
  name: '_Others',
680
680
  value: filteredSum,
681
- color: '#dbdbdb',
681
+ color: DEFAULT_ITEM_COLOR,
682
682
  percent: String(Number.parseFloat(filteredSum / sum * 100).toFixed(1)) + '%',
683
683
  rows
684
684
  });
685
- colorMap['_Others'] = '#dbdbdb';
685
+ colorMap['_Others'] = DEFAULT_ITEM_COLOR;
686
686
  }
687
687
  return {
688
688
  data: filteredData,
@@ -700,7 +700,12 @@ BaseUtils.updateTableViewListItemNameAndColor = async (result, column, nameKey,
700
700
  data: columnData
701
701
  } = column;
702
702
  let name = result[nameKey];
703
- if (columnType === CellType.SINGLE_SELECT || columnType === CellType.MULTIPLE_SELECT) {
703
+ if (isEmpty(name)) {
704
+ result[colorKey] = result[colorKey] || DEFAULT_ITEM_COLOR;
705
+ resolve(resultPromise);
706
+ return;
707
+ }
708
+ if (columnType === CellType.SINGLE_SELECT) {
704
709
  const options = getColumnOptions(column);
705
710
  let selectedOption = getOption(options, name);
706
711
  let {
@@ -713,7 +718,19 @@ BaseUtils.updateTableViewListItemNameAndColor = async (result, column, nameKey,
713
718
  result[colorKey] = optionColor;
714
719
  isNameField && (result.original_name = id);
715
720
  } else {
716
- result[colorKey] = '#dbdbdb';
721
+ result[colorKey] = DEFAULT_ITEM_COLOR;
722
+ }
723
+ } else if (columnType === CellType.MULTIPLE_SELECT) {
724
+ const options = getColumnOptions(column);
725
+ const optionIds = Array.isArray(name) ? name : [name];
726
+ const optionNames = getMultipleOptionName(options, optionIds);
727
+ if (optionNames) {
728
+ result[nameKey] = optionNames;
729
+ const firstOption = options.find(o => optionIds.includes(o.id));
730
+ result[colorKey] = (firstOption === null || firstOption === void 0 ? void 0 : firstOption.color) || DEFAULT_ITEM_COLOR;
731
+ isNameField && (result.original_name = optionIds);
732
+ } else {
733
+ result[colorKey] = DEFAULT_ITEM_COLOR;
717
734
  }
718
735
  } else if (columnType === CellType.COLLABORATOR) {
719
736
  const users = context.getCollaboratorsFromCache();
@@ -954,8 +971,8 @@ BaseUtils.sortChartData = (charts, sort_key) => {
954
971
  const {
955
972
  value: next
956
973
  } = nextResult;
957
- if (!current && current !== 0) return -1;
958
- if (!next && next !== 0) return 1;
974
+ if (isEmpty(current)) return -1;
975
+ if (isEmpty(next)) return 1;
959
976
  if (sort_key === 'ascending') {
960
977
  return current > next ? 1 : -1;
961
978
  }
@@ -1035,14 +1052,25 @@ BaseUtils.convertResultName = (result, column, name, nameKey, colorKey) => {
1035
1052
  type: columnType,
1036
1053
  data: columnData
1037
1054
  } = column;
1038
- if (columnType === CellType.SINGLE_SELECT || columnType === CellType.MULTIPLE_SELECT) {
1055
+ if (columnType === CellType.SINGLE_SELECT) {
1039
1056
  const options = getColumnOptions(column);
1040
1057
  const selectedOption = getOption(options, name);
1041
1058
  if (selectedOption) {
1042
1059
  result[nameKey] = selectedOption.name;
1043
1060
  result[colorKey] = selectedOption.color;
1044
1061
  } else {
1045
- result[colorKey] = '#dbdbdb';
1062
+ result[colorKey] = DEFAULT_ITEM_COLOR;
1063
+ }
1064
+ } else if (columnType === CellType.MULTIPLE_SELECT) {
1065
+ const options = getColumnOptions(column);
1066
+ const optionIds = Array.isArray(name) ? name : [name];
1067
+ const optionNames = getMultipleOptionName(options, optionIds);
1068
+ if (optionNames) {
1069
+ result[nameKey] = optionNames;
1070
+ const firstOption = options.find(o => optionIds.includes(o.id));
1071
+ result[colorKey] = (firstOption === null || firstOption === void 0 ? void 0 : firstOption.color) || DEFAULT_ITEM_COLOR;
1072
+ } else {
1073
+ result[colorKey] = DEFAULT_ITEM_COLOR;
1046
1074
  }
1047
1075
  } else if (columnType === CellType.COLLABORATOR) {
1048
1076
  let collaborator = getKnownCollaboratorByEmail(name);
@@ -1183,7 +1211,11 @@ BaseUtils.convertConfig = config => {
1183
1211
  vertical_axis_label_position,
1184
1212
  show_horizontal_axis_label,
1185
1213
  horizontal_axis_label_position,
1186
- horizontal_axis_label_color
1214
+ horizontal_axis_label_color,
1215
+ vertical_axis_label_font_size,
1216
+ vertical_axis_label_font_color,
1217
+ horizontal_axis_label_font_size,
1218
+ horizontal_axis_label_font_color
1187
1219
  } = config;
1188
1220
  const newConfig = {
1189
1221
  x_axis_column_key: vertical_axis_column_key,
@@ -1195,8 +1227,12 @@ BaseUtils.convertConfig = config => {
1195
1227
  y_axis_summary_column_key: horizontal_axis_column_key,
1196
1228
  x_axis_show_label: show_vertical_axis_label,
1197
1229
  x_axis_label_position: vertical_axis_label_position,
1230
+ x_axis_label_font_size: vertical_axis_label_font_size,
1231
+ x_axis_label_font_color: vertical_axis_label_font_color,
1198
1232
  y_axis_show_label: show_horizontal_axis_label,
1199
1233
  y_axis_label_position: horizontal_axis_label_position,
1234
+ y_axis_label_font_size: horizontal_axis_label_font_size,
1235
+ y_axis_label_font_color: horizontal_axis_label_font_color,
1200
1236
  y_axis_label_color: horizontal_axis_label_color,
1201
1237
  y_axis_auto_range: config.horizontal_axis_auto_range,
1202
1238
  y_axis_max: config.horizontal_axis_max,
@@ -1432,7 +1468,7 @@ BaseUtils.getTotal = function (summary_column_key, summary_column_type, summary_
1432
1468
  currentValue = current[summary_column_key];
1433
1469
  nextValue = next[summary_column_key];
1434
1470
  }
1435
- if (!nextValue && nextValue !== 0) {
1471
+ if (isEmpty(nextValue)) {
1436
1472
  return current;
1437
1473
  }
1438
1474
  let isNextGreater = currentValue < nextValue;
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
- import { CellType, DATE_COLUMN_OPTIONS, FORMULA_COLUMN_TYPES_MAP, getTableById, getViewById, getTableColumnByKey } from 'dtable-utils';
2
+ import { CellType, DATE_COLUMN_OPTIONS, FORMULA_COLUMN_TYPES_MAP, getTableById, getViewById, getTableColumnByKey, isEmpty } from 'dtable-utils';
3
3
  import { CHART_STYLE_COLORS, CHART_SUMMARY_TYPE, CHART_TYPE, Y_AXIS_TYPE_PREFIX } from '../../../constants';
4
4
  import { getColorFromSingleSelectColumn, isDateFormulaColumn } from '../../column-utils';
5
5
  import { isArrayCellValue } from '../../cell-value-utils';
@@ -103,7 +103,7 @@ async function calculateBasicChart(chart, value, _ref) {
103
103
  ...item,
104
104
  year
105
105
  });
106
- if (years.indexOf(year) < 0) {
106
+ if (!isNaN(year) && years.indexOf(year) < 0) {
107
107
  years.push(year);
108
108
  }
109
109
  });
@@ -112,6 +112,7 @@ async function calculateBasicChart(chart, value, _ref) {
112
112
  if (current.year < next.year) return 1;
113
113
  return 0;
114
114
  });
115
+ years.sort((current, next) => next - current);
115
116
  return {
116
117
  data,
117
118
  years
@@ -244,7 +245,7 @@ function groupChartRows(results, name, row, isColumnGroupbyColumnDataAsAnArray,
244
245
  });
245
246
  }
246
247
  } else {
247
- if (!groupName && groupName !== 0 && !include_empty) {
248
+ if (isEmpty(groupName) && !include_empty) {
248
249
  return;
249
250
  }
250
251
  updateGroupingChartRows(results, name, groupName, row, yAxisType);
@@ -1,4 +1,4 @@
1
- import { isNumber, getTableById, getViewById, getTableColumnByKey } from 'dtable-utils';
1
+ import { isNumber, getTableById, getViewById, getTableColumnByKey, isEmpty } from 'dtable-utils';
2
2
  import { getClientCellValueDisplayString } from '../../cell-format-utils';
3
3
  import BaseUtils from '../base-utils';
4
4
  import { getCellValue } from '../../row-utils';
@@ -88,7 +88,7 @@ async function calculator(chart, dtableValue, _ref) {
88
88
  data: columnItem.data,
89
89
  formulaRows
90
90
  });
91
- if (!value && value !== 0 || value.length === 0) value = null;
91
+ if (isEmpty(value) || value.length === 0) value = null;
92
92
  const groupValue = row[groupColumn.key];
93
93
  if (groupItems.includes(groupValue)) {
94
94
  const count = result[groupItem][value];
@@ -114,7 +114,7 @@ async function calculator(chart, dtableValue, _ref) {
114
114
  data: columnItem.data,
115
115
  formulaRows
116
116
  });
117
- if (!value && value !== 0 || value.length === 0) value = null;
117
+ if (isEmpty(value) || value.length === 0) value = null;
118
118
  const groupValue = row[groupColumn.key];
119
119
  if (groupItems.includes(groupValue)) {
120
120
  const list = result[groupItem][value];
@@ -1,4 +1,4 @@
1
- import { FORMULA_COLUMN_TYPES_MAP, isNumber, isDateColumn, isNumericColumn, getTableById, getViewById, getTableColumnByKey } from 'dtable-utils';
1
+ import { FORMULA_COLUMN_TYPES_MAP, isNumber, isDateColumn, isNumericColumn, getTableById, getViewById, getTableColumnByKey, isEmpty } from 'dtable-utils';
2
2
  import { isObject } from 'lodash';
3
3
  import { CHART_SUMMARY_TYPE, TABLE_DIMENSIONS } from '../../../constants';
4
4
  import { isArrayCellValue } from '../../cell-value-utils';
@@ -752,7 +752,7 @@ function getTotal(summary_column, summary_type, summary_method) {
752
752
  currentValue = current[summary_column_key];
753
753
  nextValue = next[summary_column_key];
754
754
  }
755
- if (!nextValue && nextValue !== 0) {
755
+ if (isEmpty(nextValue)) {
756
756
  return current;
757
757
  }
758
758
  let isNextGreater = currentValue < nextValue;
@@ -1,6 +1,6 @@
1
1
  var _SQLStatisticsUtils;
2
2
  import dayjs from 'dayjs';
3
- import { CellType, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, getFormulaDisplayString, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber } from 'dtable-utils';
3
+ import { CellType, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, getFormulaDisplayString, getGeolocationByGranularity, getGeolocationDisplayString, getPrecisionNumber, getTableById, getTableColumnByKey, GROUP_GEOLOCATION_GRANULARITY, isNumber, isEmpty } from 'dtable-utils';
4
4
  import { isObject } from 'lodash';
5
5
  import { cloneDeep } from 'lodash-es';
6
6
  import { CHART_SUMMARY_TYPE, CHART_TYPE, SUPPORT_DATA_SORT_CHART_TYPES, TABLE_DIMENSIONS, Y_AXIS_TYPE_PREFIX, STYLE_COLORS, TREND_TYPES, CHART_STYLE_COLORS, MAP_CHART_TYPES } from '../../constants';
@@ -9,6 +9,7 @@ import { getClientLinkDisplayString } from '../cell-format-utils';
9
9
  import { column2SqlColumn } from '../sql/column-2-sql-column';
10
10
  import { formatNumericValue, getFormattedValue, getSummaryResult } from '../column-utils';
11
11
  import { getCompareDate } from '../trend-utils';
12
+ import { fixGeoGranularity } from '../map';
12
13
  import intl from '../../intl';
13
14
  import { convertQuarterToDate } from '../date-translate';
14
15
  import BaseUtils, { findIfColumnDataIsArray } from './base-utils';
@@ -60,7 +61,8 @@ SQLStatisticsUtils.getGroupLabelFromDB = async (cellValue, column, chart, isPivo
60
61
  }
61
62
  case CellType.GEOLOCATION:
62
63
  {
63
- return cellValue || null;
64
+ if (typeof cellValue === 'string') return cellValue || null;
65
+ return getGeolocationDisplayString(cellValue, data) || null;
64
66
  }
65
67
  case CellType.FORMULA:
66
68
  {
@@ -80,7 +82,7 @@ SQLStatisticsUtils.getGroupLabelFromDB = async (cellValue, column, chart, isPivo
80
82
  return cellValue;
81
83
  }
82
84
  const validValue = getFormulaDisplayString(cellValue, data) || [];
83
- if (!validValue && validValue !== 0) {
85
+ if (isEmpty(validValue)) {
84
86
  return null;
85
87
  }
86
88
  return validValue;
@@ -641,7 +643,6 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = async (chart, sqlRows, chart
641
643
  type,
642
644
  sort_type,
643
645
  y_axis_summary_type,
644
- y_axis_summary_column_key,
645
646
  y_axis_summary_method,
646
647
  x_axis_include_empty_cells,
647
648
  groupby_include_empty_cells
@@ -661,7 +662,7 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = async (chart, sqlRows, chart
661
662
  const summaryValue = row[sqlSummaryColumnKey];
662
663
  let formatted_value = cellValue;
663
664
  if (y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
664
- formatted_value = getFormattedValue(cellValue, y_axis_summary_column_key, y_axis_summary_method);
665
+ formatted_value = getFormattedValue(summaryValue, summaryColumn, y_axis_summary_method);
665
666
  }
666
667
  if (BaseUtils.isValidCellValue(cellValue, x_axis_include_empty_cells || groupby_include_empty_cells)) {
667
668
  const key = await _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
@@ -783,10 +784,10 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = async (chart, sqlRows, char
783
784
  for (const row of sqlRows) {
784
785
  const cellValue = row[sqlGroupbyColumnKey];
785
786
  const label = await _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
786
- const isEmpty = !label;
787
+ const isEmptyLabel = !label;
787
788
  const groupItems = [];
788
789
  summaryMethods.forEach((summaryMethod, index) => {
789
- if (!(x_axis_include_empty_cells || x_axis_include_empty) && isEmpty) return;
790
+ if (!(x_axis_include_empty_cells || x_axis_include_empty) && isEmptyLabel) return;
790
791
  let value = row[summaryMethod] || 0;
791
792
  let formatted_value = value;
792
793
  value = formatNumericValue(value, numericColumns[index]);
@@ -1328,6 +1329,8 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = async (chart,
1328
1329
  // fill empty group name with value 0
1329
1330
  const allGroupNames = new Set();
1330
1331
  const nameGroupMap = new Map();
1332
+ const nameRawValueMap = new Map();
1333
+ const groupNameRawValueMap = new Map();
1331
1334
  result.forEach(item => {
1332
1335
  const {
1333
1336
  name,
@@ -1338,8 +1341,18 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = async (chart,
1338
1341
  nameGroupMap.set(name, new Set());
1339
1342
  }
1340
1343
  nameGroupMap.get(name).add(groupName);
1344
+ if (!nameRawValueMap.has(name)) {
1345
+ var _item$rows$;
1346
+ const rawName = (_item$rows$ = item.rows[0]) === null || _item$rows$ === void 0 ? void 0 : _item$rows$[sqlGroupbyColumnKey];
1347
+ nameRawValueMap.set(name, isGroupbyColumnDataAsAnArray ? name : rawName !== null && rawName !== void 0 ? rawName : name);
1348
+ }
1349
+ if (groupName && !groupNameRawValueMap.has(groupName)) {
1350
+ var _item$rows$2;
1351
+ const rawGroupName = (_item$rows$2 = item.rows[0]) === null || _item$rows$2 === void 0 ? void 0 : _item$rows$2[sqlColumnGroupbyColumnKey];
1352
+ groupNameRawValueMap.set(groupName, isColumnGroupbyColumnDataAsAnArray ? groupName : rawGroupName !== null && rawGroupName !== void 0 ? rawGroupName : groupName);
1353
+ }
1341
1354
  });
1342
- const isEmptyGroupName = groupName => groupName === undefined || groupName === null || groupName === '';
1355
+ const isEmptyGroupName = groupName => isEmpty(groupName);
1343
1356
  const groupNameList = Array.from(allGroupNames).sort((a, b) => {
1344
1357
  const aEmpty = isEmptyGroupName(a);
1345
1358
  const bEmpty = isEmptyGroupName(b);
@@ -1350,9 +1363,14 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = async (chart,
1350
1363
  nameGroupMap.forEach((groupSet, name) => {
1351
1364
  groupNameList.forEach(groupName => {
1352
1365
  if (!groupSet.has(groupName)) {
1366
+ var _nameRawValueMap$get, _groupNameRawValueMap;
1367
+ const rawName = (_nameRawValueMap$get = nameRawValueMap.get(name)) !== null && _nameRawValueMap$get !== void 0 ? _nameRawValueMap$get : name;
1368
+ const rawGroupName = (_groupNameRawValueMap = groupNameRawValueMap.get(groupName)) !== null && _groupNameRawValueMap !== void 0 ? _groupNameRawValueMap : groupName;
1353
1369
  result.push({
1354
1370
  name,
1355
1371
  rows: [],
1372
+ original_name: rawName,
1373
+ original_group_name: rawGroupName,
1356
1374
  group_name: groupName,
1357
1375
  value: 0
1358
1376
  });
@@ -1504,7 +1522,7 @@ SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLM
1504
1522
  ...item,
1505
1523
  year
1506
1524
  });
1507
- if (years.indexOf(year) < 0) {
1525
+ if (!isNaN(year) && years.indexOf(year) < 0) {
1508
1526
  years.push(year);
1509
1527
  }
1510
1528
  });
@@ -1513,6 +1531,7 @@ SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLM
1513
1531
  if (current.year < next.year) return 1;
1514
1532
  return 0;
1515
1533
  });
1534
+ years.sort((current, next) => next - current);
1516
1535
  return {
1517
1536
  data,
1518
1537
  years
@@ -1870,12 +1889,11 @@ SQLStatisticsUtils.completenessSQlResult = async (chart, sqlRows, chartSQLMap, t
1870
1889
  return 1;
1871
1890
  }
1872
1891
  });
1873
-
1874
- // deduplicate by (name, group_name)
1892
+ const isGroup = chart.config.type === CHART_TYPE.COMPLETENESS_GROUP;
1875
1893
  const deduplicatedRes = [];
1876
1894
  const keyMap = {};
1877
1895
  res.forEach(item => {
1878
- const key = `${item.name}_${item.group_name}`;
1896
+ const key = isGroup ? `${item.name}_${item.groupby}_${item.group_name}` : `${item.name}_${item.group_name}`;
1879
1897
  if (!keyMap[key]) {
1880
1898
  keyMap[key] = item;
1881
1899
  deduplicatedRes.push(item);
@@ -1933,6 +1951,21 @@ SQLStatisticsUtils.scatterSQLResult2JavaScript = async (chart, sqlRows, chartSQL
1933
1951
  BaseUtils.sortCharts(res, groupbyColumn, 'name');
1934
1952
  return res;
1935
1953
  };
1954
+ SQLStatisticsUtils.formatMapGeolocationName = (cellValue, mapLevel, mapLocation) => {
1955
+ if (isEmpty(cellValue)) return '';
1956
+ if (typeof cellValue === 'object' && !Array.isArray(cellValue)) {
1957
+ const granularity = fixGeoGranularity(mapLevel, mapLocation);
1958
+ return getGeolocationByGranularity(cellValue, granularity) || '';
1959
+ }
1960
+ return cellValue;
1961
+ };
1962
+ SQLStatisticsUtils.formatWorldMapGeolocationName = cellValue => {
1963
+ if (isEmpty(cellValue)) return '';
1964
+ if (typeof cellValue === 'object' && !Array.isArray(cellValue)) {
1965
+ return getGeolocationByGranularity(cellValue, GROUP_GEOLOCATION_GRANULARITY.COUNTRY) || '';
1966
+ }
1967
+ return cellValue;
1968
+ };
1936
1969
  SQLStatisticsUtils.mapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
1937
1970
  const {
1938
1971
  sqlGeoColumnKey,
@@ -1941,6 +1974,10 @@ SQLStatisticsUtils.mapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, colum
1941
1974
  const {
1942
1975
  groupbyColumn
1943
1976
  } = columnMap;
1977
+ const {
1978
+ map_level,
1979
+ map_location
1980
+ } = (chart === null || chart === void 0 ? void 0 : chart.config) || {};
1944
1981
  if (groupbyColumn.type === 'link-formula') {
1945
1982
  const {
1946
1983
  data,
@@ -1955,9 +1992,10 @@ SQLStatisticsUtils.mapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, colum
1955
1992
  return [];
1956
1993
  }
1957
1994
  const nameValueMap = sqlRows.reduce((acc, row) => {
1958
- const geoList = row[key];
1995
+ const geoList = row[key] || [];
1959
1996
  const value = row[sqlSummaryColumnKey];
1960
1997
  geoList.forEach(geo => {
1998
+ if (!geo) return;
1961
1999
  const name = geo[geo_format];
1962
2000
  if (!acc[name]) {
1963
2001
  acc[name] = value;
@@ -1976,8 +2014,9 @@ SQLStatisticsUtils.mapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, colum
1976
2014
  }, []);
1977
2015
  } else {
1978
2016
  return sqlRows.reduce((acc, row) => {
1979
- const name = row[sqlGeoColumnKey];
2017
+ const rawName = row[sqlGeoColumnKey];
1980
2018
  const value = row[sqlSummaryColumnKey];
2019
+ const name = _SQLStatisticsUtils.formatMapGeolocationName(rawName, map_level, map_location);
1981
2020
  acc.push({
1982
2021
  name,
1983
2022
  value
@@ -2012,9 +2051,10 @@ SQLStatisticsUtils.worldMapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap,
2012
2051
  return [];
2013
2052
  }
2014
2053
  const nameValueMap = sqlRows.reduce((acc, row) => {
2015
- const geoList = row[key];
2054
+ const geoList = row[key] || [];
2016
2055
  const value = row[sqlSummaryColumnKey];
2017
2056
  geoList.forEach(geo => {
2057
+ if (!geo) return;
2018
2058
  const name = geo[geo_format];
2019
2059
  if (!acc[name]) {
2020
2060
  acc[name] = value;
@@ -2048,8 +2088,8 @@ SQLStatisticsUtils.worldMapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap,
2048
2088
  value = formatNumericValue(value, summaryColumn);
2049
2089
  formatted_value = getFormattedValue(value, summaryColumn, summary_method);
2050
2090
  }
2051
- if (currentValue) {
2052
- const name = typeof currentValue === 'string' ? currentValue : currentValue.country_region;
2091
+ const name = _SQLStatisticsUtils.formatWorldMapGeolocationName(currentValue);
2092
+ if (name) {
2053
2093
  result.push({
2054
2094
  name,
2055
2095
  value,
@@ -2139,7 +2179,13 @@ SQLStatisticsUtils.calculateChart = async (chart, value, callback, sqlRows) => {
2139
2179
  callback && callback('', tipMessage, null);
2140
2180
  return;
2141
2181
  }
2142
- const chartResult = await _SQLStatisticsUtils.sqlResult2JavaScript(newChart, sqlRows, chartSQLMap, columnMap, tables);
2182
+ let chartResult = null;
2183
+ try {
2184
+ chartResult = await _SQLStatisticsUtils.sqlResult2JavaScript(newChart, sqlRows, chartSQLMap, columnMap, tables);
2185
+ } catch (error) {
2186
+ const errorMessage = (error === null || error === void 0 ? void 0 : error.message) || error;
2187
+ return callback && callback(errorMessage, '', null);
2188
+ }
2143
2189
 
2144
2190
  // map is special
2145
2191
  if (BaseUtils.imEmptyChartResult(chartResult) && !chartType.includes('map')) {
@@ -1,7 +1,7 @@
1
1
  import _ButtonFormatter from "dtable-ui-component/lib/ButtonFormatter";
2
2
  import _RateFormatter from "dtable-ui-component/lib/RateFormatter";
3
3
  import React from 'react';
4
- import { CellType, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES, getNumberDisplayString, getDateDisplayString, getCellValueStringResult, isNumber, isValidLink, getColumnOptions } from 'dtable-utils';
4
+ import { CellType, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES, getNumberDisplayString, getDateDisplayString, getCellValueStringResult, isNumber, isValidLink, getColumnOptions, getGeolocationDisplayString } from 'dtable-utils';
5
5
  import dayjs from 'dayjs';
6
6
  import { isEqual } from 'lodash-es';
7
7
  import cellFormatterFactory from '../components/cell-factory/cell-formatter-factory';
@@ -550,7 +550,11 @@ const getFilterByColumnTypeForPivot = (columnKey, columns, value, rows) => {
550
550
  value = value[0].display_value;
551
551
  }
552
552
  }
553
- if (column && [CellType.GEOLOCATION, CellType.DATE, CellType.MTIME, CellType.CTIME].includes(type)) {
553
+ if (type === CellType.GEOLOCATION) {
554
+ filter['value'] = getGeolocationDisplayString(Array.isArray(value) ? value[0] : value, column.data);
555
+ return filter;
556
+ }
557
+ if (column && [CellType.DATE, CellType.MTIME, CellType.CTIME].includes(type)) {
554
558
  filter['value'] = value;
555
559
  return filter;
556
560
  }
@@ -632,7 +636,11 @@ const getFilterByColumnType = (columnKey, columns, rows, sqlColumnKey) => {
632
636
  value = value[0].display_value;
633
637
  }
634
638
  }
635
- if (column && [CellType.GEOLOCATION, CellType.DATE, CellType.MTIME, CellType.CTIME].includes(type)) {
639
+ if (type === CellType.GEOLOCATION) {
640
+ filter['value'] = getGeolocationDisplayString(Array.isArray(value) ? value[0] : value, column.data);
641
+ return filter;
642
+ }
643
+ if (column && [CellType.DATE, CellType.MTIME, CellType.CTIME].includes(type)) {
636
644
  // link_formula result is an array, but can't pass the value directly as an array here
637
645
  if (Array.isArray(value)) value = value[0];
638
646
  filter['value'] = value;
@@ -664,9 +672,11 @@ export const getFilterConditions = (statisticRecord, chart, table) => {
664
672
  const columns = table.columns || [];
665
673
  const {
666
674
  name = '',
667
- rows,
668
675
  isPivot
669
676
  } = statisticRecord || {};
677
+ let {
678
+ rows
679
+ } = statisticRecord || {};
670
680
  const {
671
681
  config
672
682
  } = chart;
@@ -690,6 +700,12 @@ export const getFilterConditions = (statisticRecord, chart, table) => {
690
700
  } = chartSQLMap;
691
701
  sqlGroupbyColumnKey = sqlColumns.name_column.key;
692
702
  }
703
+ if ((!Array.isArray(rows) || rows.length === 0) && statisticRecord && Object.prototype.hasOwnProperty.call(statisticRecord, 'original_name')) {
704
+ rows = [{
705
+ [sqlGroupbyColumnKey]: statisticRecord.original_name,
706
+ [sqlColumnGroupbyColumnKey]: statisticRecord.original_group_name
707
+ }];
708
+ }
693
709
  if (isPivot && rows.length) {
694
710
  const xValueList = [];
695
711
  const yValueList = [];
@@ -716,7 +732,7 @@ export const getFilterConditions = (statisticRecord, chart, table) => {
716
732
  const flters = rows.map(row => getFilterByColumnType(config[columnKey], columns, [row], sqlGroupbyColumnKey));
717
733
  filters.push(...flters);
718
734
  } else {
719
- if (['map', 'map_bubble'].includes(type)) {
735
+ if (['map', 'map_bubble', 'heat_map'].includes(type)) {
720
736
  const filter = {
721
737
  column_key: config[columnKey],
722
738
  value: name
@@ -784,6 +784,7 @@ const chartColumn2SqlColumn = (chartElement, table) => {
784
784
  return pieChartStatisticColumn2sqlColumn(chart, table);
785
785
  }
786
786
  case CHART_TYPE.BAR:
787
+ case CHART_TYPE.BAR_CUSTOM:
787
788
  case CHART_TYPE.LINE:
788
789
  case CHART_TYPE.HORIZONTAL_BAR:
789
790
  case CHART_TYPE.AREA:
@@ -855,6 +856,7 @@ export const getDatabaseGroupName = (statItem, selectedTable) => {
855
856
  let groupName, selectedColumn, columnGroupName, columnSelectedColumn;
856
857
  switch (type) {
857
858
  case CHART_TYPE.BAR:
859
+ case CHART_TYPE.BAR_CUSTOM:
858
860
  case CHART_TYPE.BAR_GROUP:
859
861
  case CHART_TYPE.BAR_STACK:
860
862
  case CHART_TYPE.LINE:
@@ -67,23 +67,6 @@
67
67
  padding-bottom: 0;
68
68
  }
69
69
 
70
- .sea-chart-formatter .sea-chart-container.show-x-axis-label,
71
- .sea-chart-formatter .sea-chart-container.show-horizontal-axis-label {
72
- padding-bottom: 20px;
73
- }
74
-
75
-
76
-
77
- .sea-chart-formatter .sea-chart-container.show-y-axis-label,
78
- .sea-chart-formatter .sea-chart-container.show-y-axis-left-label,
79
- .sea-chart-formatter .sea-chart-container.show-vertical-axis-label {
80
- padding-left: 20px;
81
- }
82
-
83
- .sea-chart-formatter .sea-chart-container.show-y-axis-right-label {
84
- padding-right: 20px;
85
- }
86
-
87
70
  .sea-chart-formatter .g2-html-annotation {
88
71
  transform: translate(-50%, -50%);
89
72
  width: fit-content;