sea-chart 1.1.49 → 1.1.50

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.
@@ -1,4 +1,4 @@
1
- import { CellType, DEFAULT_NUMBER_FORMAT, FORMULA_RESULT_TYPE } from 'dtable-utils';
1
+ import { CellType, DEFAULT_NUMBER_FORMAT } from 'dtable-utils';
2
2
  import { GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP, GEOLOCATION_GRANULARITY, GEOLOCATION_GRANULARITY_LIST, MAP_LEVEL, MUNICIPALITIES } from './geolocation';
3
3
  import { CHART_KEY, GENERIC_KEY, GENERIC_KEY_2_SIMILAR_KEYS } from './model';
4
4
  import { STYLE_COLORS, HORIZONTAL_ALIGN, HORIZONTAL_ALIGNS, HORIZONTAL_ALIGN_SHOW } from './style';
@@ -6,6 +6,12 @@ import { CHART_TYPE, CHART_TYPE_SHOW, CHART_TYPES } from './type';
6
6
  import { CHART_TYPE_IMAGE } from './type-image';
7
7
  import { regions } from './regions';
8
8
  import { TABLE_DIMENSIONS } from './table';
9
+ export const COMBINATION_DISPLAY_FIELDS = {
10
+ LEFT: 'Y_axis_(lift_side)',
11
+ RIGHT: 'Y_axis_(right_side)',
12
+ ALL: 'All'
13
+ };
14
+ export const COMBINATION_DISPLAY_FIELDS_LIST = [COMBINATION_DISPLAY_FIELDS.RIGHT, COMBINATION_DISPLAY_FIELDS.LEFT, COMBINATION_DISPLAY_FIELDS.ALL];
9
15
  export const SETTING_DEFAULT_FONT_SIZE = 12;
10
16
  export const DEFAULT_LANG = 'en';
11
17
  export const FUNNEL_LABEL_FORMAT = {
@@ -85,7 +91,7 @@ export const CHART_SUMMARY_CALCULATION_METHOD = ['Sum', 'Max', 'Min', 'Mean', 'D
85
91
  export const BASIC_NUMBER_CARD_CALCULATION_METHOD = 'Row_count';
86
92
  export const CHART_DATE_SUMMARY_CALCULATION_METHOD = ['Max', 'Min', 'Distinct_values'];
87
93
  export const CHART_SUPPORT_COLUMNS = [CellType.DATE, CellType.SINGLE_SELECT, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR, CellType.TEXT, CellType.NUMBER, CellType.FORMULA, CellType.LINK_FORMULA, CellType.GEOLOCATION, CellType.LINK, CellType.MTIME, CellType.CTIME, CellType.CREATOR, CellType.LAST_MODIFIER, CellType.CHECKBOX, CellType.RATE, CellType.DURATION];
88
- export const CHART_SUPPORT_SORT_COLUMNS = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.SINGLE_SELECT, CellType.FORMULA, CellType.LINK_FORMULA, CellType.CTIME, CellType.MTIME, CellType.RATE, CellType.DURATION];
94
+ export const CHART_SUPPORT_SORT_COLUMNS = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.SINGLE_SELECT, CellType.FORMULA, CellType.LINK_FORMULA, CellType.CTIME, CellType.MTIME, CellType.RATE, CellType.DURATION, CellType.COLLABORATOR];
89
95
  export const LABEL_COLORS = ['#2a67d1', '#4ecccb', '#59cb74', '#fbd44a', '#f4667c', '#9860e5', '#9f8cf1', '#dc82d2', '#eaa775', '#addf84', '#85e0be', '#89d2ea'];
90
96
  export const TIME_COLUMN_LIST = [CellType.CTIME, CellType.MTIME, CellType.DATE];
91
97
  export const DATE_GRANULATES = [CHART_SUMMARY_TYPE.DAY, CHART_SUMMARY_TYPE.WEEK, CHART_SUMMARY_TYPE.MONTH, CHART_SUMMARY_TYPE.QUARTER, CHART_SUMMARY_TYPE.YEAR];
@@ -42,7 +42,7 @@ const de = {
42
42
  "Label": "Beschriftung",
43
43
  "Y-axis(left side)": "Y-Achse (primär)",
44
44
  "Y-axis(right side)": "Y-Achse (sekundär)",
45
- "Display_title": "Anzeigetitel",
45
+ "Display_title": "Titel anzeigen",
46
46
  "Current_value_field": "Feld für aktuellen Wert",
47
47
  "Total_value_field": "Feld für Gesamtwert",
48
48
  "Group_by": "Gruppieren nach",
@@ -146,7 +146,7 @@ const de = {
146
146
  "Permission_denied": "Zugriff verweigert",
147
147
  "Execution_time_of_the_query_exceeds_the_limit": "Le temps d'exécution de la requête dépasse la limite. Les données ne peuvent pas être chargées.",
148
148
  "There_are_some_problems_with_the_filters": "Die Filterbedingungen sind abnormal. Bitte setzen sie die Filterbedingungen in den Ansichtseinstellungen zurück.",
149
- "Please_complete_the_chart_configuration_first": "Schließen Sie die Konfiguration des Diagramms ab.",
149
+ "Please_complete_the_chart_configuration_first": "Configure chart in element settings",
150
150
  "Not_used": "Nicht verwendet",
151
151
  "Select_field": "Feld auswählen",
152
152
  "Display_total": "Gesamtwert anzeigen",
@@ -265,30 +265,34 @@ const de = {
265
265
  "Show_overall_rate": "Gesamtpreisbeschriftung anzeigen",
266
266
  "Percentage": "Prozentsatz",
267
267
  "Number_and_percentage": "Anzahl und Prozentsatz",
268
- "No_record": "Keine Aufzeichnung",
268
+ "No_record": "Kein Eintrag",
269
269
  "Drill_down_settings": "Drilldown-Einstellungen",
270
270
  "Enable_drill_down_feature": "Aktivieren Sie die Drilldown-Funktion",
271
271
  "Field_settings": "Feldeinstellungen",
272
272
  "Select_all": "Alles auswählen",
273
273
  "Visible": "Sichtbar",
274
- "Goal_line": "Torlinie",
275
- "Display_goal_line": "Torlinie anzeigen",
276
- "Goal_value": "Zielwert",
277
- "Goal_label": "Zielbezeichnung",
278
- "Table_element": "Tableau",
279
- "Sort": "Trier",
280
- "1_Sort": "1 Sorte",
281
- "Sorts": "sortiert",
282
- "hide_columns": "Spalten ausblenden",
283
- "Hidden_columns": "Versteckte Spalten",
284
- "1_hidden_column": "1 ausgeblendete Spalte",
285
- "No_sorts": "Keine Sorten",
286
- "Add_sort": "Sortierung hinzufügen",
287
- "Search_column": "Suchspalte",
288
- "up": "Hoch",
289
- "down": "Runter",
290
- "Equal": "Gleich",
291
- "Hide_all": "Alles ausblenden",
292
- "Show_all": "Alle anzeigen"
274
+ "Goal_line": "Horizontale Linie",
275
+ "Display_goal_line": "Horizontale Linie anzeigen",
276
+ "Goal_value": "Wert",
277
+ "Goal_label": "Bezeichnung",
278
+ "Table_element": "Table",
279
+ "Sort": "Sort",
280
+ "1_Sort": "1 sort",
281
+ "Sorts": "sorts",
282
+ "hide_columns": "Hide columns",
283
+ "Hidden_columns": "Hidden columns",
284
+ "1_hidden_column": "1 Hidden column",
285
+ "No_sorts": "No sorts",
286
+ "Add_sort": "Add sort",
287
+ "Search_column": "Search column",
288
+ "up": "Up",
289
+ "down": "Down",
290
+ "Equal": "Equal",
291
+ "Hide_all": "Hide all",
292
+ "Show_all": "Show all",
293
+ "Y_axis_(lift_side)": "Y-Achse (linke Seite)",
294
+ "Y_axis_(right_side)": "Y-Achse (rechte Seite)",
295
+ "All": "Alle",
296
+ "Label_value": "Etikettenwert"
293
297
  };
294
298
  export default de;
@@ -146,7 +146,7 @@ const en = {
146
146
  "Permission_denied": "Permission denied",
147
147
  "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
148
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
149
- "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
+ "Please_complete_the_chart_configuration_first": "Configure chart in element settings",
150
150
  "Not_used": "Not used",
151
151
  "Select_field": "Select field",
152
152
  "Display_total": "Display total",
@@ -289,6 +289,10 @@ const en = {
289
289
  "down": "Down",
290
290
  "Equal": "Equal",
291
291
  "Hide_all": "Hide all",
292
- "Show_all": "Show all"
292
+ "Show_all": "Show all",
293
+ "Y_axis_(lift_side)": "Y axis (left side)",
294
+ "Y_axis_(right_side)": "Y axis (right side)",
295
+ "All": "All",
296
+ "Label_value": "Label value"
293
297
  };
294
298
  export default en;
@@ -146,7 +146,7 @@ const es = {
146
146
  "Permission_denied": "Permission denied",
147
147
  "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
148
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
149
- "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
+ "Please_complete_the_chart_configuration_first": "Configure chart in element settings",
150
150
  "Not_used": "Not used",
151
151
  "Select_field": "Select field",
152
152
  "Display_total": "Display total",
@@ -289,6 +289,10 @@ const es = {
289
289
  "down": "Down",
290
290
  "Equal": "Equal",
291
291
  "Hide_all": "Hide all",
292
- "Show_all": "Show all"
292
+ "Show_all": "Show all",
293
+ "Y_axis_(lift_side)": "Y axis (left side)",
294
+ "Y_axis_(right_side)": "Y axis (right side)",
295
+ "All": "All",
296
+ "Label_value": "Label value"
293
297
  };
294
298
  export default es;
@@ -42,7 +42,7 @@ const fr = {
42
42
  "Label": "Étiquette",
43
43
  "Y-axis(left side)": "Axe des y (primaire)",
44
44
  "Y-axis(right side)": "Axe des y (secondaire)",
45
- "Display_title": "Titre à afficher",
45
+ "Display_title": "Afficher le titre",
46
46
  "Current_value_field": "Champ de valeur actuel",
47
47
  "Total_value_field": "Champ de valeur total",
48
48
  "Group_by": "Groupé par",
@@ -146,7 +146,7 @@ const fr = {
146
146
  "Permission_denied": "Permission refusée",
147
147
  "Execution_time_of_the_query_exceeds_the_limit": "Le temps d'exécution de la requête dépasse la limite. Les données ne peuvent pas être chargées.",
148
148
  "There_are_some_problems_with_the_filters": "Les conditions de filtrage sont anormales. Veuillez réinitialiser les conditions de filtrage dans les paramètres de vue.",
149
- "Please_complete_the_chart_configuration_first": "Compléter la configuration du diagramme",
149
+ "Please_complete_the_chart_configuration_first": "Configure chart in element settings",
150
150
  "Not_used": "Ne pas utilisé",
151
151
  "Select_field": "Sélectionner un champ",
152
152
  "Display_total": "Afficher le total",
@@ -271,24 +271,28 @@ const fr = {
271
271
  "Field_settings": "Paramètres de champ",
272
272
  "Select_all": "Tout sélectionner",
273
273
  "Visible": "Visible",
274
- "Goal_line": "Ligne de but",
275
- "Display_goal_line": "Afficher la ligne de but",
276
- "Goal_value": "Valeur de l'objectif",
277
- "Goal_label": "Étiquette d'objectif",
278
- "Table_element": "Tabelle",
279
- "Sort": "Trier",
280
- "1_Sort": "1 sorte",
281
- "Sorts": "sortes",
282
- "hide_columns": "Masquer les colonnes",
283
- "Hidden_columns": "Colonnes masquées",
284
- "1_hidden_column": "1 colonne masquée",
285
- "No_sorts": "Aucune sorte",
286
- "Add_sort": "Ajouter un tri",
287
- "Search_column": "Colonne de recherche",
288
- "up": "En haut",
289
- "down": "Vers le bas",
290
- "Equal": "Égal",
291
- "Hide_all": "cacher",
292
- "Show_all": "Afficher tout"
274
+ "Goal_line": "Ligne horizontale",
275
+ "Display_goal_line": "Afficher la ligne horizontale",
276
+ "Goal_value": "Valeur",
277
+ "Goal_label": "Étiquette",
278
+ "Table_element": "Table",
279
+ "Sort": "Sort",
280
+ "1_Sort": "1 sort",
281
+ "Sorts": "sorts",
282
+ "hide_columns": "Hide columns",
283
+ "Hidden_columns": "Hidden columns",
284
+ "1_hidden_column": "1 Hidden column",
285
+ "No_sorts": "No sorts",
286
+ "Add_sort": "Add sort",
287
+ "Search_column": "Search column",
288
+ "up": "Up",
289
+ "down": "Down",
290
+ "Equal": "Equal",
291
+ "Hide_all": "Hide all",
292
+ "Show_all": "Show all",
293
+ "Y_axis_(lift_side)": "Y axis (left side)",
294
+ "Y_axis_(right_side)": "Y axis (right side)",
295
+ "All": "All",
296
+ "Label_value": "Label value"
293
297
  };
294
298
  export default fr;
@@ -146,7 +146,7 @@ const pt = {
146
146
  "Permission_denied": "Permission denied",
147
147
  "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
148
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
149
- "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
+ "Please_complete_the_chart_configuration_first": "Configure chart in element settings",
150
150
  "Not_used": "Not used",
151
151
  "Select_field": "Select field",
152
152
  "Display_total": "Display total",
@@ -289,6 +289,10 @@ const pt = {
289
289
  "down": "Down",
290
290
  "Equal": "Equal",
291
291
  "Hide_all": "Hide all",
292
- "Show_all": "Show all"
292
+ "Show_all": "Show all",
293
+ "Y_axis_(lift_side)": "Y axis (left side)",
294
+ "Y_axis_(right_side)": "Y axis (right side)",
295
+ "All": "All",
296
+ "Label_value": "Label value"
293
297
  };
294
298
  export default pt;
@@ -146,7 +146,7 @@ const ru = {
146
146
  "Permission_denied": "Permission denied",
147
147
  "Execution_time_of_the_query_exceeds_the_limit": "Execution time of the query exceeds the limit. Data cannot be loaded.",
148
148
  "There_are_some_problems_with_the_filters": "There are some problems with the filters.",
149
- "Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
149
+ "Please_complete_the_chart_configuration_first": "Configure chart in element settings",
150
150
  "Not_used": "Not used",
151
151
  "Select_field": "Select field",
152
152
  "Display_total": "Display total",
@@ -289,6 +289,10 @@ const ru = {
289
289
  "down": "Down",
290
290
  "Equal": "Equal",
291
291
  "Hide_all": "Hide all",
292
- "Show_all": "Show all"
292
+ "Show_all": "Show all",
293
+ "Y_axis_(lift_side)": "Y axis (left side)",
294
+ "Y_axis_(right_side)": "Y axis (right side)",
295
+ "All": "All",
296
+ "Label_value": "Label value"
293
297
  };
294
298
  export default ru;
@@ -146,7 +146,7 @@ const zh_CN = {
146
146
  "Permission_denied": "权限错误",
147
147
  "Execution_time_of_the_query_exceeds_the_limit": "查询的执行时间超出限制。无法加载数据。",
148
148
  "There_are_some_problems_with_the_filters": "过滤器有一些问题。",
149
- "Please_complete_the_chart_configuration_first": "请先完成图表配置",
149
+ "Please_complete_the_chart_configuration_first": "在元素设置中配置图表",
150
150
  "Not_used": "不使用",
151
151
  "Select_field": "选择字段",
152
152
  "Display_total": "显示总计",
@@ -275,20 +275,24 @@ const zh_CN = {
275
275
  "Display_goal_line": "显示目标线",
276
276
  "Goal_value": "目标值",
277
277
  "Goal_label": "目标值标签",
278
- "Table_element": "表格",
278
+ "Table_element": "子表",
279
279
  "Sort": "排序",
280
280
  "1_Sort": "1 个排序",
281
- "Sorts": "个排序",
281
+ "Sorts": "排序",
282
282
  "hide_columns": "隐藏列",
283
283
  "Hidden_columns": "个隐藏列",
284
284
  "1_hidden_column": "1 个隐藏列",
285
285
  "No_sorts": "没有排序",
286
- "Add_sort": "添加排序",
286
+ "Add_sort": "增加排序",
287
287
  "Search_column": "搜索列",
288
288
  "up": "升序",
289
289
  "down": "降序",
290
290
  "Equal": "相等",
291
291
  "Hide_all": "隐藏全部",
292
- "Show_all": "展示全部"
292
+ "Show_all": "显示全部",
293
+ "Y_axis_(lift_side)": "Y轴(主轴)",
294
+ "Y_axis_(right_side)": "Y轴(次轴)",
295
+ "All": "全部",
296
+ "Label_value": "显示标签值"
293
297
  };
294
298
  export default zh_CN;
@@ -1,5 +1,5 @@
1
1
  import { isBoolean } from '../utils';
2
- import { CHART_TYPE, CHART_SUMMARY_TYPE, CHART_LINE_TYPES } from '../constants';
2
+ import { CHART_TYPE, CHART_SUMMARY_TYPE, CHART_LINE_TYPES, COMBINATION_DISPLAY_FIELDS } from '../constants';
3
3
  import BaseModel from './base-model';
4
4
  class Combination extends BaseModel {
5
5
  constructor(options) {
@@ -31,6 +31,7 @@ class Combination extends BaseModel {
31
31
  this.y_axis_auto_range_right = options.y_axis_auto_range_right;
32
32
  this.y_axis_min_right = options.y_axis_min_right;
33
33
  this.y_axis_max_right = options.y_axis_max_right;
34
+ this.display_data_field = options.display_data_field || COMBINATION_DISPLAY_FIELDS.RIGHT;
34
35
  this.display_data = isBoolean(options.y_axis_show_value) ? options.y_axis_show_value : false;
35
36
  this.label_font_size = options.label_font_size;
36
37
  this.line_type = options.line_type || CHART_LINE_TYPES[1];
@@ -1,15 +1,16 @@
1
+ import _DTableCustomizeSelect from "dtable-ui-component/lib/DTableCustomizeSelect";
1
2
  import _CollapsibleSettingLayout from "dtable-ui-component/lib/CollapsibleSettingLayout";
2
3
  import _DTableRadioGroup from "dtable-ui-component/lib/DTableRadioGroup";
3
4
  import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
4
5
  import React, { useCallback } from 'react';
5
- import { Label, Row } from 'reactstrap';
6
+ import { FormGroup, Label, Row } from 'reactstrap';
6
7
  import Divider from '../widgets/divider';
7
8
  import MinMaxSetting from '../widgets/min-max-setting';
8
- import DisplayValuesSettings from '../widgets/display-values-settings';
9
- import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, SUPPORT_GOAL_LINE_CHART_TYPES } from '../../constants';
9
+ import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, SUPPORT_GOAL_LINE_CHART_TYPES, COMBINATION_DISPLAY_FIELDS_LIST } from '../../constants';
10
10
  import intl from '../../intl';
11
11
  import SelectLineType from '../widgets/select-line-type';
12
12
  import GoalLineSetting from '../../components/goal-line-setting';
13
+ import { FontSizeSettings } from '../widgets/font-settings';
13
14
  const StyleSettings = _ref => {
14
15
  let {
15
16
  chart,
@@ -19,6 +20,12 @@ const StyleSettings = _ref => {
19
20
  } = _ref;
20
21
  const xAxisLabelOptions = X_LABEL_POSITIONS;
21
22
  const yAxisLabelOptions = Y_LABEL_POSITIONS;
23
+ const displayFieldOptions = COMBINATION_DISPLAY_FIELDS_LIST.map(field => {
24
+ return {
25
+ label: /*#__PURE__*/React.createElement("span", null, intl.get(field)),
26
+ value: field
27
+ };
28
+ });
22
29
  const onAxisLabelShowChange = useCallback(labelKey => {
23
30
  const {
24
31
  config
@@ -63,8 +70,21 @@ const StyleSettings = _ref => {
63
70
  };
64
71
  onChange && onChange(update);
65
72
  }, [onChange]);
66
- const onDisplayValueChange = useCallback(update => {
67
- onChange && onChange(update);
73
+ const onDisplayValueChange = useCallback(() => {
74
+ var _chart$config;
75
+ onChange && onChange({
76
+ display_data: !((_chart$config = chart.config) === null || _chart$config === void 0 ? void 0 : _chart$config.display_data)
77
+ });
78
+ }, [chart.config.display_data, onChange]);
79
+ const onFontSizeChange = useCallback(value => {
80
+ onChange && onChange({
81
+ label_font_size: value
82
+ });
83
+ }, [onChange]);
84
+ const onDisplayFieldChange = useCallback(value => {
85
+ onChange && onChange({
86
+ display_data_field: value
87
+ });
68
88
  }, [onChange]);
69
89
  const getLabelOptionsDisplay = options => {
70
90
  return options.reduce((optionDisplayMap, position) => {
@@ -97,10 +117,12 @@ const StyleSettings = _ref => {
97
117
  y_axis_min_right,
98
118
  y_axis_max_right,
99
119
  display_data,
120
+ display_data_field,
100
121
  label_font_size,
101
122
  line_type,
102
123
  type
103
124
  } = config;
125
+ const selectedDisplayFieldOption = displayFieldOptions.find(option => option.value === display_data_field) || displayFieldOptions[0];
104
126
  const xAxisLabelPosition = x_axis_label_position || xAxisLabelOptions[0];
105
127
  const yLeftAxisLabelPosition = y_axis_left_label_position || yAxisLabelOptions[0];
106
128
  const yRightAxisLabelPosition = y_axis_right_label_position || yAxisLabelOptions[0];
@@ -183,13 +205,28 @@ const StyleSettings = _ref => {
183
205
  goalLabel: goal_label,
184
206
  goalValue: goal_value,
185
207
  onChange: onStyleChange
186
- }), /*#__PURE__*/React.createElement(Divider, null)), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
187
- isShowValueKey: "display_data",
188
- isShowValue: display_data,
189
- fontSizeKey: "label_font_size",
190
- fontSize: label_font_size,
208
+ }), /*#__PURE__*/React.createElement(Divider, null)), /*#__PURE__*/React.createElement(_CollapsibleSettingLayout, {
209
+ title: intl.get('Label')
210
+ }, /*#__PURE__*/React.createElement(FormGroup, {
211
+ className: "sea-chart-parameter-item"
212
+ }, /*#__PURE__*/React.createElement(_DTableSwitch, {
213
+ switchClassName: "display-value-settings",
214
+ checked: display_data,
215
+ disabled: false,
216
+ placeholder: intl.get('Display_value'),
191
217
  onChange: onDisplayValueChange
192
- }));
218
+ }), display_data && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
219
+ className: "combination-label-value-setting"
220
+ }, /*#__PURE__*/React.createElement(Label, null, intl.get('Label_value')), /*#__PURE__*/React.createElement(_DTableCustomizeSelect, {
221
+ value: selectedDisplayFieldOption,
222
+ options: displayFieldOptions,
223
+ onSelectOption: onDisplayFieldChange
224
+ })), /*#__PURE__*/React.createElement(FontSizeSettings, {
225
+ title: intl.get('Label_font_size'),
226
+ fontSize: label_font_size,
227
+ defaultFontSize: 12,
228
+ modifyFontSize: onFontSizeChange
229
+ })))));
193
230
  };
194
231
  StyleSettings.defaultProps = {
195
232
  xLabel: 'X_axis'
@@ -154,3 +154,7 @@
154
154
  .sea-chart-settings .chart-settings-container .custom-switch .custom-switch-input:checked ~ .custom-switch-indicator:before {
155
155
  left: 12px;
156
156
  }
157
+
158
+ .sea-chart-settings .combination-label-value-setting {
159
+ margin-bottom: 12px;
160
+ }
@@ -39,9 +39,7 @@ class TimePicker extends Component {
39
39
  }, 1);
40
40
  };
41
41
  this.onOpenChange = open => {
42
- if (open) {
43
- this.toggleCalendar(open);
44
- }
42
+ this.toggleCalendar(open);
45
43
  };
46
44
  this.onClear = () => {
47
45
  this.setState({
@@ -27,6 +27,25 @@ export function findIfColumnDataIsArray(column) {
27
27
  }
28
28
  class BaseUtils {}
29
29
  _BaseUtils = BaseUtils;
30
+ BaseUtils.updateSummaryValuePrecision = (result, summaryColumn, summaryValueKey) => {
31
+ if (!result || !summaryColumn) return;
32
+ const {
33
+ data
34
+ } = summaryColumn;
35
+ if (!data) return;
36
+ const {
37
+ enable_precision,
38
+ precision
39
+ } = data;
40
+ if (enable_precision) {
41
+ result.forEach(item => {
42
+ item[summaryValueKey] = parseFloat(getPrecisionNumber(item[summaryValueKey], {
43
+ enable_precision,
44
+ precision
45
+ }));
46
+ });
47
+ }
48
+ };
30
49
  BaseUtils.isCollaborator = column => {
31
50
  return column.type === CellType.COLLABORATOR;
32
51
  };
@@ -226,6 +245,15 @@ BaseUtils.getSummaryColumn = (table, chart) => {
226
245
  {
227
246
  return getTableColumnByKey(table, config.y_axis_column_key);
228
247
  }
248
+ case CHART_TYPE.COMBINATION:
249
+ {
250
+ const summaryColumnLeft = getTableColumnByKey(table, config.y_axis_left_summary_column);
251
+ const summaryColumnRight = getTableColumnByKey(table, config.y_axis_right_summary_column);
252
+ return {
253
+ summaryColumnLeft,
254
+ summaryColumnRight
255
+ };
256
+ }
229
257
  default:
230
258
  {
231
259
  return getTableColumnByKey(table, summary_column_key);
@@ -649,7 +649,8 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = async (chart, sqlRows, chart
649
649
  groupby_include_empty_cells
650
650
  } = config;
651
651
  const {
652
- groupbyColumn
652
+ groupbyColumn,
653
+ summaryColumn
653
654
  } = columnMap;
654
655
  const isGroupbyColumnDataAsAnArray = findIfColumnDataIsArray(groupbyColumn);
655
656
  const {
@@ -724,6 +725,7 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = async (chart, sqlRows, chart
724
725
  }
725
726
  BaseUtils.sortCharts(result, groupbyColumn, 'name');
726
727
  BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
728
+ BaseUtils.updateSummaryValuePrecision(result, summaryColumn, 'value');
727
729
  if (SUPPORT_DATA_SORT_CHART_TYPES.includes(type) && sort_type) {
728
730
  BaseUtils.sortChartData(result, sort_type);
729
731
  return result;
@@ -751,7 +753,8 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = async (chart, sqlRows, char
751
753
  y_axises
752
754
  } = chart.config;
753
755
  const {
754
- groupbyColumn
756
+ groupbyColumn,
757
+ summaryColumn
755
758
  } = columnMap;
756
759
  const table = getTableById(tables, table_id);
757
760
  const stack = y_axises[index];
@@ -844,6 +847,7 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = async (chart, sqlRows, char
844
847
  }
845
848
  BaseUtils.sortCharts(result, groupbyColumn, 'name');
846
849
  BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '', false, true);
850
+ BaseUtils.updateSummaryValuePrecision(result, summaryColumn, 'value');
847
851
  return result;
848
852
  };
849
853
  SQLStatisticsUtils.compareSQLResult2Javascript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
@@ -973,6 +977,8 @@ SQLStatisticsUtils.compareSQLResult2Javascript = async (chart, sqlRows, chartSQL
973
977
  if (comparedResult.length > rangeResult.length) {
974
978
  comparedResult = comparedResult.slice(0, rangeResult.length);
975
979
  }
980
+ BaseUtils.updateSummaryValuePrecision(comparedResult, summaryColumn, 'value');
981
+ BaseUtils.updateSummaryValuePrecision(rangeResult, summaryColumn, 'value');
976
982
  return [...comparedResult, ...rangeResult];
977
983
  };
978
984
  SQLStatisticsUtils.combinationSQLResult2Javascript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
@@ -991,8 +997,13 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = async (chart, sqlRows, char
991
997
  } = config;
992
998
  const table = getTableById(tables, table_id);
993
999
  const {
994
- groupbyColumn
1000
+ groupbyColumn,
1001
+ summaryColumn
995
1002
  } = columnMap;
1003
+ const {
1004
+ summaryColumnLeft,
1005
+ summaryColumnRight
1006
+ } = summaryColumn;
996
1007
  const {
997
1008
  sqlGroupbyColumnKey,
998
1009
  sqlRightSummaryColumnKey,
@@ -1169,6 +1180,8 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = async (chart, sqlRows, char
1169
1180
  }
1170
1181
  BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '', false, true);
1171
1182
  BaseUtils.sortCharts(result, groupbyColumn, 'name');
1183
+ BaseUtils.updateSummaryValuePrecision(result, summaryColumnLeft, 'value_left');
1184
+ BaseUtils.updateSummaryValuePrecision(result, summaryColumnRight, 'value_right');
1172
1185
  return result;
1173
1186
  };
1174
1187
  SQLStatisticsUtils.dashboardSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
@@ -1237,7 +1250,8 @@ SQLStatisticsUtils.updateGroupingChartRows = (results, name, row, count, isColum
1237
1250
  SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
1238
1251
  const {
1239
1252
  groupbyColumn,
1240
- columnGroupbyColumn
1253
+ columnGroupbyColumn,
1254
+ summaryColumn
1241
1255
  } = columnMap;
1242
1256
  const {
1243
1257
  x_axis_include_empty_cells: includeEmpty
@@ -1273,6 +1287,7 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = async (chart,
1273
1287
  BaseUtils.sortCharts(result, groupbyColumn, 'name');
1274
1288
  BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
1275
1289
  BaseUtils.updateTableViewList(result, columnGroupbyColumn, 'group_name', 'group_color', false, false);
1290
+ BaseUtils.updateSummaryValuePrecision(result, summaryColumn, 'value');
1276
1291
  return result;
1277
1292
  };
1278
1293
  SQLStatisticsUtils.groupingChartSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
@@ -1287,7 +1302,9 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = async (chart, sqlRows, ch
1287
1302
  }
1288
1303
  const {
1289
1304
  groupbyColumn,
1290
- columnGroupbyColumn
1305
+ columnGroupbyColumn,
1306
+ summaryColumn,
1307
+ summaryColumnsWithMethod
1291
1308
  } = columnMap;
1292
1309
  if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) {
1293
1310
  if (!columnGroupbyColumn) return await _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
@@ -1328,6 +1345,20 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = async (chart, sqlRows, ch
1328
1345
  }
1329
1346
  BaseUtils.sortCharts(result, groupbyColumn, 'name');
1330
1347
  BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
1348
+ const allSummaryColumns = [summaryColumn].concat(summaryColumnsWithMethod.map(item => item.column));
1349
+
1350
+ // format precision of enabled precision columns
1351
+ let columnNameResultMap = {};
1352
+ result.forEach(item => {
1353
+ if (!columnNameResultMap[item.group_name]) {
1354
+ columnNameResultMap[item.group_name] = [];
1355
+ }
1356
+ columnNameResultMap[item.group_name].push(item);
1357
+ });
1358
+ Object.values(columnNameResultMap).forEach(items => {
1359
+ const targetColumn = allSummaryColumns.find(column => column.name === items[0].group_name);
1360
+ BaseUtils.updateSummaryValuePrecision(items, targetColumn, 'value');
1361
+ });
1331
1362
  return result;
1332
1363
  }
1333
1364
  if (!columnGroupbyColumn) {
@@ -8,6 +8,10 @@ import { BaseUtils, isFunction } from '../../utils';
8
8
  import { CHART_SUMMARY_TYPE, CHART_SUMMARY_SHOW, LABEL_POSITION_TYPE, EMPTY_NAME, CHART_LINE_TYPES, CHART_STYLE_COLORS, CHART_THEME_COLOR } from '../../constants';
9
9
  import intl from '../../intl';
10
10
  import ChartComponent from './chart-component';
11
+ const valueFieldMap = {
12
+ value_left: ['Y_axis_(lift_side)', 'All'],
13
+ value_right: ['Y_axis_(right_side)', 'All']
14
+ };
11
15
  class Combination extends ChartComponent {
12
16
  constructor(props) {
13
17
  super(props);
@@ -48,6 +52,7 @@ class Combination extends ChartComponent {
48
52
  y_axis_min_right,
49
53
  y_axis_max_right,
50
54
  display_data,
55
+ display_data_field,
51
56
  label_font_size,
52
57
  line_type
53
58
  } = chart.config;
@@ -64,6 +69,12 @@ class Combination extends ChartComponent {
64
69
  appendPadding: [display_data ? 17 : 0, 0, 0, 0]
65
70
  });
66
71
  const isSmooth = line_type === CHART_LINE_TYPES[1] || !line_type;
72
+ const showLeftValue = display_data && valueFieldMap['value_left'].includes(display_data_field);
73
+ let showRightValue = display_data && valueFieldMap['value_right'].includes(display_data_field);
74
+ // if display_data is open, default show right value
75
+ if (display_data && !display_data_field) {
76
+ showRightValue = true;
77
+ }
67
78
 
68
79
  // y-axis label width:6 + 10
69
80
  const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
@@ -253,6 +264,13 @@ class Combination extends ChartComponent {
253
264
  }).style({
254
265
  fillOpacity: 1,
255
266
  radius: [singleBarRadius, singleBarRadius, 0, 0]
267
+ }).label(showLeftValue ? 'value_left' : false, {
268
+ style: {
269
+ fontSize: BaseUtils.getLabelFontSize(label_font_size),
270
+ fill: theme.labelColor,
271
+ stroke: '#fff',
272
+ lineWidth: 1
273
+ }
256
274
  });
257
275
  this.formatDataByName(data);
258
276
  if (!y_axis_left_group_by_multiple_numeric_column) {
@@ -273,7 +291,7 @@ class Combination extends ChartComponent {
273
291
  }).shape('circle').size(3).style({
274
292
  stroke: 0,
275
293
  fillOpacity: 1
276
- }).label(display_data ? 'value_right' : false, {
294
+ }).label(showRightValue ? 'value_right' : false, {
277
295
  style: {
278
296
  fontSize: BaseUtils.getLabelFontSize(label_font_size),
279
297
  fill: theme.labelColor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "1.1.49",
3
+ "version": "1.1.50",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",