sea-chart 0.0.26 → 0.0.28-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.
Files changed (31) hide show
  1. package/dist/components/loading/index.css +6 -0
  2. package/dist/intl.js +6 -6
  3. package/dist/locale/lang/de.js +4 -1
  4. package/dist/locale/lang/en.js +5 -1
  5. package/dist/locale/lang/es.js +5 -1
  6. package/dist/locale/lang/fr.js +5 -1
  7. package/dist/locale/lang/pt.js +5 -1
  8. package/dist/locale/lang/ru.js +5 -1
  9. package/dist/locale/lang/zh_CN.js +5 -1
  10. package/dist/model/basic-number-card.js +3 -2
  11. package/dist/settings/basic-number-card/data-settings.js +58 -21
  12. package/dist/settings/table-settings/data-settings.js +16 -1
  13. package/dist/settings/widgets/y-axis-group-settings.js +4 -4
  14. package/dist/utils/chart-utils/base-utils.js +12 -3
  15. package/dist/utils/chart-utils/index.js +5 -1
  16. package/dist/utils/chart-utils/sql-statistics-utils.js +12 -3
  17. package/dist/utils/sql/chart-data-sql.js +5 -1
  18. package/dist/view/index.css +4 -0
  19. package/dist/view/index.js +1 -1
  20. package/dist/view/wrapper/area.js +3 -1
  21. package/dist/view/wrapper/bar-group.js +40 -13
  22. package/dist/view/wrapper/basic-number-card.js +3 -1
  23. package/dist/view/wrapper/chart-component.js +44 -5
  24. package/dist/view/wrapper/horizontal-bar-group.js +39 -9
  25. package/dist/view/wrapper/line-group.js +3 -1
  26. package/dist/view/wrapper/line.js +3 -1
  27. package/dist/view/wrapper/table/index.js +2 -2
  28. package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +5 -4
  29. package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +5 -4
  30. package/dist/view/wrapper/table/two-dimension-table.js +7 -6
  31. package/package.json +2 -2
@@ -36,6 +36,12 @@
36
36
  }
37
37
  }
38
38
 
39
+ .loading {
40
+ display: flex;
41
+ justify-content: center;
42
+ align-items: center;
43
+ }
44
+
39
45
  .loading-icon {
40
46
  display: inline-block;
41
47
  width: 20px;
package/dist/intl.js CHANGED
@@ -4,15 +4,15 @@ class Intl {
4
4
  constructor(_ref) {
5
5
  var _this = this;
6
6
  let {
7
- lang: _lang = 'zh_CN'
7
+ lang: _lang = 'zh-cn'
8
8
  } = _ref;
9
9
  this.setLang = function () {
10
- let lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'zh_CN';
10
+ let lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'zh-cn';
11
11
  const validLang = lang.toLowerCase();
12
+ setLocale(validLang);
12
13
  if (validLang === _this.lang) return;
13
14
  _this.lang = validLang;
14
- _this.translation = LOCALES[_this.lang] || LOCALES['zh_CN'];
15
- setLocale(validLang);
15
+ _this.translation = LOCALES[_this.lang] || LOCALES['zh-cn'];
16
16
  };
17
17
  this.get = function (key) {
18
18
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -30,10 +30,10 @@ class Intl {
30
30
  }) || key;
31
31
  };
32
32
  this.lang = _lang.toLowerCase();
33
- this.translation = LOCALES[this.lang] || LOCALES['zh_CN'];
33
+ this.translation = LOCALES[this.lang] || LOCALES['zh-cn'];
34
34
  }
35
35
  }
36
36
  const intl = new Intl({
37
- lang: 'zh_CN'
37
+ lang: 'zh-cn'
38
38
  });
39
39
  export default intl;
@@ -165,6 +165,9 @@ const de = {
165
165
  'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
166
  'polylines': 'Polylines',
167
167
  'curves': 'Curves',
168
- 'Line_type': 'Line type'
168
+ 'Line_type': 'Line type',
169
+ 'Summarize_description': 'Count the sum, maximum, minimum, average, or number of distinct values of records based on a field',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
+ 'Display_empty_when_data_is_zero': 'Display empty when data is zero'
169
172
  };
170
173
  export default de;
@@ -242,6 +242,10 @@ const en = {
242
242
  "Label_settings": "Label settings",
243
243
  'polylines': 'Polylines',
244
244
  'curves': 'Curves',
245
- 'Line_type': 'Line type'
245
+ 'Line_type': 'Line type',
246
+ 'Summarize_description': 'Count the sum, maximum, minimum, average, or number of distinct values of records based on a field',
247
+ 'Count_description': 'Count the number of records based on data settings',
248
+ 'Display_empty_when_data_is_zero': 'Display empty when data is zero',
249
+ 'Count_description': 'Count the number of records based on data settings'
246
250
  };
247
251
  export default en;
@@ -165,6 +165,10 @@ const es = {
165
165
  'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
166
  'polylines': 'Polylines',
167
167
  'curves': 'Curves',
168
- 'Line_type': 'Line type'
168
+ 'Line_type': 'Line type',
169
+ 'Summarize_description': 'Count the sum, maximum, minimum, average, or number of distinct values of records based on a field',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
+ 'Display_empty_when_data_is_zero': 'Display empty when data is zero',
172
+ 'Count_description': 'Count the number of records based on data settings'
169
173
  };
170
174
  export default es;
@@ -165,6 +165,10 @@ const fr = {
165
165
  'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
166
  'polylines': 'Polylines',
167
167
  'curves': 'Curves',
168
- 'Line_type': 'Line type'
168
+ 'Line_type': 'Line type',
169
+ 'Summarize_description': 'Count the sum, maximum, minimum, average, or number of distinct values of records based on a field',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
+ 'Display_empty_when_data_is_zero': 'Display empty when data is zero',
172
+ 'Count_description': 'Count the number of records based on data settings'
169
173
  };
170
174
  export default fr;
@@ -165,6 +165,10 @@ const pt = {
165
165
  'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
166
  'polylines': 'Polylines',
167
167
  'curves': 'Curves',
168
- 'Line_type': 'Line type'
168
+ 'Line_type': 'Line type',
169
+ 'Summarize_description': 'Count the sum, maximum, minimum, average, or number of distinct values of records based on a field',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
+ 'Display_empty_when_data_is_zero': 'Display empty when data is zero',
172
+ 'Count_description': 'Count the number of records based on data settings'
169
173
  };
170
174
  export default pt;
@@ -165,6 +165,10 @@ const ru = {
165
165
  'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
166
  'polylines': 'Polylines',
167
167
  'curves': 'Curves',
168
- 'Line_type': 'Line type'
168
+ 'Line_type': 'Line type',
169
+ 'Summarize_description': 'Count the sum, maximum, minimum, average, or number of distinct values of records based on a field',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
+ 'Display_empty_when_data_is_zero': 'Display empty when data is zero',
172
+ 'Count_description': 'Count the number of records based on data settings'
169
173
  };
170
174
  export default ru;
@@ -242,6 +242,10 @@ const zh_CN = {
242
242
  "Label_settings": "标签设置",
243
243
  'polylines': '折线',
244
244
  'curves': '曲线',
245
- 'Line_type': '线型'
245
+ 'Line_type': '线型',
246
+ 'Summarize_description': '按照一个字段计算记录的总和、最大值、最小值或者平均值',
247
+ 'Count_description': '根据数据设置计算记录数量',
248
+ 'Display_empty_when_data_is_zero': '数据为零时留空',
249
+ 'Count_description': '根据数据设置计算记录数量'
246
250
  };
247
251
  export default zh_CN;
@@ -1,5 +1,5 @@
1
1
  import { isNumericColumn, getTableById, getTableColumnByKey } from 'dtable-utils';
2
- import { CHART_SUMMARY_TYPE, CHART_TYPE } from '../constants';
2
+ import { CHART_SUMMARY_CALCULATION_METHOD, CHART_TYPE, CHART_Y_GROUP_TYPE } from '../constants';
3
3
  import BaseModel from './base-model';
4
4
  class BasicNumberCard extends BaseModel {
5
5
  constructor(options, tables) {
@@ -16,7 +16,8 @@ class BasicNumberCard extends BaseModel {
16
16
  this.numeric_column_key = null;
17
17
  }
18
18
  }
19
- this.summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.ROW_COUNT;
19
+ this.summary_type = options.x_axis_summary_type || CHART_Y_GROUP_TYPE.COUNT;
20
+ this.summary_method = options.y_axis_summary_method || CHART_SUMMARY_CALCULATION_METHOD[0];
20
21
  this.font_size = options.font_size || 40;
21
22
  this.font_color = options.font_color;
22
23
  this.label_font_size = options.label_font_size || 12;
@@ -4,7 +4,7 @@ import { COLUMNS_ICON_CONFIG, getTableById } from 'dtable-utils';
4
4
  import DTableSelect from "dtable-ui-component/lib/DTableSelect";
5
5
  import CommonDataSettings from '../widgets/common-data-settings';
6
6
  import { BaseUtils } from '../../utils';
7
- import { CHART_SUMMARY_SHOW, CHART_SUMMARY_CALCULATION_METHOD, CHART_SUPPORT_COLUMNS, BASIC_NUMBER_CARD_CALCULATION_METHOD } from '../../constants';
7
+ import { CHART_SUMMARY_SHOW, CHART_SUMMARY_CALCULATION_METHOD, CHART_SUPPORT_COLUMNS, CHART_Y_GROUP_TYPE } from '../../constants';
8
8
  import intl from '../../intl';
9
9
  const DataSettings = _ref => {
10
10
  let {
@@ -14,7 +14,7 @@ const DataSettings = _ref => {
14
14
  onChange
15
15
  } = _ref;
16
16
  const summaryMethodsOptions = useMemo(() => {
17
- const numberCardSummaryMethod = [BASIC_NUMBER_CARD_CALCULATION_METHOD, ...CHART_SUMMARY_CALCULATION_METHOD];
17
+ const numberCardSummaryMethod = [...CHART_SUMMARY_CALCULATION_METHOD];
18
18
  return numberCardSummaryMethod.map(method => {
19
19
  return {
20
20
  label: /*#__PURE__*/React.createElement("span", {
@@ -24,6 +24,21 @@ const DataSettings = _ref => {
24
24
  };
25
25
  });
26
26
  }, []);
27
+ const summaryTypeOptions = [{
28
+ value: CHART_Y_GROUP_TYPE.COUNT,
29
+ label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
30
+ className: "select-module select-module-name ml-0"
31
+ }, intl.get(CHART_SUMMARY_SHOW['count'])), /*#__PURE__*/React.createElement("div", {
32
+ className: "summary-type-explanation"
33
+ }, intl.get('Count_description')))
34
+ }, {
35
+ value: CHART_Y_GROUP_TYPE.SINGLE_NUMERIC_COLUMN,
36
+ label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
37
+ className: "select-module select-module-name ml-0"
38
+ }, intl.get(CHART_SUMMARY_SHOW['advanced'])), /*#__PURE__*/React.createElement("div", {
39
+ className: "summary-type-explanation"
40
+ }, intl.get('Summarize_description')))
41
+ }];
27
42
  const selectedTable = useMemo(() => {
28
43
  const {
29
44
  table_id: selectedTableId
@@ -63,6 +78,19 @@ const DataSettings = _ref => {
63
78
  }
64
79
  }, ...options];
65
80
  }, [numericColumns]);
81
+ const onSummaryTypeChange = useCallback(option => {
82
+ const {
83
+ config
84
+ } = chart;
85
+ const {
86
+ summary_type
87
+ } = config;
88
+ const newSummaryType = option.value;
89
+ if (newSummaryType === summary_type) return;
90
+ onChange && onChange({
91
+ summary_type: newSummaryType
92
+ });
93
+ }, [chart, onChange]);
66
94
  const onSelectColumnChange = useCallback(option => {
67
95
  const {
68
96
  config
@@ -92,23 +120,19 @@ const DataSettings = _ref => {
92
120
  const getSelectedMethodOption = useCallback((method, summaryMethodsOptions) => {
93
121
  return summaryMethodsOptions.find(m => m.value === method) || summaryMethodsOptions[0];
94
122
  }, []);
95
- const renderSummaryMethod = useCallback(() => {
96
- const {
97
- summary_method
98
- } = chart.config;
99
- const selectedMethodOption = getSelectedMethodOption(summary_method, summaryMethodsOptions);
100
- return /*#__PURE__*/React.createElement("div", {
101
- className: "dtable-plugin-stat-parameter-item"
102
- }, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
103
- value: selectedMethodOption,
104
- onChange: onSelectSummaryMethod,
105
- options: summaryMethodsOptions
106
- }));
107
- }, [chart, getSelectedMethodOption, onSelectSummaryMethod, summaryMethodsOptions]);
123
+ const selectedSummaryTypeOption = summaryTypeOptions.find(option => option.value === chart.config.summary_type) || summaryTypeOptions[0];
124
+ const isSummarizeAField = chart.config.summary_type === CHART_Y_GROUP_TYPE.SINGLE_NUMERIC_COLUMN;
108
125
  const {
109
- config
110
- } = chart;
111
- const selectedColumnOption = numericColumnOptions.find(option => option.value.key === config.numeric_column_key) || numericColumnOptions[0];
126
+ summary_method
127
+ } = chart.config;
128
+ const selectedMethodOption = getSelectedMethodOption(summary_method, summaryMethodsOptions);
129
+ let selectedColumnOption;
130
+ if (isSummarizeAField) {
131
+ const {
132
+ config
133
+ } = chart;
134
+ selectedColumnOption = numericColumnOptions.find(option => option.value.key === config.numeric_column_key) || numericColumnOptions[0];
135
+ }
112
136
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
113
137
  dataSources: dataSources,
114
138
  chart: chart,
@@ -116,13 +140,26 @@ const DataSettings = _ref => {
116
140
  onChange: onChange
117
141
  }), /*#__PURE__*/React.createElement(FormGroup, {
118
142
  className: "sea-chart-parameter-item"
119
- }, /*#__PURE__*/React.createElement("label", null, intl.get('Statistic_field')), /*#__PURE__*/React.createElement(DTableSelect, {
143
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_type')), /*#__PURE__*/React.createElement(DTableSelect, {
144
+ classNamePrefix: "chart-summary-types",
145
+ value: selectedSummaryTypeOption,
146
+ options: summaryTypeOptions,
147
+ placeholder: intl.get('Select_a_column'),
148
+ onChange: onSummaryTypeChange
149
+ })), isSummarizeAField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
150
+ className: "sea-chart-parameter-item"
151
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_field')), /*#__PURE__*/React.createElement(DTableSelect, {
120
152
  value: selectedColumnOption,
121
153
  options: numericColumnOptions,
122
- placeholder: intl.get('Select_a_column'),
123
154
  onChange: onSelectColumnChange
124
155
  })), /*#__PURE__*/React.createElement(FormGroup, {
125
156
  className: "sea-chart-parameter-item"
126
- }, renderSummaryMethod()));
157
+ }, /*#__PURE__*/React.createElement("div", {
158
+ className: "dtable-plugin-stat-parameter-item"
159
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
160
+ value: selectedMethodOption,
161
+ onChange: onSelectSummaryMethod,
162
+ options: summaryMethodsOptions
163
+ })))));
127
164
  };
128
165
  export default DataSettings;
@@ -503,7 +503,8 @@ const DataSettings = _ref => {
503
503
  column_groupby_column_key,
504
504
  column_groupby_date_granularity,
505
505
  column_groupby_geolocation_granularity,
506
- display_total = true
506
+ display_total = true,
507
+ display_empty
507
508
  } = config;
508
509
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
509
510
  chart: chart,
@@ -562,6 +563,20 @@ const DataSettings = _ref => {
562
563
  display_total: !display_total
563
564
  });
564
565
  }
566
+ })), /*#__PURE__*/React.createElement(Divider, {
567
+ className: "mt-4"
568
+ }), /*#__PURE__*/React.createElement(FormGroup, {
569
+ className: "sea-chart-parameter-item"
570
+ }, /*#__PURE__*/React.createElement(DTableSwitch, {
571
+ switchClassName: "display-value-settings",
572
+ checked: display_empty || false,
573
+ disabled: false,
574
+ placeholder: intl.get('Display_empty_when_data_is_zero'),
575
+ onChange: () => {
576
+ onChange({
577
+ display_empty: !display_empty
578
+ });
579
+ }
565
580
  })));
566
581
  };
567
582
  export default DataSettings;
@@ -2,12 +2,12 @@ import React, { Component } from 'react';
2
2
  import { FormGroup, Label } from 'reactstrap';
3
3
  import DTableSelect from "dtable-ui-component/lib/DTableSelect";
4
4
  import { COLUMNS_ICON_CONFIG, getTableById } from 'dtable-utils';
5
- import NumericSummaryItem from './numeric-summary-item';
6
- import SummaryMethodSettings from './summary-method-setting';
7
- import Groupby from './group-by';
8
5
  import { CHART_Y_GROUP_TYPE, CHART_SUMMARY_SHOW, CHART_SUMMARY_CALCULATION_METHOD, CHART_SUMMARY_TYPE, DATE_GRANULATES, GEOLOCATION_GRANULATES, CHART_DATE_SUMMARY_CALCULATION_METHOD, CHART_SUPPORT_COLUMNS, CHART_TYPE } from '../../constants';
9
6
  import { BaseUtils } from '../../utils';
10
7
  import intl from '../../intl';
8
+ import NumericSummaryItem from './numeric-summary-item';
9
+ import SummaryMethodSettings from './summary-method-setting';
10
+ import Groupby from './group-by';
11
11
  class YAxisGroupSettings extends Component {
12
12
  constructor(_props) {
13
13
  super(_props);
@@ -20,7 +20,7 @@ class YAxisGroupSettings extends Component {
20
20
  table_id,
21
21
  type
22
22
  } = chart.config;
23
- this.isMapChart = type === CHART_TYPE.MAP || type === CHART_TYPE.MAP_BUBBLE || type === CHART_TYPE.WORLD_MAP || type === CHART_TYPE.WORLD_MAP_BUBBLE;
23
+ this.isMapChart = [CHART_TYPE.MAP, CHART_TYPE.MAP_BUBBLE, CHART_TYPE.WORLD_MAP, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type);
24
24
  this.selectedTable = getTableById(tables, table_id);
25
25
  };
26
26
  this.initGroupTypeOptions = () => {
@@ -2,7 +2,7 @@ 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';
5
- 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 } from '../../constants';
5
+ 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 } from '../../constants';
6
6
  import { getClientFormulaDisplayString } from '../cell-format-utils';
7
7
  import { getKnownCollaboratorByEmail, generateDefaultUser, getUsers } from '../collaborator-utils';
8
8
  import { getDateColumnFormat, getColumnByKey } from '../column-utils';
@@ -60,6 +60,10 @@ BaseUtils.isValidExistChart = (tables, chart) => {
60
60
  const table = getTableById(tables, table_id);
61
61
  if (!table) return false;
62
62
  if (config.type === CHART_TYPE.BASIC_NUMBER_CARD) {
63
+ const {
64
+ summary_type
65
+ } = config;
66
+ if (summary_type === CHART_Y_GROUP_TYPE.COUNT || !summary_type) return true;
63
67
  const numericColumnKey = config.numeric_column_key;
64
68
  if (!numericColumnKey) return false;
65
69
  return getTableColumnByKey(table, numericColumnKey);
@@ -207,8 +211,13 @@ BaseUtils.isSameGroup = (isColumnDataAsAnArray, source, target) => {
207
211
  }
208
212
  return source === null && target === null || source === undefined && target === undefined || source === target;
209
213
  };
210
- BaseUtils.isValidValue = value => {
211
- if (value === 0) return true;
214
+ BaseUtils.isValidValue = function (value) {
215
+ let display_empty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
216
+ // convert str to number
217
+ if (value === '0') {
218
+ value = +value;
219
+ }
220
+ if (value === 0 && !display_empty) return true;
212
221
  return Boolean(value);
213
222
  };
214
223
  BaseUtils.getSummaryValueDisplayString = function (summaryColumn, summaryValue) {
@@ -1,9 +1,13 @@
1
+ import context from '../../context';
1
2
  import BaseUtils from './base-utils';
2
3
  import SQLStatisticsUtils from './sql-statistics-utils';
3
4
  import OriginalDataUtils from './original-data-utils';
4
- import context from '../../context';
5
5
  class ChartUtils {}
6
6
  ChartUtils.calculateChart = (chart, value, callback) => {
7
+ if (!BaseUtils.isValidExistChart(value.tables, chart)) {
8
+ const tip_message = 'Please_complete_the_chart_configuration_first';
9
+ return callback && callback('', tip_message, null);
10
+ }
7
11
  context.queryChartResult({
8
12
  chart,
9
13
  tables: value.tables,
@@ -90,10 +90,11 @@ SQLStatisticsUtils.formatedTableSqlRows = (chart, sqlRows, chartSQLMap, columnMa
90
90
  const {
91
91
  config
92
92
  } = chart;
93
- const {
93
+ let {
94
94
  sqlGroupbyColumnKey,
95
95
  sqlSummaryColumnKey,
96
- summarySQLColumnName2ColumnKey
96
+ summarySQLColumnName2ColumnKey,
97
+ sqlColumnGroupbyColumnKey
97
98
  } = chartSQLMap;
98
99
  const newSqlRows = JSON.parse(JSON.stringify(sqlRows));
99
100
  if (config.summary_type === CHART_SUMMARY_TYPE.COUNT) {
@@ -126,7 +127,15 @@ SQLStatisticsUtils.formatedTableSqlRows = (chart, sqlRows, chartSQLMap, columnMa
126
127
  });
127
128
  }
128
129
  if (config.summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
129
- const summarySQLColumnName2ColumnKeys = Object.keys(summarySQLColumnName2ColumnKey);
130
+ let summarySQLColumnName2ColumnKeys;
131
+ if (summarySQLColumnName2ColumnKey) {
132
+ summarySQLColumnName2ColumnKeys = Object.keys(summarySQLColumnName2ColumnKey);
133
+ } else if (sqlColumnGroupbyColumnKey) {
134
+ summarySQLColumnName2ColumnKeys = [sqlColumnGroupbyColumnKey];
135
+ } else {
136
+ console.error('on formatedTableSqlRows: summarySQLColumnName2ColumnKey is null');
137
+ return [];
138
+ }
130
139
  sqlRows.forEach((item, index) => {
131
140
  const collaborators = item[sqlGroupbyColumnKey];
132
141
  // Multiple collaborators
@@ -1,6 +1,6 @@
1
1
  import { CellType, filter2SqlCondition, isNumericColumn, isDateColumn } from 'dtable-utils';
2
2
  import { getSqlGroup } from '../column-utils';
3
- import { CHART_TYPE, DTABLE_DB_SUMMARY_METHOD, CHART_SUMMARY_TYPE, TIME_COLUMN_LIST, Y_AXIS_TYPE_PREFIX } from '../../constants';
3
+ import { CHART_TYPE, DTABLE_DB_SUMMARY_METHOD, CHART_SUMMARY_TYPE, TIME_COLUMN_LIST, Y_AXIS_TYPE_PREFIX, CHART_Y_GROUP_TYPE } from '../../constants';
4
4
  import { fixGeoGranularity } from '../map';
5
5
 
6
6
  /*
@@ -678,6 +678,10 @@ class ChartDataSQL {
678
678
  return "SELECT ".concat(groupby_column_name, " FROM ").concat(this.table_name, " ").concat(this.filter_sql, " GROUP BY ").concat(groupby_column_name, " LIMIT 0, 5000");
679
679
  };
680
680
  this._basic_number_card_chart_statistic_2_sql = () => {
681
+ const summary_type = this.chart['summary_type'];
682
+ if (summary_type === CHART_Y_GROUP_TYPE.COUNT) {
683
+ return "SELECT COUNT(*) FROM ".concat(this.table_name, " ").concat(this.filter_sql, " LIMIT 0, 5000");
684
+ }
681
685
  const numeric_column_key = this.chart['numeric_column_key'] || '';
682
686
  let summary_method = this.chart['summary_method'] || '';
683
687
  const numeric_column = this._get_column_by_key(numeric_column_key);
@@ -43,6 +43,10 @@
43
43
  bottom: 8%;
44
44
  }
45
45
 
46
+ .sea-chart-formatter .sea-chart-container.plugin-number-card {
47
+ bottom: 2%;
48
+ }
49
+
46
50
  .sea-chart-formatter .sea-chart-container.show-x-axis-label,
47
51
  .sea-chart-formatter .sea-chart-container.show-horizontal-axis-label {
48
52
  padding-bottom: 20px;
@@ -78,7 +78,7 @@ class View extends React.PureComponent {
78
78
  tipMessage: ''
79
79
  };
80
80
  context.init(props);
81
- const lang = context.getSetting('lang') || 'zh_CN';
81
+ const lang = context.getSetting('lang') || 'zh-cn';
82
82
  intl.setLang(lang);
83
83
  }
84
84
  componentDidMount() {
@@ -101,7 +101,9 @@ class Area extends ChartComponent {
101
101
  const line = this.chart.line().label(y_axis_show_value ? 'value' : false, {
102
102
  style: {
103
103
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
104
- fill: theme.labelColor
104
+ fill: theme.labelColor,
105
+ stroke: '#fff',
106
+ lineWidth: 1
105
107
  }
106
108
  }).position('name*value').animate({
107
109
  appear: {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import DataSet from '@antv/data-set';
4
4
  import { getNumberDisplayString } from 'dtable-utils';
5
- import { debounce, maxBy } from 'lodash-es';
5
+ import { debounce, maxBy, throttle } from 'lodash-es';
6
6
  import classNames from 'classnames';
7
7
  import intl from '../../intl';
8
8
  import { sortDataByGroupSum } from '../../utils/column-utils';
@@ -76,23 +76,21 @@ class BarGroup extends ChartComponent {
76
76
  display_each_block_data,
77
77
  y_axis_summary_type
78
78
  } = chart.config;
79
- const isGroup = type === CHART_TYPE.BAR_GROUP ? true : false;
79
+ const isGroup = type === CHART_TYPE.BAR_GROUP;
80
80
  const chartBarColor = this.groupName;
81
81
  const newData = this.getChartGroupData(data);
82
82
  let singleBarWidth, singleBarRadius;
83
+ // y-axis label width:6 + 10
84
+ const chartWidth = this.chart.width - 6 - 10;
83
85
  if (!isGroup) {
84
- // y-axis label width:6 + 10
85
- const chartWidth = this.chart.width - 6 - 10;
86
86
  singleBarWidth = Math.round(chartWidth / (2 * newData.length));
87
- singleBarRadius = singleBarWidth / 5;
88
87
  this.markFirstOrLast(data, 'first');
89
88
  } else {
90
89
  const maxCountGroup = maxBy(newData, 'currentGroupCount');
91
90
  // y-axis label width:6 + 10
92
- const chartWidth = this.chart.width - 6 - 10;
93
91
  singleBarWidth = Math.round(chartWidth / (2 * newData.length * maxCountGroup.currentGroupCount));
94
- singleBarRadius = singleBarWidth / 5;
95
92
  }
93
+ singleBarRadius = singleBarWidth / 5;
96
94
  this.drawLabels(newData);
97
95
  // set Coord type
98
96
  this.chart.coordinate('rect');
@@ -140,16 +138,29 @@ class BarGroup extends ChartComponent {
140
138
  type: 'dodge',
141
139
  marginRatio: 0
142
140
  };
143
- this.chart.interval().label(y_axis_show_value ? 'value' : false, {
144
- formatter: value => {
145
- return value;
141
+ this.setColorMap(data);
142
+ this.chart.interval().animate({
143
+ // custom update animation
144
+ update: {
145
+ animation: 'fadeIn',
146
+ duration: 1000,
147
+ easing: 'easeLinear'
148
+ }
149
+ }).label(y_axis_show_value ? 'value' : false, {
150
+ content: data => {
151
+ if (this.currentName) {
152
+ return data.name === this.currentName ? data.value : '';
153
+ }
154
+ return data.value;
146
155
  },
147
156
  style: {
148
157
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
149
158
  fill: theme.labelColor
150
159
  },
151
160
  position: type === CHART_TYPE.BAR_STACK ? 'middle' : ''
152
- }).position('name*value').size(singleBarWidth).color(chartBarColor).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
161
+ }).position('name*value').size(singleBarWidth).color(chartBarColor, group_name => {
162
+ return this.colorMap[group_name];
163
+ }).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
153
164
  return {
154
165
  title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
155
166
  value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
@@ -179,12 +190,28 @@ class BarGroup extends ChartComponent {
179
190
  };
180
191
  }
181
192
  });
182
- this.setToolTip();
193
+ if (isGroup) {
194
+ this.formatDataByName(data);
195
+ }
196
+ this.setToolTip(isGroup, summaryColumn, y_axis_summary_method);
183
197
  isFunction(customRender) && customRender(this.chart);
184
198
  this.setNameLabelAndTooltip(theme, this.labelCount);
185
199
  this.setValueLabel(theme);
186
200
  this.setLegend(this.groupName, theme, 'top-right');
187
- this.chart.interaction('element-highlight');
201
+ this.chart.interaction('element-highlight-by-x');
202
+ if (y_axis_show_value) {
203
+ this.chart.on('element:mouseenter', throttle(e => {
204
+ const currentName = e.data.data.name;
205
+ if (this.currentName && this.currentName === currentName) return;
206
+ this.currentName = currentName;
207
+ this.chart.render(true);
208
+ }, 500));
209
+ this.chart.on('element:mouseleave', throttle(e => {
210
+ if (!this.currentName) return;
211
+ this.currentName = null;
212
+ this.chart.render(true);
213
+ }, 500));
214
+ }
188
215
  };
189
216
  this.chart = null;
190
217
  this.groupName = 'group_name';
@@ -54,9 +54,11 @@ class BasicNumericCard extends Component {
54
54
  summaryColumn
55
55
  } = this.props;
56
56
  const {
57
+ summary_type,
57
58
  summary_method
58
59
  } = chart.config;
59
- if (summary_method !== BASIC_NUMBER_CARD_CALCULATION_METHOD) {
60
+ // COUNT / SUMMARIZE_A_FIELD
61
+ if (summary_type !== BASIC_NUMBER_CARD_CALCULATION_METHOD) {
60
62
  const formattedContent = BaseUtils.getSummaryValueDisplayString(summaryColumn, data, summary_method);
61
63
  return formattedContent;
62
64
  }
@@ -3,7 +3,7 @@ import { getTableById, getTableColumnByKey } from 'dtable-utils';
3
3
  import { cloneDeep, debounce } from 'lodash-es';
4
4
  import { Chart } from '../../utils/custom-g2';
5
5
  import { BaseUtils } from '../../utils';
6
- import { CHART_TYPE, CHART_SUMMARY_TYPE, LABEL_POSITION_TYPE, CHART_THEME_COLOR, EMPTY_NAME, THEME_NAME_MAP } from '../../constants';
6
+ import { CHART_TYPE, CHART_SUMMARY_TYPE, LABEL_POSITION_TYPE, CHART_THEME_COLOR, EMPTY_NAME, THEME_NAME_MAP, CHART_STYLE_COLORS } from '../../constants';
7
7
  import intl from '../../intl';
8
8
  export default class ChartComponent extends Component {
9
9
  constructor() {
@@ -413,8 +413,31 @@ export default class ChartComponent extends Component {
413
413
  }
414
414
  });
415
415
  };
416
- this.getToolTipSettings = () => {
417
- return {
416
+ this.setColorMap = data => {
417
+ let currentIdx = 0;
418
+ const colorMap = data.reduce((acc, cur) => {
419
+ if (cur.group_name && !acc[cur.group_name]) {
420
+ acc[cur.group_name] = CHART_STYLE_COLORS[currentIdx++ % CHART_STYLE_COLORS.length];
421
+ }
422
+ return acc;
423
+ }, {});
424
+ this.colorMap = colorMap;
425
+ };
426
+ this.formatDataByName = data => {
427
+ const formattedItems = {};
428
+ data.forEach(item => {
429
+ const {
430
+ name
431
+ } = item;
432
+ if (!formattedItems[name]) {
433
+ formattedItems[name] = [];
434
+ }
435
+ formattedItems[name].push(item);
436
+ });
437
+ this.formatedDataByName = formattedItems;
438
+ };
439
+ this.getToolTipSettings = (isGroup, summaryColumn, y_axis_summary_method) => {
440
+ const obj = {
418
441
  showMarkers: false,
419
442
  containerTpl: "<div class=\"g2-tooltip\">\n <div class=\"g2-tooltip-title\">{title}</div>\n <ul class=\"g2-tooltip-list\"></ul>\n </div>",
420
443
  itemTpl: "<li class=\"g2-tooltip-list-item\">\n <span class=\"g2-tooltip-marker\" style=\"background-color:{color};display:inline-block;\"></span>\n <span class=\"g2-tooltip-name\">{name}</span>\n <span class=\"g2-tooltip-value\">{value}</span>\n </li>",
@@ -464,9 +487,25 @@ export default class ChartComponent extends Component {
464
487
  }
465
488
  }
466
489
  };
490
+ if (isGroup) {
491
+ obj.customItems = items => {
492
+ const activeItem = items[0];
493
+ const name = activeItem.data.name;
494
+ return this.formatedDataByName[name].map(item => {
495
+ return {
496
+ color: this.colorMap[item.group_name] || CHART_STYLE_COLORS[0],
497
+ data: item,
498
+ name: !item.group_name && typeof item.group_name !== 'number' ? intl.get(EMPTY_NAME) : item.group_name,
499
+ title: item.name,
500
+ value: BaseUtils.getSummaryValueDisplayString(summaryColumn, item.value, y_axis_summary_method)
501
+ };
502
+ });
503
+ };
504
+ }
505
+ return obj;
467
506
  };
468
- this.setToolTip = () => {
469
- const settings = this.getToolTipSettings();
507
+ this.setToolTip = (isGroup, summaryColumn, y_axis_summary_method) => {
508
+ const settings = this.getToolTipSettings(isGroup, summaryColumn, y_axis_summary_method);
470
509
  this.chart.tooltip(settings);
471
510
  };
472
511
  this.setToolTipForLine = () => {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { debounce, maxBy } from 'lodash-es';
3
+ import { debounce, maxBy, throttle } from 'lodash-es';
4
4
  import classNames from 'classnames';
5
5
  import { CHART_TYPE, EMPTY_NAME } from '../../constants';
6
6
  import { BaseUtils, isFunction } from '../../utils';
@@ -62,13 +62,14 @@ class HorizontalBarGroup extends HorizontalComponent {
62
62
  label_font_size,
63
63
  type
64
64
  } = chart.config;
65
+ const isGroup = type === CHART_TYPE.HORIZONTAL_GROUP_BAR;
65
66
  const chartBarColor = this.groupName;
66
67
  const newData = this.getChartGroupData(data);
67
68
  let singleBarWidth, singleBarRadius;
68
69
  // y-axis label width:(6 + 10)
69
70
  // topPadding and legend height
70
71
  const chartHeight = this.chart.height - 6 - 10 - this.chartTopPadding - 30;
71
- if (type === CHART_TYPE.STACKED_HORIZONTAL_BAR) {
72
+ if (!isGroup) {
72
73
  singleBarWidth = Math.round(chartHeight / (2 * newData.length));
73
74
  this.markFirstOrLast(data, 'last');
74
75
  } else {
@@ -81,21 +82,34 @@ class HorizontalBarGroup extends HorizontalComponent {
81
82
  // set Coord type
82
83
  this.chart.coordinate('rect');
83
84
  this.autoAdjustDataOptions(chart, data, summaryColumn);
84
- const adjust = type === CHART_TYPE.STACKED_HORIZONTAL_BAR ? {
85
+ const adjust = !isGroup ? {
85
86
  type: 'stack'
86
87
  } : {
87
88
  type: 'dodge',
88
89
  marginRatio: 0
89
90
  };
90
- this.chart.interval().label(display_data ? 'value' : false, {
91
- formatter: value => {
92
- return value;
91
+ this.setColorMap(data);
92
+ this.chart.interval().animate({
93
+ // custom update animation
94
+ update: {
95
+ animation: 'fadeIn',
96
+ duration: 1000,
97
+ easing: 'easeLinear'
98
+ }
99
+ }).label(display_data ? 'value' : false, {
100
+ content: data => {
101
+ if (this.currentName) {
102
+ return data.name === this.currentName ? data.value : '';
103
+ }
104
+ return data.value;
93
105
  },
94
106
  style: {
95
107
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
96
108
  fill: theme.labelColor
97
109
  }
98
- }).position('name*value').size(singleBarWidth).color(chartBarColor).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
110
+ }).position('name*value').size(singleBarWidth).color(chartBarColor, group_name => {
111
+ return this.colorMap[group_name];
112
+ }).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
99
113
  return {
100
114
  title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
101
115
  value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, horizontal_axis_summary_method),
@@ -125,12 +139,28 @@ class HorizontalBarGroup extends HorizontalComponent {
125
139
  };
126
140
  }
127
141
  });
128
- this.setToolTip();
142
+ if (isGroup) {
143
+ this.formatDataByName(data);
144
+ }
145
+ this.setToolTip(isGroup, summaryColumn, horizontal_axis_summary_method);
129
146
  this.setNameLabelAndTooltip(theme, this.labelCount);
130
147
  this.setValueLabel(theme);
131
148
  this.chart.coordinate().transpose();
132
149
  this.setLegend(this.groupName, theme, 'top-right');
133
- this.chart.interaction('element-highlight');
150
+ this.chart.interaction('element-highlight-by-x');
151
+ if (display_data) {
152
+ this.chart.on('element:mouseenter', throttle(e => {
153
+ const currentName = e.data.data.name;
154
+ if (this.currentName && this.currentName === currentName) return;
155
+ this.currentName = currentName;
156
+ this.chart.render(true);
157
+ }, 500));
158
+ this.chart.on('element:mouseleave', throttle(e => {
159
+ if (!this.currentName) return;
160
+ this.currentName = null;
161
+ this.chart.render(true);
162
+ }, 500));
163
+ }
134
164
  };
135
165
  this.chart = null;
136
166
  this.groupName = 'group_name';
@@ -71,7 +71,9 @@ class LineGroup extends ChartComponent {
71
71
  const line = this.chart.line().label(y_axis_show_value ? 'value' : false, {
72
72
  style: {
73
73
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
74
- fill: theme.labelColor
74
+ fill: theme.labelColor,
75
+ stroke: '#fff',
76
+ lineWidth: 1
75
77
  }
76
78
  }).animate({
77
79
  appear: {
@@ -71,7 +71,9 @@ class Line extends ChartComponent {
71
71
  const line = this.chart.line().label(y_axis_show_value ? 'value' : false, {
72
72
  style: {
73
73
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
74
- fill: theme.labelColor
74
+ fill: theme.labelColor,
75
+ stroke: '#fff',
76
+ lineWidth: 1
75
77
  }
76
78
  }).animate({
77
79
  appear: {
@@ -1,9 +1,9 @@
1
1
  import React, { PureComponent } from 'react';
2
+ import intl from '../../../intl';
3
+ import { eventStopPropagation } from '../../../utils';
2
4
  import TwoDimensionTable from './two-dimension-table';
3
5
  import OneDimensionTableNoNumericColumns from './one-dimension-table-no-numeric-columns';
4
6
  import OneDimensionTableWithNumericColumns from './one-dimension-table-with-numeric-columns';
5
- import intl from '../../../intl';
6
- import { eventStopPropagation } from '../../../utils';
7
7
  import './index.css';
8
8
  class Table extends PureComponent {
9
9
  constructor() {
@@ -1,8 +1,8 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import classnames from 'classnames';
3
- import PivotTableDisplayName from './pivot-table-display-name';
4
3
  import { BaseUtils, ObjectUtils } from '../../../utils';
5
4
  import intl from '../../../intl';
5
+ import PivotTableDisplayName from './pivot-table-display-name';
6
6
  class OneDimensionTableNoNumericColumns extends PureComponent {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -64,7 +64,8 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
64
64
  chart
65
65
  } = this.props;
66
66
  const {
67
- display_total = true
67
+ display_total = true,
68
+ display_empty
68
69
  } = chart.config;
69
70
  const {
70
71
  pivot_rows,
@@ -81,7 +82,7 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
81
82
  // eslint-disable-next-line
82
83
  const total = ObjectUtils.hasOwnProperty(pivot_columns_total, 'total') ? pivot_columns_total['total'] : 0;
83
84
  const summaryDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, total);
84
- const isValidSummaryDisplayValue = BaseUtils.isValidValue(summaryDisplayValue);
85
+ const isValidSummaryDisplayValue = BaseUtils.isValidValue(summaryDisplayValue, display_empty);
85
86
  return /*#__PURE__*/React.createElement("tbody", null, pivotRowsLen > 0 && pivot_rows.map((rowItem, rowIdx) => {
86
87
  const {
87
88
  name,
@@ -95,7 +96,7 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
95
96
  let isSelectedTotalCellLeft = selectRowIdx === rowIdx && selectedCellIdx === 0;
96
97
  pivotColumnCells[rowIdx] = rows;
97
98
  const totalDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, total.total);
98
- const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue);
99
+ const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue, display_empty);
99
100
  return /*#__PURE__*/React.createElement("tr", {
100
101
  key: 'table-row-' + rowIdx
101
102
  }, /*#__PURE__*/React.createElement("td", {
@@ -1,8 +1,8 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import classnames from 'classnames';
3
- import PivotTableDisplayName from './pivot-table-display-name';
4
3
  import { BaseUtils } from '../../../utils';
5
4
  import intl from '../../../intl';
5
+ import PivotTableDisplayName from './pivot-table-display-name';
6
6
  class OneDimensionTableWithNumericColumns extends PureComponent {
7
7
  constructor(_props) {
8
8
  super(_props);
@@ -91,7 +91,8 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
91
91
  chart
92
92
  } = this.props;
93
93
  const {
94
- display_total = true
94
+ display_total = true,
95
+ display_empty
95
96
  } = chart.config;
96
97
  const {
97
98
  pivot_rows,
@@ -133,7 +134,7 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
133
134
  } = columnMap;
134
135
  const column = chartTableColumns.find(item => item.key === key);
135
136
  const displayValue = BaseUtils.getSummaryValueDisplayString(column, total[key], this.summaryColumnsMethodMap[key]);
136
- const isValidDisplayValue = BaseUtils.isValidValue(displayValue);
137
+ const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
137
138
  if (Array.isArray(rows) && rows.length > 0) {
138
139
  if (pivotColumnCells[cellIdx]) {
139
140
  pivotColumnCells[cellIdx].push(...rows);
@@ -167,7 +168,7 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
167
168
  const pivotColumnTotal = pivot_columns_total[c.key];
168
169
  const column = chartTableColumns.find(column => column.key === c.key);
169
170
  const totalDisplayValue = BaseUtils.getSummaryValueDisplayString(column, pivotColumnTotal, this.summaryColumnsMethodMap[c.key]);
170
- const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue);
171
+ const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue, display_empty);
171
172
  const isSelectRowTotalCell = selectRowIdx === pivot_rows.length && selectedCellIdx === index;
172
173
  const isSelectRowTotalCellLeft = selectRowIdx === pivot_rows.length && selectedCellIdx - 1 === index;
173
174
  return /*#__PURE__*/React.createElement("td", {
@@ -1,8 +1,8 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import classnames from 'classnames';
3
- import PivotTableDisplayName from './pivot-table-display-name';
4
3
  import { BaseUtils } from '../../../utils';
5
4
  import intl from '../../../intl';
5
+ import PivotTableDisplayName from './pivot-table-display-name';
6
6
  class TwoDimensionTable extends PureComponent {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -108,7 +108,8 @@ class TwoDimensionTable extends PureComponent {
108
108
  chart
109
109
  } = this.props;
110
110
  const {
111
- display_total = true
111
+ display_total = true,
112
+ display_empty
112
113
  } = chart.config;
113
114
  const {
114
115
  pivot_rows,
@@ -125,7 +126,7 @@ class TwoDimensionTable extends PureComponent {
125
126
  const isSelectRowTotalCellRight = selectRowIdx === pivotRowsLen && selectedCellIdx === 0;
126
127
  const isSelectTotal = selectRowIdx === pivotRowsLen && selectedCellIdx === (Array.isArray(pivot_columns) ? pivot_columns.length : 0);
127
128
  const tableTotalDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, pivot_table_total, summaryMethod);
128
- const isValidTableTotalDisplayValue = BaseUtils.isValidValue(tableTotalDisplayValue);
129
+ const isValidTableTotalDisplayValue = BaseUtils.isValidValue(tableTotalDisplayValue, display_empty);
129
130
  return /*#__PURE__*/React.createElement("tbody", null, pivotRowsLen > 0 && pivot_rows.map((rowItem, rowIdx) => {
130
131
  const {
131
132
  name,
@@ -141,7 +142,7 @@ class TwoDimensionTable extends PureComponent {
141
142
  pivotColumnCells[rowIdx] = rowItem.rows || [];
142
143
  }
143
144
  const summaryDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, total, summaryMethod);
144
- const isValidSummaryDisplayValue = BaseUtils.isValidValue(summaryDisplayValue);
145
+ const isValidSummaryDisplayValue = BaseUtils.isValidValue(summaryDisplayValue, display_empty);
145
146
  return /*#__PURE__*/React.createElement("tr", {
146
147
  key: 'table-row' + rowIdx
147
148
  }, /*#__PURE__*/React.createElement("td", {
@@ -160,7 +161,7 @@ class TwoDimensionTable extends PureComponent {
160
161
  total
161
162
  } = c;
162
163
  const displayValue = BaseUtils.getSummaryValueDisplayString(column, total, summaryMethod);
163
- const isValidDisplayValue = BaseUtils.isValidValue(displayValue);
164
+ const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
164
165
  if (c && Array.isArray(c.rows) && c.rows.length > 0) {
165
166
  pivotRowCells.push(...c.rows);
166
167
  if (pivotColumnCells[cellIdx]) {
@@ -210,7 +211,7 @@ class TwoDimensionTable extends PureComponent {
210
211
  const isSelectRowTotalCellLeft = selectRowIdx === pivot_rows.length && selectedCellIdx - 1 === index;
211
212
  const pivotColumnTotal = pivot_columns_total[c.key];
212
213
  const totalDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, pivotColumnTotal, summaryMethod);
213
- const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue);
214
+ const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue, display_empty);
214
215
  return /*#__PURE__*/React.createElement("td", {
215
216
  className: classnames('pivot-cell', {
216
217
  'pivot-empty-cell': !isValidTotalDisplayValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.26",
3
+ "version": "0.0.28beta",
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.30",
26
26
  "dtable-utils": "~4.4.*",
27
27
  "prop-types": "15.8.1",
28
28
  "react": "^17.0.0",