sea-chart 0.0.19 → 0.0.21

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 (41) hide show
  1. package/dist/constants/index.js +4 -1
  2. package/dist/locale/lang/de.js +4 -1
  3. package/dist/locale/lang/en.js +6 -1
  4. package/dist/locale/lang/es.js +4 -1
  5. package/dist/locale/lang/fr.js +4 -1
  6. package/dist/locale/lang/pt.js +4 -1
  7. package/dist/locale/lang/ru.js +4 -1
  8. package/dist/locale/lang/zh_CN.js +9 -4
  9. package/dist/model/area-group.js +4 -2
  10. package/dist/model/area.js +3 -2
  11. package/dist/model/basic-number-card.js +5 -1
  12. package/dist/model/line-group.js +3 -2
  13. package/dist/model/line.js +3 -2
  14. package/dist/settings/advance-bar-settings/style-settings.js +8 -2
  15. package/dist/settings/bar-settings/style-settings.js +10 -3
  16. package/dist/settings/basic-number-card/style-settings.js +48 -3
  17. package/dist/settings/widgets/select-line-type/index.css +0 -0
  18. package/dist/settings/widgets/select-line-type/index.js +27 -0
  19. package/dist/view/index.css +16 -6
  20. package/dist/view/index.js +7 -5
  21. package/dist/view/wrapper/area.js +77 -41
  22. package/dist/view/wrapper/bar-custom.js +2 -2
  23. package/dist/view/wrapper/bar-group.js +2 -2
  24. package/dist/view/wrapper/bar.js +2 -2
  25. package/dist/view/wrapper/basic-number-card.js +6 -33
  26. package/dist/view/wrapper/chart-component.js +49 -3
  27. package/dist/view/wrapper/combination.js +1 -1
  28. package/dist/view/wrapper/compare.js +1 -1
  29. package/dist/view/wrapper/completeness.js +2 -2
  30. package/dist/view/wrapper/dashboard.js +1 -1
  31. package/dist/view/wrapper/horizontal-bar-group.js +2 -2
  32. package/dist/view/wrapper/horizontal-bar.js +4 -10
  33. package/dist/view/wrapper/line-group.js +64 -48
  34. package/dist/view/wrapper/line.js +69 -64
  35. package/dist/view/wrapper/map.js +1 -1
  36. package/dist/view/wrapper/pie.js +1 -1
  37. package/dist/view/wrapper/ring.js +2 -2
  38. package/dist/view/wrapper/scatter.js +1 -1
  39. package/dist/view/wrapper/treemap.js +1 -1
  40. package/dist/view/wrapper/world-map.js +1 -1
  41. package/package.json +1 -1
@@ -14,7 +14,7 @@ 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];
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
18
  export const CHART_CHART_MAP = {
19
19
  [CHART_TYPE.BAR]: CHART_TYPE.BAR,
20
20
  [CHART_TYPE.PIE]: CHART_TYPE.PIE,
@@ -74,6 +74,9 @@ export const CHART_DATA_SORT_TYPE = {
74
74
  ASCENDING: 'ascending',
75
75
  DESCENDING: 'descending'
76
76
  };
77
+ const POLYLINES = 'polylines';
78
+ const CURVES = 'curves';
79
+ export const CHART_LINE_TYPES = [POLYLINES, CURVES];
77
80
  export const CHART_DATA_SORT_TYPES = [CHART_DATA_SORT_TYPE.NOT_SORTED, CHART_DATA_SORT_TYPE.ASCENDING, CHART_DATA_SORT_TYPE.DESCENDING];
78
81
  export const CHART_DATA_SORT_TYPE_SHOW = {
79
82
  [CHART_DATA_SORT_TYPE.NOT_SORTED]: 'Not_sorted',
@@ -162,6 +162,9 @@ const de = {
162
162
  'Numeric_column_not_found': 'Numeric column not found',
163
163
  'Target_column_not_found': 'Target column not found',
164
164
  'Completed_column_not_found': 'Completed column not found',
165
- 'Target_summary_method_is_not_valid': 'Target summary method is not valid'
165
+ 'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
+ 'polylines': 'Polylines',
167
+ 'curves': 'Curves',
168
+ 'Line_type': 'Line type'
166
169
  };
167
170
  export default de;
@@ -237,6 +237,11 @@ const en = {
237
237
  "Previous_7_days": "Previous 7 days",
238
238
  "Previous_30_days": "Previous 30 days",
239
239
  "The_day_before_yesterday": "The day before yesterday",
240
- "Can_not_compare_with_{var}": "Can not compare with {var}"
240
+ "Can_not_compare_with_{var}": "Can not compare with {var}",
241
+ "Number_settings": "Number settings",
242
+ "Label_settings": "Label settings",
243
+ 'polylines': 'Polylines',
244
+ 'curves': 'Curves',
245
+ 'Line_type': 'Line type'
241
246
  };
242
247
  export default en;
@@ -162,6 +162,9 @@ const es = {
162
162
  'Numeric_column_not_found': 'Numeric column not found',
163
163
  'Target_column_not_found': 'Target column not found',
164
164
  'Completed_column_not_found': 'Completed column not found',
165
- 'Target_summary_method_is_not_valid': 'Target summary method is not valid'
165
+ 'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
+ 'polylines': 'Polylines',
167
+ 'curves': 'Curves',
168
+ 'Line_type': 'Line type'
166
169
  };
167
170
  export default es;
@@ -162,6 +162,9 @@ const fr = {
162
162
  'Numeric_column_not_found': 'Numeric column not found',
163
163
  'Target_column_not_found': 'Target column not found',
164
164
  'Completed_column_not_found': 'Completed column not found',
165
- 'Target_summary_method_is_not_valid': 'Target summary method is not valid'
165
+ 'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
+ 'polylines': 'Polylines',
167
+ 'curves': 'Curves',
168
+ 'Line_type': 'Line type'
166
169
  };
167
170
  export default fr;
@@ -162,6 +162,9 @@ const pt = {
162
162
  'Numeric_column_not_found': 'Numeric column not found',
163
163
  'Target_column_not_found': 'Target column not found',
164
164
  'Completed_column_not_found': 'Completed column not found',
165
- 'Target_summary_method_is_not_valid': 'Target summary method is not valid'
165
+ 'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
+ 'polylines': 'Polylines',
167
+ 'curves': 'Curves',
168
+ 'Line_type': 'Line type'
166
169
  };
167
170
  export default pt;
@@ -162,6 +162,9 @@ const ru = {
162
162
  'Numeric_column_not_found': 'Numeric column not found',
163
163
  'Target_column_not_found': 'Target column not found',
164
164
  'Completed_column_not_found': 'Completed column not found',
165
- 'Target_summary_method_is_not_valid': 'Target summary method is not valid'
165
+ 'Target_summary_method_is_not_valid': 'Target summary method is not valid',
166
+ 'polylines': 'Polylines',
167
+ 'curves': 'Curves',
168
+ 'Line_type': 'Line type'
166
169
  };
167
170
  export default ru;
@@ -105,9 +105,9 @@ const zh_CN = {
105
105
  "Stacked_bar_chart": "堆叠条形图",
106
106
  "Completeness": "完成度图",
107
107
  "Grouped_completeness": "分组完成度图",
108
- "Line_chart": "折线图",
109
- "Basic_line_chart": "基础折线图",
110
- "Grouped_line_chart": "分组折线图",
108
+ "Line_chart": "线型图",
109
+ "Basic_line_chart": "基础线型图",
110
+ "Grouped_line_chart": "分组线型图",
111
111
  "Area": "面积图",
112
112
  "Grouped_area": "分组面积图",
113
113
  "Pie_chart": "饼图",
@@ -237,6 +237,11 @@ const zh_CN = {
237
237
  "Previous_7_days": "之前 7 天",
238
238
  "Previous_30_days": "之前 30 天",
239
239
  "The_day_before_yesterday": "前天",
240
- "Can_not_compare_with_{var}": "无法和 {var} 比较"
240
+ "Can_not_compare_with_{var}": "无法和 {var} 比较",
241
+ "Number_settings": "数字设置",
242
+ "Label_settings": "标签设置",
243
+ 'polylines': '折线',
244
+ 'curves': '曲线',
245
+ 'Line_type': '线型'
241
246
  };
242
247
  export default zh_CN;
@@ -1,6 +1,6 @@
1
- import BaseModel from './base-model';
2
1
  import { isBoolean } from '../utils';
3
- import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
2
+ import { CHART_TYPE, CHART_SUMMARY_TYPE, CHART_LINE_TYPES } from '../constants';
3
+ import BaseModel from './base-model';
4
4
  class AreaGroup extends BaseModel {
5
5
  constructor(options) {
6
6
  super({
@@ -36,6 +36,8 @@ class AreaGroup extends BaseModel {
36
36
  this.summary_columns = options.summary_columns;
37
37
  this.y_axis_use_stack = options.y_axis_use_stack;
38
38
  this.label_font_size = options.label_font_size;
39
+ // default as curve
40
+ this.line_type = options.line_type || CHART_LINE_TYPES[1];
39
41
  }
40
42
  }
41
43
  export default AreaGroup;
@@ -1,6 +1,6 @@
1
- import BaseModel from './base-model';
2
1
  import { isBoolean } from '../utils';
3
- import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
2
+ import { CHART_TYPE, CHART_SUMMARY_TYPE, CHART_LINE_TYPES } from '../constants';
3
+ import BaseModel from './base-model';
4
4
  class Area extends BaseModel {
5
5
  constructor(options) {
6
6
  super({
@@ -27,6 +27,7 @@ class Area extends BaseModel {
27
27
  this.y_axis_label_color = options.y_axis_label_color;
28
28
  this.sort_type = options.sort_type;
29
29
  this.label_font_size = options.label_font_size;
30
+ this.line_type = options.line_type || CHART_LINE_TYPES[1];
30
31
  }
31
32
  }
32
33
  export default Area;
@@ -1,6 +1,6 @@
1
1
  import { isNumericColumn, getTableById, getTableColumnByKey } from 'dtable-utils';
2
- import BaseModel from './base-model';
3
2
  import { CHART_SUMMARY_TYPE, CHART_TYPE } from '../constants';
3
+ import BaseModel from './base-model';
4
4
  class BasicNumberCard extends BaseModel {
5
5
  constructor(options, tables) {
6
6
  super({
@@ -17,6 +17,10 @@ class BasicNumberCard extends BaseModel {
17
17
  }
18
18
  }
19
19
  this.summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.ROW_COUNT;
20
+ this.font_size = options.font_size || 40;
21
+ this.font_color = options.font_color;
22
+ this.label_font_size = options.label_font_size || 12;
23
+ this.label_font_color = options.label_font_color;
20
24
  }
21
25
  }
22
26
  export default BasicNumberCard;
@@ -1,6 +1,6 @@
1
- import BaseModel from './base-model';
2
1
  import { isBoolean } from '../utils';
3
- import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
2
+ import { CHART_TYPE, CHART_SUMMARY_TYPE, CHART_LINE_TYPES } from '../constants';
3
+ import BaseModel from './base-model';
4
4
  class LineGroup extends BaseModel {
5
5
  constructor(options) {
6
6
  super({
@@ -39,6 +39,7 @@ class LineGroup extends BaseModel {
39
39
  this.column_groupby_multiple_numeric_column = isBoolean(options.column_groupby_multiple_numeric_column) ? options.column_groupby_multiple_numeric_column : false;
40
40
  this.summary_columns = options.summary_columns;
41
41
  this.label_font_size = options.label_font_size;
42
+ this.line_type = options.line_type || CHART_LINE_TYPES[1];
42
43
  }
43
44
  }
44
45
  export default LineGroup;
@@ -1,6 +1,6 @@
1
- import BaseModel from './base-model';
2
1
  import { isBoolean } from '../utils';
3
- import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
2
+ import { CHART_TYPE, CHART_SUMMARY_TYPE, CHART_LINE_TYPES } from '../constants';
3
+ import BaseModel from './base-model';
4
4
  class Line extends BaseModel {
5
5
  constructor(options) {
6
6
  super({
@@ -33,6 +33,7 @@ class Line extends BaseModel {
33
33
  this.y_axis_label_color = options.y_axis_label_color;
34
34
  this.sort_type = options.sort_type;
35
35
  this.label_font_size = options.label_font_size;
36
+ this.line_type = options.line_type || CHART_LINE_TYPES[1];
36
37
  }
37
38
  }
38
39
  export default Line;
@@ -9,6 +9,7 @@ import DisplayValuesSettings from '../widgets/display-values-settings';
9
9
  import { eventStopPropagation } from '../../utils';
10
10
  import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, SUPPORT_STACK_VALUE_CHART_TYPES, CHART_TYPE } from '../../constants';
11
11
  import intl from '../../intl';
12
+ import SelectLineType from '../widgets/select-line-type';
12
13
  const StyleSettings = _ref => {
13
14
  let {
14
15
  chart,
@@ -138,11 +139,16 @@ const StyleSettings = _ref => {
138
139
  y_axis_max,
139
140
  y_axis_show_value,
140
141
  label_font_size,
141
- display_each_block_data
142
+ display_each_block_data,
143
+ line_type
142
144
  } = config;
143
145
  const xAxisLabelPosition = xAxisLabelOptions.find(option => option.value === x_axis_label_position) || xAxisLabelOptions[0];
144
146
  const yAxisLabelPosition = yAxisLabelOptions.find(option => option.value === y_axis_label_position) || yAxisLabelOptions[0];
145
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
147
+ 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, {
149
+ selectedLineType: line_type,
150
+ onChange: onChange
151
+ }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
146
152
  className: "sea-chart-parameter-item"
147
153
  }, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
148
154
  key: "x_axis_show_label",
@@ -7,8 +7,9 @@ import MinMaxSetting from '../widgets/min-max-setting';
7
7
  import DisplayValuesSettings from '../widgets/display-values-settings';
8
8
  import ColorUseTypeSelector from '../widgets/color-settings/color-use-type-selector';
9
9
  import { eventStopPropagation } from '../../utils';
10
- import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../constants';
10
+ import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, CHART_TYPE } from '../../constants';
11
11
  import intl from '../../intl';
12
+ import SelectLineType from '../widgets/select-line-type';
12
13
  const StyleSettings = _ref => {
13
14
  let {
14
15
  chart,
@@ -128,11 +129,17 @@ const StyleSettings = _ref => {
128
129
  y_axis_min,
129
130
  y_axis_max,
130
131
  y_axis_show_value,
131
- label_font_size
132
+ label_font_size,
133
+ type,
134
+ line_type
132
135
  } = config;
133
136
  const xAxisLabelPosition = xAxisLabelOptions.find(option => option.value === x_axis_label_position) || xAxisLabelOptions[0];
134
137
  const yAxisLabelPosition = yAxisLabelOptions.find(option => option.value === y_axis_label_position) || yAxisLabelOptions[0];
135
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
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, {
140
+ selectedLineType: line_type,
141
+ onChange: onChange
142
+ }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
136
143
  className: "sea-chart-parameter-item"
137
144
  }, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
138
145
  key: "x_axis_show_label",
@@ -1,6 +1,9 @@
1
1
  import React, { useCallback, useState } from 'react';
2
- import { Input, FormGroup } from 'reactstrap';
2
+ import { Input, FormGroup, Label } from 'reactstrap';
3
+ import { FontSizeSettings, FontColorSettings } from '../widgets/font-settings';
4
+ import Divider from '../widgets/divider';
3
5
  import intl from '../../intl';
6
+ import { DEFAULT_CHART_TITLE_FONT_COLOR } from '../../constants';
4
7
  const StyleSettings = _ref => {
5
8
  let {
6
9
  chart,
@@ -25,18 +28,60 @@ const StyleSettings = _ref => {
25
28
  e.target.blur();
26
29
  }
27
30
  }, []);
31
+ const modifyFontSize = (updatedFontSize, key) => {
32
+ onChange({
33
+ [key]: updatedFontSize
34
+ });
35
+ };
36
+ const modifyFontColor = (updatedFontColor, key) => {
37
+ onChange({
38
+ [key]: updatedFontColor
39
+ });
40
+ };
28
41
  const {
29
42
  config
30
43
  } = chart;
31
- return /*#__PURE__*/React.createElement(FormGroup, {
44
+ const {
45
+ font_size,
46
+ font_color,
47
+ label_font_size,
48
+ label_font_color
49
+ } = config;
50
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, null, intl.get('Number_settings')), /*#__PURE__*/React.createElement(FontSizeSettings, {
51
+ fontSize: font_size,
52
+ defaultFontSize: 40,
53
+ modifyFontSize: updatedFontSize => {
54
+ modifyFontSize(updatedFontSize, 'font_size');
55
+ }
56
+ }), /*#__PURE__*/React.createElement(FontColorSettings, {
57
+ fontColor: font_color,
58
+ defaultFontColor: DEFAULT_CHART_TITLE_FONT_COLOR,
59
+ modifyFontColor: updatedFontColor => {
60
+ modifyFontColor(updatedFontColor, 'font_color');
61
+ }
62
+ }), /*#__PURE__*/React.createElement(Divider, {
63
+ className: "mt-4"
64
+ }), /*#__PURE__*/React.createElement(Label, null, intl.get('Label_settings')), /*#__PURE__*/React.createElement(FormGroup, {
32
65
  className: "sea-chart-parameter-item"
33
- }, /*#__PURE__*/React.createElement("label", null, intl.get('Label')), /*#__PURE__*/React.createElement(Input, {
66
+ }, /*#__PURE__*/React.createElement(Label, null, intl.get('Label')), /*#__PURE__*/React.createElement(Input, {
34
67
  type: "text",
35
68
  value: name,
36
69
  placeholder: config.name || '',
37
70
  onBlur: onSaveName,
38
71
  onChange: onChangeName,
39
72
  onKeyDown: onKeyDown
73
+ })), /*#__PURE__*/React.createElement(FontSizeSettings, {
74
+ fontSize: label_font_size,
75
+ defaultFontSize: 12,
76
+ modifyFontSize: updatedFontSize => {
77
+ modifyFontSize(updatedFontSize, 'label_font_size');
78
+ }
79
+ }), /*#__PURE__*/React.createElement(FontColorSettings, {
80
+ fontColor: label_font_color,
81
+ defaultFontColor: DEFAULT_CHART_TITLE_FONT_COLOR,
82
+ modifyFontColor: updatedFontColor => {
83
+ modifyFontColor(updatedFontColor, 'label_font_color');
84
+ }
40
85
  }));
41
86
  };
42
87
  export default StyleSettings;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { FormGroup, Label } from 'reactstrap';
3
+ import DTableRadio from "dtable-ui-component/lib/DTableRadio";
4
+ import { CHART_LINE_TYPES } from '../../../constants';
5
+ import intl from '../../../intl';
6
+ function SelectLineType(_ref) {
7
+ let {
8
+ selectedLineType,
9
+ onChange
10
+ } = _ref;
11
+ const onChangeLineType = lineType => {
12
+ if (lineType === selectedLineType) return;
13
+ onChange && onChange({
14
+ line_type: lineType
15
+ });
16
+ };
17
+ return /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement(Label, null, intl.get('Line_type')), CHART_LINE_TYPES.map((lineType, index) => {
18
+ const isChecked = lineType === selectedLineType;
19
+ return /*#__PURE__*/React.createElement(DTableRadio, {
20
+ key: index,
21
+ isChecked: isChecked,
22
+ onCheckedChange: () => onChangeLineType(lineType),
23
+ label: intl.get(lineType)
24
+ });
25
+ }));
26
+ }
27
+ export default SelectLineType;
@@ -1,14 +1,15 @@
1
1
  .sea-chart-formatter {
2
2
  height: 100%;
3
3
  width: 100%;
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
4
+ position: relative;
7
5
  }
8
6
 
9
7
  .sea-chart-formatter-tip {
10
8
  background-color: #F5F5F5;
11
9
  border-radius: 4px;
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
12
13
  }
13
14
 
14
15
  .sea-chart-formatter.error {
@@ -23,14 +24,23 @@
23
24
  overflow: hidden;
24
25
  }
25
26
 
27
+ .sea-chart-formatter .sea-chart-cavans-container {
28
+ position: relative;
29
+ width: 100%;
30
+ height: 100%;
31
+ }
32
+
26
33
  .sea-chart-formatter .sea-chart-table-formatter-container {
27
34
  overflow: scroll;
28
35
  }
29
36
 
30
37
  .sea-chart-formatter .sea-chart-container {
31
- flex: 1;
32
38
  font-size: 12px;
33
- padding: 20px 40px 50px 50px;
39
+ position: absolute;
40
+ left: 2%;
41
+ right: 2%;
42
+ top: 2%;
43
+ bottom: 8%;
34
44
  }
35
45
 
36
46
  .sea-chart-formatter .sea-chart-container.show-x-axis-label,
@@ -64,5 +74,5 @@
64
74
  }
65
75
 
66
76
  .sea-chart-formatter .sea-chart-completeness-chart {
67
- padding-right: 20px;
77
+ padding-right: 0.5%;
68
78
  }
@@ -138,17 +138,17 @@ class View extends React.PureComponent {
138
138
  if (errorMessage) {
139
139
  return /*#__PURE__*/React.createElement("div", {
140
140
  className: classnames('error', validClassName, tipBackgroundColorClassName)
141
- }, intl.get(errorMessage));
141
+ }, /*#__PURE__*/React.createElement("span", null, intl.get(errorMessage)));
142
142
  }
143
143
  if (tipMessage) {
144
144
  return /*#__PURE__*/React.createElement("div", {
145
145
  className: classnames('error', validClassName, tipBackgroundColorClassName)
146
- }, intl.get(tipMessage));
146
+ }, /*#__PURE__*/React.createElement("span", null, intl.get(tipMessage)));
147
147
  }
148
148
  if (BaseUtils.imEmptyChartResult(data) && !chartType.includes('map')) {
149
149
  return /*#__PURE__*/React.createElement("div", {
150
150
  className: classnames('error', validClassName, tipBackgroundColorClassName)
151
- }, intl.get('There_are_no_statistic_results_yet'));
151
+ }, /*#__PURE__*/React.createElement("span", null, intl.get('There_are_no_statistic_results_yet')));
152
152
  }
153
153
  return /*#__PURE__*/React.createElement("div", {
154
154
  className: validClassName
@@ -156,13 +156,15 @@ class View extends React.PureComponent {
156
156
  className: classnames('sea-chart-formatter-container', "sea-chart-".concat(chart === null || chart === void 0 ? void 0 : (_chart$config2 = chart.config) === null || _chart$config2 === void 0 ? void 0 : _chart$config2.type, "-formatter-container"))
157
157
  }, /*#__PURE__*/React.createElement(Title, {
158
158
  chart: chart
159
- }), /*#__PURE__*/React.createElement(Wrapper, {
159
+ }), /*#__PURE__*/React.createElement("div", {
160
+ className: "sea-chart-cavans-container"
161
+ }, /*#__PURE__*/React.createElement(Wrapper, {
160
162
  chart: chart,
161
163
  data: data,
162
164
  tables: tables,
163
165
  canvasStyle: canvasStyle,
164
166
  customRender: render
165
- })));
167
+ }))));
166
168
  }
167
169
  }
168
170
  const propTypes = {
@@ -1,7 +1,6 @@
1
- import classnames from 'classnames';
2
1
  import PropTypes from 'prop-types';
3
2
  import React from 'react';
4
- import { CHART_SUMMARY_SHOW, CHART_SUMMARY_TYPE } from '../../constants';
3
+ import { CHART_LINE_TYPES, CHART_SUMMARY_SHOW, CHART_SUMMARY_TYPE } from '../../constants';
5
4
  import intl from '../../intl';
6
5
  import { BaseUtils, isFunction } from '../../utils';
7
6
  import ChartComponent from './chart-component';
@@ -24,7 +23,7 @@ class Area extends ChartComponent {
24
23
  const {
25
24
  y_axis_show_value
26
25
  } = chart.config;
27
- const appendPadding = [y_axis_show_value ? 47 : 30, 0, 0, 0];
26
+ const appendPadding = [y_axis_show_value ? 17 : 0, 0, 0, 0];
28
27
  this.initChart(this.container, {
29
28
  appendPadding
30
29
  });
@@ -65,10 +64,12 @@ class Area extends ChartComponent {
65
64
  y_axis_summary_type,
66
65
  y_axis_summary_method,
67
66
  y_axis_label_color,
67
+ line_type,
68
68
  y_axis_show_value,
69
69
  label_font_size
70
70
  } = chart.config;
71
71
  const newData = this.getChartGroupData(data);
72
+ const isSmooth = line_type === CHART_LINE_TYPES[1];
72
73
  let chartBarColor;
73
74
  if (this.isGroupChart) {
74
75
  chartBarColor = this.groupName;
@@ -94,62 +95,102 @@ class Area extends ChartComponent {
94
95
  }
95
96
  });
96
97
  }
97
- this.chart.line().position('name*value').color(chartBarColor);
98
- this.chart.point().label(y_axis_show_value ? 'value' : false, {
98
+
99
+ // line
100
+ const line = this.chart.line().label(y_axis_show_value ? 'value' : false, {
99
101
  style: {
100
102
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
101
- fill: '#6e6e6e'
103
+ fill: theme.labelColor
102
104
  }
103
- }).position('name*value').color(chartBarColor).shape('circle').style({
104
- lineWidth: 1,
105
- stroke: '#fff'
106
- }).state({
107
- active: {
108
- style: {
109
- stroke: null
110
- }
105
+ }).position('name*value').animate({
106
+ appear: {
107
+ animation: 'fadeIn',
108
+ duration: 1000,
109
+ easing: 'easeLinear'
111
110
  }
111
+ }).color(chartBarColor).shape(isSmooth ? 'smooth' : 'line').tooltip(false).style({
112
+ lineWidth: 3,
113
+ opacity: 1
112
114
  });
113
- this.chart.area().position('name*value').color(chartBarColor).tooltip('name*value', (name, value) => {
115
+
116
+ // point
117
+ let point;
118
+ if (y_axis_show_value) {
119
+ point = this.chart.point().animate({
120
+ appear: {
121
+ animation: 'fadeIn',
122
+ duration: 1000,
123
+ easing: 'easeLinear'
124
+ }
125
+ }).position('name*value').color(chartBarColor).shape('circle').size(4).style({
126
+ stroke: 0,
127
+ fillOpacity: 1
128
+ });
129
+ }
130
+ const area = this.chart.area().position('name*value').animate({
131
+ appear: {
132
+ animation: 'fadeIn',
133
+ duration: 1000,
134
+ easing: 'easeLinear'
135
+ }
136
+ }).shape(isSmooth ? 'smooth' : 'area').color(chartBarColor).tooltip('group_name*name*value', (group_name, name, value) => {
114
137
  return {
115
- name,
138
+ title: y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT ? intl.get('Amount') : intl.get(CHART_SUMMARY_SHOW[y_axis_summary_method]),
116
139
  value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
117
- title: y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT ? intl.get('Amount') : intl.get(CHART_SUMMARY_SHOW[y_axis_summary_method])
140
+ name: group_name
118
141
  };
142
+ }).style({
143
+ fillOpacity: 0.3
119
144
  });
120
- this.chart.tooltip({
121
- showTitle: true,
122
- showMarkers: false,
123
- containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
124
- itemTpl: '<div class="g2-tooltip-content"><div class="tooltip-name">{title}<div><div class="tooltip-item">{name}: {value}<div></div>',
125
- domStyles: {
126
- 'g2-tooltip': {
127
- borderRadius: '2px',
128
- backgroundColor: '#fff',
129
- padding: '10px'
130
- },
131
- 'tooltip-item': {
132
- marginTop: '5px'
133
- }
134
- }
145
+ this.chart.on('tooltip:show', () => {
146
+ if (line.styleOption.cfg.opacity === 0.3) return;
147
+ line.style({
148
+ opacity: 0.3,
149
+ lineWidth: 3
150
+ });
151
+ area.style({
152
+ fillOpacity: 0.1
153
+ });
154
+ if (point) point.style({
155
+ fillOpacity: 0.3,
156
+ stroke: 0
157
+ });
158
+ this.chart.render();
159
+ });
160
+ this.chart.on('tooltip:hide', () => {
161
+ if (line.styleOption.cfg.opacity === 1) return;
162
+ line.style({
163
+ opacity: 1,
164
+ lineWidth: 3
165
+ });
166
+ area.style({
167
+ fillOpacity: 0.3
168
+ });
169
+ if (point) point.style({
170
+ fillOpacity: 1,
171
+ stroke: 0
172
+ });
173
+ this.chart.render();
135
174
  });
175
+ this.setToolTipForLine();
136
176
  isFunction(customRender) && customRender(this.chart);
137
177
  this.setNameLabelAndTooltip(theme, this.labelCount);
138
178
  this.setValueLabel(theme);
139
- this.chart.interaction('active-region');
140
179
  if (this.isGroupChart) {
141
- this.setLegend(this.groupName, theme, 'bottom');
180
+ this.setLegend(this.groupName, theme, 'top-right');
142
181
  }
143
182
  };
144
183
  this.chart = null;
145
184
  this.groupName = 'group_name';
146
185
  this.isGroupChart = false;
186
+ this.needRenderAxisLabel = true;
147
187
  }
148
188
  componentDidMount() {
149
189
  this.initChartType();
150
190
  this.createChart();
151
191
  this.drawChart();
152
192
  this.renderAxisLabel(this.props.chart, this.props.tables);
193
+ super.componentDidMount();
153
194
  }
154
195
  componentDidUpdate(prevProps) {
155
196
  if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
@@ -162,16 +203,11 @@ class Area extends ChartComponent {
162
203
  }
163
204
  componentWillUnmount() {
164
205
  this.chart && this.chart.destroy();
206
+ super.componentWillUnmount();
165
207
  }
166
208
  render() {
167
- const {
168
- chart
169
- } = this.props;
170
209
  return /*#__PURE__*/React.createElement("div", {
171
- className: classnames('sea-chart-container w-100', {
172
- 'show-x-axis-label': this.isShowXAxisLabel(chart),
173
- 'show-y-axis-label': this.isShowYAxisLabel(chart)
174
- }),
210
+ className: 'sea-chart-container',
175
211
  ref: ref => this.container = ref
176
212
  });
177
213
  }