sea-chart 0.0.28 → 0.0.30

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 (36) hide show
  1. package/dist/constants/index.js +0 -1
  2. package/dist/constants/type-image.js +1 -1
  3. package/dist/locale/lang/de.js +1 -1
  4. package/dist/locale/lang/en.js +2 -1
  5. package/dist/locale/lang/es.js +1 -1
  6. package/dist/locale/lang/fr.js +1 -1
  7. package/dist/locale/lang/zh_CN.js +1 -0
  8. package/dist/model/basic-number-card.js +3 -2
  9. package/dist/model/chart.js +7 -9
  10. package/dist/model/compare-bar.js +1 -1
  11. package/dist/settings/advance-bar-settings/style-settings.js +42 -22
  12. package/dist/settings/bar-settings/style-settings.js +2 -2
  13. package/dist/settings/basic-number-card/data-settings.js +58 -21
  14. package/dist/settings/scatter/data-settings.js +1 -1
  15. package/dist/settings/style-settings.js +3 -12
  16. package/dist/settings/widgets/divider/index.js +8 -1
  17. package/dist/settings/widgets/y-axis-group-settings.js +4 -4
  18. package/dist/utils/chart-utils/base-utils.js +6 -2
  19. package/dist/utils/sql/chart-data-sql.js +26 -39
  20. package/dist/view/index.css +4 -0
  21. package/dist/view/title/index.js +2 -5
  22. package/dist/view/wrapper/bar-custom.js +3 -1
  23. package/dist/view/wrapper/bar-group.js +3 -1
  24. package/dist/view/wrapper/bar.js +12 -8
  25. package/dist/view/wrapper/basic-number-card.js +3 -1
  26. package/dist/view/wrapper/chart-component.js +4 -3
  27. package/dist/view/wrapper/combination.js +3 -1
  28. package/dist/view/wrapper/compare.js +5 -2
  29. package/dist/view/wrapper/completeness.js +3 -1
  30. package/dist/view/wrapper/horizontal-bar-group.js +3 -1
  31. package/dist/view/wrapper/horizontal-bar.js +12 -10
  32. package/dist/view/wrapper/map.js +3 -1
  33. package/dist/view/wrapper/mirror.js +3 -1
  34. package/dist/view/wrapper/scatter.js +3 -1
  35. package/dist/view/wrapper/world-map.js +4 -2
  36. package/package.json +2 -2
@@ -14,7 +14,6 @@ export const ZH_CN_SUPPORT_CHARTS = [CHART_TYPE.MAP, CHART_TYPE.MAP_BUBBLE];
14
14
  export const SUPPORT_DATA_SORT_CHART_TYPES = [CHART_TYPE.BAR, CHART_TYPE.BAR_STACK, CHART_TYPE.LINE, CHART_TYPE.PIE, CHART_TYPE.RING, CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.AREA, CHART_TYPE.TREE_MAP];
15
15
  export const SUPPORT_STACK_VALUE_CHART_TYPES = [CHART_TYPE.BAR_STACK, CHART_TYPE.BAR_CUSTOM];
16
16
  export const X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES = [CHART_TYPE.TABLE, CHART_TYPE.PIE, CHART_TYPE.RING, CHART_TYPE.TREE_MAP];
17
- export const SUPPORT_TITLE_CHART_TYPES = [CHART_TYPE.BAR, CHART_TYPE.BAR_GROUP, CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.HORIZONTAL_GROUP_BAR, CHART_TYPE.STACKED_HORIZONTAL_BAR, CHART_TYPE.COMPLETENESS, CHART_TYPE.COMPLETENESS_GROUP, CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.PIE, CHART_TYPE.RING, CHART_TYPE.COMBINATION, CHART_TYPE.DASHBOARD, CHART_TYPE.TREE_MAP, CHART_TYPE.TABLE, CHART_TYPE.BAR_CUSTOM, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP];
18
17
  export const CHART_CHART_MAP = {
19
18
  [CHART_TYPE.BAR]: CHART_TYPE.BAR,
20
19
  [CHART_TYPE.PIE]: CHART_TYPE.PIE,
@@ -8,7 +8,7 @@ export const CHART_TYPE_IMAGE = {
8
8
  [CHART_TYPE.HORIZONTAL_BAR]: 'horizontal-bar.png',
9
9
  [CHART_TYPE.HORIZONTAL_GROUP_BAR]: 'horizontal-group-bar.png',
10
10
  [CHART_TYPE.STACKED_HORIZONTAL_BAR]: 'stacked-horizontal-bar.png',
11
- [CHART_TYPE.COMPLETENESS]: 'combination-chart.png',
11
+ [CHART_TYPE.COMPLETENESS]: 'completeness-chart.png',
12
12
  [CHART_TYPE.COMPLETENESS_GROUP]: 'group-completeness-chart.png',
13
13
  [CHART_TYPE.LINE]: 'line.png',
14
14
  [CHART_TYPE.LINE_GROUP]: 'group_line.png',
@@ -167,7 +167,7 @@ const de = {
167
167
  'curves': 'Curves',
168
168
  'Line_type': 'Line type',
169
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',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
171
  'Display_empty_when_data_is_zero': 'Display empty when data is zero'
172
172
  };
173
173
  export default de;
@@ -129,6 +129,7 @@ const en = {
129
129
  "Table": 'Table',
130
130
  'Pivot_table': 'Pivot table',
131
131
  'Title': 'Title',
132
+ "Custom_title": "Custom title",
132
133
  'Edit_type': 'Edit type',
133
134
  'Cancel': 'Cancel',
134
135
  'Submit': 'Submit',
@@ -244,7 +245,7 @@ const en = {
244
245
  'curves': 'Curves',
245
246
  'Line_type': 'Line type',
246
247
  '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
+ 'Count_description': 'Count the number of records based on data settings',
248
249
  'Display_empty_when_data_is_zero': 'Display empty when data is zero'
249
250
  };
250
251
  export default en;
@@ -167,7 +167,7 @@ const es = {
167
167
  'curves': 'Curves',
168
168
  'Line_type': 'Line type',
169
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',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
171
  'Display_empty_when_data_is_zero': 'Display empty when data is zero'
172
172
  };
173
173
  export default es;
@@ -167,7 +167,7 @@ const fr = {
167
167
  'curves': 'Curves',
168
168
  'Line_type': 'Line type',
169
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',
170
+ 'Count_description': 'Count the number of records based on data settings',
171
171
  'Display_empty_when_data_is_zero': 'Display empty when data is zero'
172
172
  };
173
173
  export default fr;
@@ -129,6 +129,7 @@ const zh_CN = {
129
129
  "Table": '表格',
130
130
  "Pivot_table": "透视表",
131
131
  "Title": "标题",
132
+ "Custom_title": "自定义标题",
132
133
  "Edit_type": "编辑类型",
133
134
  'Cancel': '取消',
134
135
  'Submit': '提交',
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { generateChartConfig } from '../utils';
2
- import { HORIZONTAL_ALIGN, DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, SUPPORT_TITLE_CHART_TYPES } from '../constants';
2
+ import { HORIZONTAL_ALIGN, DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE } from '../constants';
3
3
  class ChartModel {
4
4
  constructor(options, tables) {
5
5
  const {
@@ -10,14 +10,12 @@ class ChartModel {
10
10
  this.type = 'statistic';
11
11
  this.config = generateChartConfig(options, tables);
12
12
  this.style_config = style_config || {};
13
- if (SUPPORT_TITLE_CHART_TYPES.includes(this.config.type)) {
14
- this.style_config.title = {
15
- text: '',
16
- font_size: DEFAULT_CHART_TITLE_FONT_SIZE,
17
- font_weight: DEFAULT_CHART_FONT_WEIGHT,
18
- horizontal_align: HORIZONTAL_ALIGN.LEFT
19
- };
20
- }
13
+ this.style_config.title = {
14
+ text: '',
15
+ font_size: DEFAULT_CHART_TITLE_FONT_SIZE,
16
+ font_weight: DEFAULT_CHART_FONT_WEIGHT,
17
+ horizontal_align: HORIZONTAL_ALIGN.LEFT
18
+ };
21
19
  }
22
20
  }
23
21
  export default ChartModel;
@@ -28,7 +28,7 @@ class CompareBar extends BaseModel {
28
28
  this.y_axis_compare_label_color = options.y_axis_compare_label_color;
29
29
  this.y_axis_compared_label_color = options.y_axis_compared_label_color;
30
30
  this.y_axis_summary_column_key = options.y_axis_summary_column_key;
31
- this.y_axis_summary_type = options.y_axis_summary_type;
31
+ this.y_axis_summary_type = options.y_axis_summary_type || 'count';
32
32
  this.y_axis_summary_method = options.y_axis_summary_method;
33
33
  this.display_increase = isBoolean(options.display_increase) ? options.display_increase : false;
34
34
  this.display_increase_percentage = isBoolean(options.display_increase_percentage) ? options.display_increase_percentage : false;
@@ -1,5 +1,5 @@
1
- import React, { useCallback, useMemo } from 'react';
2
- import { Label, FormGroup } from 'reactstrap';
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
+ import { Label, FormGroup, Input } from 'reactstrap';
3
3
  import DTableSelect from "dtable-ui-component/lib/DTableSelect";
4
4
  import DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
5
5
  import Switch from '../widgets/switch';
@@ -17,6 +17,25 @@ const StyleSettings = _ref => {
17
17
  yLabel,
18
18
  onChange
19
19
  } = _ref;
20
+ const {
21
+ config
22
+ } = chart;
23
+ const {
24
+ x_axis_show_label,
25
+ x_axis_label_position,
26
+ y_axis_show_label,
27
+ y_axis_label_position,
28
+ y_axis_auto_range = true,
29
+ type,
30
+ y_axis_min,
31
+ y_axis_max,
32
+ y_axis_show_value,
33
+ label_font_size,
34
+ display_each_block_data,
35
+ line_type,
36
+ title_name
37
+ } = config;
38
+ const [currYaxisTitle, setCurrYaxisTitle] = useState(title_name || '');
20
39
  const xAxisLabelOptions = useMemo(() => {
21
40
  if (xLabel === 'Vertical_axis') {
22
41
  return Y_LABEL_POSITIONS.map(item => {
@@ -125,30 +144,19 @@ const StyleSettings = _ref => {
125
144
  };
126
145
  onChange(update);
127
146
  }, [chart, onChange]);
128
- const {
129
- config
130
- } = chart;
131
- const {
132
- x_axis_show_label,
133
- x_axis_label_position,
134
- y_axis_show_label,
135
- y_axis_label_position,
136
- y_axis_auto_range = true,
137
- type,
138
- y_axis_min,
139
- y_axis_max,
140
- y_axis_show_value,
141
- label_font_size,
142
- display_each_block_data,
143
- line_type
144
- } = config;
147
+ const onKeyDown = useCallback(event => {
148
+ if (event.key === 'Enter') {
149
+ event.preventDefault();
150
+ event.target.blur();
151
+ }
152
+ }, []);
145
153
  const xAxisLabelPosition = xAxisLabelOptions.find(option => option.value === x_axis_label_position) || xAxisLabelOptions[0];
146
154
  const yAxisLabelPosition = yAxisLabelOptions.find(option => option.value === y_axis_label_position) || yAxisLabelOptions[0];
147
155
  const isLineChart = [CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP].includes(type);
148
- return /*#__PURE__*/React.createElement(React.Fragment, null, isLineChart && /*#__PURE__*/React.createElement(SelectLineType, {
156
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isLineChart && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SelectLineType, {
149
157
  selectedLineType: line_type,
150
158
  onChange: onChange
151
- }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
159
+ }), /*#__PURE__*/React.createElement(Divider, null)), /*#__PURE__*/React.createElement(FormGroup, {
152
160
  className: "sea-chart-parameter-item"
153
161
  }, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
154
162
  key: "x_axis_show_label",
@@ -166,7 +174,19 @@ const StyleSettings = _ref => {
166
174
  checked: y_axis_show_label || false,
167
175
  placeholder: intl.get('Display_title'),
168
176
  onChange: event => onAxisLabelShowChange(event, 'y_axis_show_label')
169
- }), y_axis_show_label && /*#__PURE__*/React.createElement("div", {
177
+ }), y_axis_show_label && [CHART_TYPE.BAR_STACK].includes(type) && /*#__PURE__*/React.createElement("div", {
178
+ className: "sea-chart-parameter-container"
179
+ }, /*#__PURE__*/React.createElement(Label, null, intl.get('Custom_title')), /*#__PURE__*/React.createElement(Input, {
180
+ type: "text",
181
+ value: currYaxisTitle,
182
+ onBlur: () => {
183
+ onChange({
184
+ 'title_name': currYaxisTitle
185
+ });
186
+ },
187
+ onChange: event => setCurrYaxisTitle(event.target.value),
188
+ onKeyDown: onKeyDown
189
+ })), y_axis_show_label && /*#__PURE__*/React.createElement("div", {
170
190
  className: "sea-chart-parameter-container"
171
191
  }, /*#__PURE__*/React.createElement(DTableSelect, {
172
192
  value: yAxisLabelPosition,
@@ -136,10 +136,10 @@ const StyleSettings = _ref => {
136
136
  const xAxisLabelPosition = xAxisLabelOptions.find(option => option.value === x_axis_label_position) || xAxisLabelOptions[0];
137
137
  const yAxisLabelPosition = yAxisLabelOptions.find(option => option.value === y_axis_label_position) || yAxisLabelOptions[0];
138
138
  const isLineChart = [CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP].includes(type);
139
- return /*#__PURE__*/React.createElement(React.Fragment, null, isLineChart && /*#__PURE__*/React.createElement(SelectLineType, {
139
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isLineChart && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SelectLineType, {
140
140
  selectedLineType: line_type,
141
141
  onChange: onChange
142
- }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
142
+ }), /*#__PURE__*/React.createElement(Divider, null)), /*#__PURE__*/React.createElement(FormGroup, {
143
143
  className: "sea-chart-parameter-item"
144
144
  }, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
145
145
  key: "x_axis_show_label",
@@ -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;
@@ -130,7 +130,7 @@ export default function ScatterDataSettings(_ref) {
130
130
  tables: tables,
131
131
  type: type,
132
132
  className: "selected-x-axis",
133
- label: intl.get('X_axis'),
133
+ label: intl.get('Y_axis'),
134
134
  selectedTableId: table_id,
135
135
  selectedColumnKey: y_axis_column_key,
136
136
  onGroupByChange: onYAxisColumnChange
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback } from 'react';
2
- import { CHART_TYPE, SUPPORT_TITLE_CHART_TYPES } from '../constants';
2
+ import { CHART_TYPE } from '../constants';
3
3
  import { BarStyleSettings } from './bar-settings';
4
4
  import { AdvanceBarStyleSettings } from './advance-bar-settings';
5
5
  import { TimeComparisonStyleSettings } from './time-comparison-settings';
@@ -28,12 +28,6 @@ const StyleSettings = _ref => {
28
28
  config: newUpdate
29
29
  });
30
30
  }, [chart, onChange]);
31
-
32
- // const modifyCommonSettings = useCallback((update) => {
33
- // const newUpdate = { ...chart.style_config, ...update };
34
- // onChange({ style_config: newUpdate });
35
- // }, [chart, onChange]);
36
-
37
31
  const modifyTitle = useCallback(title => {
38
32
  const {
39
33
  style_config
@@ -49,17 +43,14 @@ const StyleSettings = _ref => {
49
43
  });
50
44
  }, [chart, onChange]);
51
45
  const renderTitleSettings = useCallback(() => {
52
- const {
53
- type
54
- } = chart.config;
55
46
  const {
56
47
  style_config
57
48
  } = chart;
58
- return /*#__PURE__*/React.createElement(React.Fragment, null, SUPPORT_TITLE_CHART_TYPES.includes(type) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StatisticTitleSetting, {
49
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StatisticTitleSetting, {
59
50
  key: "title-setting-".concat(chart.id),
60
51
  title: style_config && style_config.title,
61
52
  modifyTitle: modifyTitle
62
- }), /*#__PURE__*/React.createElement(Divider, null)));
53
+ }), /*#__PURE__*/React.createElement(Divider, null));
63
54
  }, [chart, modifyTitle]);
64
55
  const renderStatisticStyleSettings = useCallback(() => {
65
56
  const {
@@ -1,11 +1,18 @@
1
- import React from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import './index.css';
4
4
  const Divider = _ref => {
5
5
  let {
6
6
  className
7
7
  } = _ref;
8
+ const dividerRef = useRef(null);
9
+ useEffect(() => {
10
+ if (!dividerRef.current.nextElementSibling) {
11
+ dividerRef.current.style.display = 'none';
12
+ }
13
+ }, []);
8
14
  return /*#__PURE__*/React.createElement("div", {
15
+ ref: dividerRef,
9
16
  className: classnames('sea-chart-divider', className)
10
17
  });
11
18
  };
@@ -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);
@@ -76,7 +80,7 @@ BaseUtils.isValidExistChart = (tables, chart) => {
76
80
  // if current chart is using "groupby_column_key" as key
77
81
  // if groupby_column_key is null, still return false
78
82
  let groupByColumnKey = config.groupby_column_key || config.x_axis_column_key || config.vertical_axis_column_key || config.columnKey || config.date_column_key;
79
- if ([CHART_TYPE.BAR, CHART_TYPE.BAR_GROUP, CHART_TYPE.BAR_CUSTOM, CHART_TYPE.BAR_STACK, CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP].includes(config.type)) {
83
+ if ([CHART_TYPE.BAR, CHART_TYPE.BAR_GROUP, CHART_TYPE.BAR_CUSTOM, CHART_TYPE.BAR_STACK, CHART_TYPE.COMPARE_BAR, CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP, CHART_TYPE.SCATTER, CHART_TYPE.COMBINATION].includes(config.type)) {
80
84
  groupByColumnKey = config.x_axis_column_key;
81
85
  }
82
86
  if ([CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.HORIZONTAL_GROUP_BAR, CHART_TYPE.STACKED_HORIZONTAL_BAR].includes(config.type)) {
@@ -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
  /*
@@ -188,37 +188,6 @@ class ChartDataSQL {
188
188
  }
189
189
  return sqlString;
190
190
  };
191
- this._compare_chart_statistic_2_sql = () => {
192
- const {
193
- x_axis_column_key,
194
- y_axis_summary_type,
195
- y_axis_column_key,
196
- x_axis_geolocation_granularity,
197
- y_axis_summary_method,
198
- x_axis_include_empty_cells
199
- } = this.chart;
200
- const selectedTable = this.table;
201
- const selectedColumn = this._get_column_by_key(x_axis_column_key);
202
- const isAdvanced = y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED;
203
- const method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[y_axis_summary_method] : DTABLE_DB_SUMMARY_METHOD.COUNT;
204
- let groupName = getSqlGroup(selectedColumn, {
205
- 'date_granularity': 'day',
206
- 'geolocation_granularity': x_axis_geolocation_granularity
207
- });
208
- const sqlOrder = this._get_sql_order_by(null, groupName);
209
- let selectedSummaryColumn = {};
210
- selectedSummaryColumn = this._get_column_by_key(y_axis_column_key);
211
- if (isAdvanced) {
212
- if (!selectedSummaryColumn) {
213
- this.error = 'Group_by_column_not_found';
214
- return '';
215
- }
216
- }
217
- const summary_column = this.columnKeyMap[x_axis_column_key];
218
- const summaryColumnMethod = this._summary_column_2_sql(method, summary_column);
219
- this._update_filter_sql(x_axis_include_empty_cells, selectedColumn);
220
- return "SELECT ".concat(groupName, ", ").concat(summaryColumnMethod, " FROM `").concat(selectedTable.name, "` ").concat(this.filter_sql, " GROUP BY ").concat(groupName, " ").concat(sqlOrder, " LIMIT 0, 5000");
221
- };
222
191
  this._grouping_statistic_2_sql = () => {
223
192
  let x_axis_column_key, x_axis_date_granularity, x_axis_geolocation_granularity, x_axis_include_empty_cells, y_axis_summary_type, y_axis_summary_method, y_axis_summary_column_key;
224
193
  if ([CHART_TYPE.HORIZONTAL_GROUP_BAR, CHART_TYPE.STACKED_HORIZONTAL_BAR].includes(this.chart_type)) {
@@ -390,11 +359,14 @@ class ChartDataSQL {
390
359
  x_axis_geolocation_granularity,
391
360
  y_axis_summary_method
392
361
  } = this.chart;
393
- const selectedTable = this.table;
394
- const selectedColumn = this._get_column_by_key(x_axis_column_key);
362
+ const groupby_column = this._get_column_by_key(x_axis_column_key);
363
+ if (!groupby_column) {
364
+ this.error = 'Group_by_column_not_found';
365
+ return '';
366
+ }
395
367
  const isAdvanced = y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED;
396
368
  const method = isAdvanced ? DTABLE_DB_SUMMARY_METHOD[y_axis_summary_method] : DTABLE_DB_SUMMARY_METHOD.COUNT;
397
- let groupName = getSqlGroup(selectedColumn, {
369
+ let groupName = getSqlGroup(groupby_column, {
398
370
  'date_granularity': 'day',
399
371
  'geolocation_granularity': x_axis_geolocation_granularity
400
372
  });
@@ -403,14 +375,14 @@ class ChartDataSQL {
403
375
  selectedSummaryColumn = this._get_column_by_key(y_axis_column_key);
404
376
  if (isAdvanced) {
405
377
  if (!selectedSummaryColumn) {
406
- this.error = 'Group_by_column_not_found';
378
+ this.error = 'Summary_column_not_found';
407
379
  return '';
408
380
  }
409
381
  }
410
- const summary_column = this.columnKeyMap[x_axis_column_key];
382
+ const summary_column = this._get_column_by_key(x_axis_column_key);
411
383
  const summaryColumnMethod = this._summary_column_2_sql(method, summary_column);
412
384
  const sqlCondition = filter2SqlCondition(this.table, this.chart);
413
- return "SELECT ".concat(groupName, ", ").concat(summaryColumnMethod, " FROM `").concat(selectedTable.name, "` ").concat(sqlCondition, " GROUP BY ").concat(groupName, " ").concat(sqlOrder, " LIMIT 0, 5000");
385
+ return "SELECT ".concat(groupName, ", ").concat(summaryColumnMethod, " FROM ").concat(this.table_name, " ").concat(sqlCondition, " GROUP BY ").concat(groupName, " ").concat(sqlOrder, " LIMIT 0, 5000");
414
386
  };
415
387
  this._combination_chart_statistic_2_sql = () => {
416
388
  const x_axis_column_key = this.chart['x_axis_column_key'] || '';
@@ -678,6 +650,10 @@ class ChartDataSQL {
678
650
  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
651
  };
680
652
  this._basic_number_card_chart_statistic_2_sql = () => {
653
+ const summary_type = this.chart['summary_type'];
654
+ if (summary_type === CHART_Y_GROUP_TYPE.COUNT) {
655
+ return "SELECT COUNT(*) FROM ".concat(this.table_name, " ").concat(this.filter_sql, " LIMIT 0, 5000");
656
+ }
681
657
  const numeric_column_key = this.chart['numeric_column_key'] || '';
682
658
  let summary_method = this.chart['summary_method'] || '';
683
659
  const numeric_column = this._get_column_by_key(numeric_column_key);
@@ -744,7 +720,14 @@ class ChartDataSQL {
744
720
  }
745
721
  const targetColumnName = (_this$_get_column_by_ = this._get_column_by_key(targetColumnKey)) === null || _this$_get_column_by_ === void 0 ? void 0 : _this$_get_column_by_.name;
746
722
  const completedColumnName = (_this$_get_column_by_2 = this._get_column_by_key(completedColumnKey)) === null || _this$_get_column_by_2 === void 0 ? void 0 : _this$_get_column_by_2.name;
747
- if (!targetColumnName || !completedColumnName) return;
723
+ if (!completedColumnName) {
724
+ this.error = 'Completed_column_not_found';
725
+ return '';
726
+ }
727
+ if (!targetColumnName) {
728
+ this.error = 'Target_column_not_found';
729
+ return '';
730
+ }
748
731
  if (column_groupby_column_key) {
749
732
  const column_groupby_column = this._get_column_by_key(column_groupby_column_key);
750
733
  if (!column_groupby_column) {
@@ -778,6 +761,10 @@ class ChartDataSQL {
778
761
  // y axis column
779
762
  const y_axis_column = this._get_column_by_key(y_axis_column_key);
780
763
  const yAxisColumnName = y_axis_column === null || y_axis_column === void 0 ? void 0 : y_axis_column.name;
764
+ if (!yAxisColumnName) {
765
+ this.error = 'Y_axis_column_not_found';
766
+ return '';
767
+ }
781
768
  if (column_groupby_column_key) {
782
769
  const column_groupby_column = this._get_column_by_key(column_groupby_column_key);
783
770
  if (!column_groupby_column) {
@@ -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;
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { isNumber } from 'dtable-utils';
3
3
  import classnames from 'classnames';
4
- import { HORIZONTAL_ALIGNS, HORIZONTAL_ALIGN, DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS, SUPPORT_TITLE_CHART_TYPES } from '../../constants';
4
+ import { HORIZONTAL_ALIGNS, HORIZONTAL_ALIGN, DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS } from '../../constants';
5
5
  import './index.css';
6
6
  const Title = _ref => {
7
7
  let {
@@ -35,12 +35,9 @@ const Title = _ref => {
35
35
  return style;
36
36
  }, [chart]);
37
37
  if (!chart) return null;
38
- const {
39
- type: chartType
40
- } = chart.config;
41
38
  const title = chart.style_config && chart.style_config.title;
42
39
  const text = title && title.text;
43
- if (!SUPPORT_TITLE_CHART_TYPES.includes(chartType) || !text) return null;
40
+ if (!text) return null;
44
41
  const style = getTitleStyle();
45
42
  return /*#__PURE__*/React.createElement("div", {
46
43
  className: classnames('sea-chart-title', className),
@@ -125,7 +125,9 @@ class BarCustom extends ChartComponent {
125
125
  let labelCfg = {
126
126
  style: {
127
127
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
128
- fill: themeColors.labelColor
128
+ fill: themeColors.labelColor,
129
+ stroke: '#fff',
130
+ lineWidth: 1
129
131
  }
130
132
  };
131
133
  if (displayData) {
@@ -155,7 +155,9 @@ class BarGroup extends ChartComponent {
155
155
  },
156
156
  style: {
157
157
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
158
- fill: theme.labelColor
158
+ fill: theme.labelColor,
159
+ stroke: '#fff',
160
+ lineWidth: 1
159
161
  },
160
162
  position: type === CHART_TYPE.BAR_STACK ? 'middle' : ''
161
163
  }).position('name*value').size(singleBarWidth).color(chartBarColor, group_name => {
@@ -78,9 +78,18 @@ class Bar extends ChartComponent {
78
78
  this.chart.interval().label(y_axis_show_value ? 'value' : false, {
79
79
  style: {
80
80
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
81
- fill: theme.labelColor
81
+ fill: theme.labelColor,
82
+ stroke: '#fff',
83
+ lineWidth: 1
82
84
  }
83
- }).position('name*value').size(singleBarWidth).tooltip('name*value', (name, value) => {
85
+ }).position('name*value').size(singleBarWidth).color('value', value => {
86
+ const color = getLabelColor({
87
+ chart: chart.config,
88
+ colorRules,
89
+ value
90
+ });
91
+ return color || chartBarColor;
92
+ }).tooltip('name*value', (name, value) => {
84
93
  return {
85
94
  title: y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT ? intl.get('Amount') : intl.get(CHART_SUMMARY_SHOW[y_axis_summary_method]),
86
95
  value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
@@ -93,16 +102,11 @@ class Bar extends ChartComponent {
93
102
  }
94
103
  }
95
104
  }).style('value', value => {
96
- const color = getLabelColor({
97
- chart: chart.config,
98
- colorRules,
99
- value
100
- });
101
105
  return {
102
- fill: color || chartBarColor,
103
106
  radius: [singleBarRadius, singleBarRadius, 0, 0]
104
107
  };
105
108
  });
109
+ this.chart.legend(false);
106
110
  this.setToolTip();
107
111
  isFunction(customRender) && customRender(this.chart);
108
112
  this.setNameLabelAndTooltip(theme, this.labelCount);
@@ -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
  }
@@ -444,7 +444,7 @@ export default class ChartComponent extends Component {
444
444
  domStyles: {
445
445
  'g2-tooltip': {
446
446
  boxSizing: 'border-box',
447
- width: '178px',
447
+ minWidth: '178px',
448
448
  borderRadius: '3px',
449
449
  border: '1px solid #e2e2e2',
450
450
  backgroundColor: '#fff',
@@ -465,7 +465,8 @@ export default class ChartComponent extends Component {
465
465
  textOverflow: 'ellipsis'
466
466
  },
467
467
  'g2-tooltip-list-item': {
468
- marginBottom: '8px'
468
+ marginBottom: '8px',
469
+ display: 'flex'
469
470
  },
470
471
  'g2-tooltip-marker': {
471
472
  width: '12px',
@@ -476,7 +477,7 @@ export default class ChartComponent extends Component {
476
477
  'g2-tooltip-name': {
477
478
  display: 'inline-block',
478
479
  fontSize: '12px',
479
- maxWidth: '80px',
480
+ minWidth: '80px',
480
481
  whiteSpace: 'nowrap',
481
482
  overflow: 'hidden',
482
483
  lineHeight: '12px',
@@ -91,7 +91,9 @@ class Combination extends React.Component {
91
91
  this.chart.axis('name', {
92
92
  label: {
93
93
  style: {
94
- fill: theme.textColor
94
+ fill: theme.textColor,
95
+ stroke: '#fff',
96
+ lineWidth: 1
95
97
  },
96
98
  formatter: name => {
97
99
  const isString = typeof name === 'string';
@@ -38,7 +38,6 @@ class Compare extends ChartComponent {
38
38
  this.loadData(data);
39
39
  this.draw(data);
40
40
  this.chart.render();
41
- this.renderAxisLabel(this.props.chart, this.props.tables);
42
41
  };
43
42
  this.draw = data => {
44
43
  const {
@@ -84,7 +83,9 @@ class Compare extends ChartComponent {
84
83
  this.chart.interval().label(display_data ? 'formatted_value' : false, {
85
84
  style: {
86
85
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
87
- fill: themeColors.textColor
86
+ fill: themeColors.textColor,
87
+ stroke: '#fff',
88
+ lineWidth: 1
88
89
  }
89
90
  }).position('name*value').color('group_name', currentTheme && currentTheme.colors).tooltip('name*formatted_value*raw_name', (name, value, raw_name) => {
90
91
  const nameContent = !raw_name && typeof raw_name !== 'number' ? intl.get(EMPTY_NAME) : raw_name;
@@ -234,12 +235,14 @@ class Compare extends ChartComponent {
234
235
  componentDidMount() {
235
236
  this.createChart();
236
237
  this.drawChart();
238
+ this.renderAxisLabel(this.props.chart, this.props.tables);
237
239
  }
238
240
  componentDidUpdate(prevProps) {
239
241
  if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
240
242
  this.chart && this.chart.destroy();
241
243
  this.createChart();
242
244
  this.drawChart();
245
+ this.renderAxisLabel(this.props.chart, this.props.tables);
243
246
  }
244
247
  }
245
248
  componentWillUnmount() {
@@ -123,7 +123,9 @@ export default function Completeness(props) {
123
123
  },
124
124
  style: {
125
125
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
126
- fill: theme.labelColor
126
+ fill: theme.labelColor,
127
+ stroke: '#fff',
128
+ lineWidth: 1
127
129
  }
128
130
  }).position('name*value').size(singleBarWidth).color(colorField, colorFieldCb).adjust(adjustType).tooltip('name*group_name*value', (name, group_name, value) => {
129
131
  return {
@@ -105,7 +105,9 @@ class HorizontalBarGroup extends HorizontalComponent {
105
105
  },
106
106
  style: {
107
107
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
108
- fill: theme.labelColor
108
+ fill: theme.labelColor,
109
+ stroke: '#fff',
110
+ lineWidth: 1
109
111
  }
110
112
  }).position('name*value').size(singleBarWidth).color(chartBarColor, group_name => {
111
113
  return this.colorMap[group_name];
@@ -76,11 +76,18 @@ class HorizontalBar extends HorizontalComponent {
76
76
  this.chart.interval().label(display_data ? 'value' : false, {
77
77
  style: {
78
78
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
79
- fill: theme.labelColor
79
+ fill: theme.labelColor,
80
+ stroke: '#fff',
81
+ lineWidth: 1
80
82
  }
81
- }).position('name*value')
82
- // .color(chartBarColor)
83
- .size(singleBarWidth).tooltip('name*value', (name, value) => {
83
+ }).position('name*value').color('value', value => {
84
+ const color = getLabelColor({
85
+ chart: chart.config,
86
+ colorRules,
87
+ value
88
+ });
89
+ return color || chartBarColor;
90
+ }).size(singleBarWidth).tooltip('name*value', (name, value) => {
84
91
  return {
85
92
  title: horizontal_axis_summary_type === CHART_SUMMARY_TYPE.COUNT ? intl.get('Amount') : intl.get(CHART_SUMMARY_SHOW[horizontal_axis_summary_method]),
86
93
  value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, horizontal_axis_summary_method),
@@ -93,16 +100,11 @@ class HorizontalBar extends HorizontalComponent {
93
100
  }
94
101
  }
95
102
  }).style('value', value => {
96
- const color = getLabelColor({
97
- chart: chart.config,
98
- colorRules,
99
- value
100
- });
101
103
  return {
102
- fill: color || chartBarColor,
103
104
  radius: [singleBarRadius, singleBarRadius, 0, 0]
104
105
  };
105
106
  });
107
+ this.chart.legend(false);
106
108
  this.setToolTip();
107
109
  this.setNameLabelAndTooltip(theme, this.labelCount);
108
110
  this.setValueLabel(theme);
@@ -168,7 +168,9 @@ export default function Map(props) {
168
168
  style: {
169
169
  // TODO
170
170
  // use data_color temporarily
171
- fill: data_color
171
+ fill: data_color,
172
+ stroke: '#fff',
173
+ lineWidth: 1
172
174
  },
173
175
  align: legendDirection === 'vertical' ? 'right' : 'bottom',
174
176
  formatter: value => {
@@ -71,7 +71,9 @@ class Mirror extends ChartComponent {
71
71
  },
72
72
  label: {
73
73
  style: {
74
- fill: themeColors.labelColor
74
+ fill: themeColors.labelColor,
75
+ stroke: '#fff',
76
+ lineWidth: 1
75
77
  },
76
78
  formatter: name => {
77
79
  let label = name;
@@ -83,7 +83,9 @@ export function Scatter(props) {
83
83
  currentChart.chart.point().position('name*value').label(y_axis_show_value ? 'value' : false, {
84
84
  style: {
85
85
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
86
- fill: theme.labelColor
86
+ fill: theme.labelColor,
87
+ stroke: '#fff',
88
+ lineWidth: 1
87
89
  }
88
90
  }).color('groupby', groupby => {
89
91
  if (groupby[0] === 'groupby') {
@@ -4,11 +4,11 @@ import { getNumberDisplayString } from 'dtable-utils';
4
4
  import PropTypes from 'prop-types';
5
5
  import { debounce } from 'lodash-es';
6
6
  import intl from '../../intl';
7
- import ChartComponent from './chart-component';
8
7
  import fetchMapJson from '../../services/map-json';
9
8
  import { BaseUtils, getMediaUrlForMap } from '../../utils';
10
9
  import { COLOR_OPTIONS } from '../../constants/color-rules';
11
10
  import { CHART_SUMMARY_TYPE, MAP_LEVEL, CHART_TYPE, TITLE_AMOUNT, DEFAULT_NUMBER_FORMAT_OBJECT } from '../../constants';
11
+ import ChartComponent from './chart-component';
12
12
  const WIDTH = 798;
13
13
  const HEIGHT = 394;
14
14
  class WorldMap extends ChartComponent {
@@ -221,7 +221,9 @@ class WorldMap extends ChartComponent {
221
221
  label: {
222
222
  spacing: 2,
223
223
  style: {
224
- fill: themeColors.textColor
224
+ fill: themeColors.textColor,
225
+ stroke: '#fff',
226
+ lineWidth: 1
225
227
  },
226
228
  align: legendDirection === 'vertical' ? 'right' : 'bottom',
227
229
  formatter: value => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
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.31",
26
26
  "dtable-utils": "~4.4.*",
27
27
  "prop-types": "15.8.1",
28
28
  "react": "^17.0.0",