sea-chart 1.1.34 → 1.1.35
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.
- package/dist/components/goal-line-setting/goal-setting-item.js +37 -0
- package/dist/components/goal-line-setting/index.js +40 -0
- package/dist/constants/index.js +2 -1
- package/dist/locale/lang/de.js +5 -1
- package/dist/locale/lang/en.js +5 -1
- package/dist/locale/lang/es.js +5 -1
- package/dist/locale/lang/fr.js +5 -1
- package/dist/locale/lang/pt.js +5 -1
- package/dist/locale/lang/ru.js +5 -1
- package/dist/locale/lang/zh_CN.js +5 -1
- package/dist/settings/advance-bar-settings/style-settings.js +16 -3
- package/dist/settings/bar-settings/style-settings.js +16 -3
- package/dist/settings/combination-settings/style-settings.js +18 -4
- package/dist/settings/style-settings.js +11 -1
- package/dist/utils/chart-utils/base-utils.js +3 -0
- package/dist/view/wrapper/area.js +10 -0
- package/dist/view/wrapper/bar-custom.js +8 -0
- package/dist/view/wrapper/bar-group.js +9 -1
- package/dist/view/wrapper/bar.js +9 -1
- package/dist/view/wrapper/chart-component.js +22 -0
- package/dist/view/wrapper/combination.js +9 -1
- package/dist/view/wrapper/compare.js +1 -1
- package/dist/view/wrapper/line-group.js +10 -0
- package/dist/view/wrapper/line.js +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Input, Label } from 'reactstrap';
|
|
3
|
+
import intl from '../../intl';
|
|
4
|
+
const GoalSettingItem = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
title,
|
|
7
|
+
modelKey,
|
|
8
|
+
modelValue,
|
|
9
|
+
handleValueChange,
|
|
10
|
+
onlyNumber
|
|
11
|
+
} = _ref;
|
|
12
|
+
const [currText, setCurrText] = useState(modelValue || '');
|
|
13
|
+
const onTextChange = event => {
|
|
14
|
+
const value = onlyNumber ? parseFloat(event.target.value) : event.target.value;
|
|
15
|
+
setCurrText(value);
|
|
16
|
+
};
|
|
17
|
+
const onKeyDown = event => {
|
|
18
|
+
if (event.key === 'Enter') {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
event.target.blur();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const onSaveText = () => {
|
|
24
|
+
handleValueChange({
|
|
25
|
+
[modelKey]: currText
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, null, intl.get(title)), /*#__PURE__*/React.createElement(Input, {
|
|
29
|
+
type: onlyNumber ? 'number' : 'text',
|
|
30
|
+
value: currText,
|
|
31
|
+
onBlur: onSaveText,
|
|
32
|
+
onChange: onTextChange,
|
|
33
|
+
onKeyDown: onKeyDown,
|
|
34
|
+
className: "mb-3"
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
export default GoalSettingItem;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _CollapsibleSettingLayout from "dtable-ui-component/lib/CollapsibleSettingLayout";
|
|
2
|
+
import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import intl from '../../intl';
|
|
5
|
+
import GoalSettingItem from './goal-setting-item';
|
|
6
|
+
export default function GoalLineSetting(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
displayGoalLine,
|
|
9
|
+
goalLabel,
|
|
10
|
+
goalValue,
|
|
11
|
+
onChange
|
|
12
|
+
} = _ref;
|
|
13
|
+
const toggleDisplayGoalLine = event => {
|
|
14
|
+
onChange && onChange({
|
|
15
|
+
display_goal_line: event.target.checked
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const onGoalSettingChange = value => {
|
|
19
|
+
onChange && onChange(value);
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_CollapsibleSettingLayout, {
|
|
22
|
+
title: intl.get('Goal_line')
|
|
23
|
+
}, /*#__PURE__*/React.createElement(_DTableSwitch, {
|
|
24
|
+
switchClassName: "mb-3",
|
|
25
|
+
onChange: toggleDisplayGoalLine,
|
|
26
|
+
checked: !!displayGoalLine,
|
|
27
|
+
placeholder: intl.get('Display_goal_line')
|
|
28
|
+
}), displayGoalLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoalSettingItem, {
|
|
29
|
+
title: "Goal_label",
|
|
30
|
+
modelKey: "goal_label",
|
|
31
|
+
modelValue: goalLabel,
|
|
32
|
+
handleValueChange: onGoalSettingChange
|
|
33
|
+
}), /*#__PURE__*/React.createElement(GoalSettingItem, {
|
|
34
|
+
title: "Goal_value",
|
|
35
|
+
modelKey: "goal_value",
|
|
36
|
+
modelValue: goalValue,
|
|
37
|
+
handleValueChange: onGoalSettingChange,
|
|
38
|
+
onlyNumber: true
|
|
39
|
+
}))));
|
|
40
|
+
}
|
package/dist/constants/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export const CHART_STYLE_COLORS = ['#5B8FF9', '#5AD8A6', '#5D7092', '#F6BD16', '
|
|
|
26
26
|
export const ONLY_NEED_NUMBER_OPTIONS_CHART_TYPE = [CHART_TYPE.COMPLETENESS, CHART_TYPE.COMPLETENESS_GROUP, CHART_TYPE.SCATTER];
|
|
27
27
|
export const COMPLETENESS_GROUPBY_SUPPORTED_COLUMN_TYPE = [CellType.COLLABORATOR, CellType.TEXT, CellType.SINGLE_SELECT];
|
|
28
28
|
export const NUMBERIC_COLUMN_TYPE = [CellType.RATE, CellType.NUMBER];
|
|
29
|
+
export const SUPPORT_GOAL_LINE_CHART_TYPES = [CHART_TYPE.BAR, CHART_TYPE.BAR_CUSTOM, CHART_TYPE.BAR_GROUP, CHART_TYPE.BAR_STACK, CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP, CHART_TYPE.COMBINATION];
|
|
29
30
|
|
|
30
31
|
// chart supports groupby
|
|
31
32
|
export const SUPPORT_GROUP_BY_CHART_TYPES = [CHART_TYPE.BAR_GROUP, CHART_TYPE.BAR_STACK, CHART_TYPE.AREA_GROUP, CHART_TYPE.LINE_GROUP, CHART_TYPE.COMPLETENESS_GROUP, CHART_TYPE.HORIZONTAL_GROUP_BAR, CHART_TYPE.STACKED_HORIZONTAL_BAR, CHART_TYPE.SCATTER];
|
|
@@ -120,7 +121,7 @@ export const LABEL_POSITION_TYPE_SHOW = {
|
|
|
120
121
|
[LABEL_POSITION_TYPE.BOTTOM]: 'Bottom',
|
|
121
122
|
[LABEL_POSITION_TYPE.TOP]: 'Top'
|
|
122
123
|
};
|
|
123
|
-
export const CHART_STYLE_SETTING_KEYS = ['x_axis_show_label', 'x_axis_label_position', 'y_axis_show_label', 'y_axis_label_position', 'y_axis_auto_range', 'y_axis_min', 'y_axis_max', 'y_axis_label_color', 'y_axis_show_value', 'label_font_size', 'increase_display_color', 'display_increase', 'display_increase_percentage', 'show_legend', 'minimum_slice_percent', 'label_format', 'label_position', 'display_label', 'horizontal_axis_label_color', 'display_data', 'name', 'y_axis_left_label_position', 'y_axis_right_label_position', 'show_y_axis_left_label', 'show_y_axis_right_label', 'y_axis_auto_range_left', 'y_axis_min_left', 'y_axis_max_left', 'y_axis_auto_range_right', 'y_axis_min_right', 'y_axis_max_right'];
|
|
124
|
+
export const CHART_STYLE_SETTING_KEYS = ['x_axis_show_label', 'x_axis_label_position', 'y_axis_show_label', 'y_axis_label_position', 'y_axis_auto_range', 'y_axis_min', 'y_axis_max', 'y_axis_label_color', 'y_axis_show_value', 'label_font_size', 'increase_display_color', 'display_increase', 'display_increase_percentage', 'show_legend', 'minimum_slice_percent', 'label_format', 'label_position', 'display_label', 'horizontal_axis_label_color', 'display_data', 'name', 'y_axis_left_label_position', 'y_axis_right_label_position', 'show_y_axis_left_label', 'show_y_axis_right_label', 'y_axis_auto_range_left', 'y_axis_min_left', 'y_axis_max_left', 'y_axis_auto_range_right', 'y_axis_min_right', 'y_axis_max_right', 'display_goal_line', 'goal_value', 'goal_label'];
|
|
124
125
|
export const DEFAULT_LABEL_FONT_SIZE = 12;
|
|
125
126
|
export const CHART_Y_GROUP_TYPE = {
|
|
126
127
|
COUNT: 'count',
|
package/dist/locale/lang/de.js
CHANGED
|
@@ -270,6 +270,10 @@ const de = {
|
|
|
270
270
|
"Enable_drill_down_feature": "Aktivieren Sie die Drilldown-Funktion",
|
|
271
271
|
"Field_settings": "Feldeinstellungen",
|
|
272
272
|
"Select_all": "Alles auswählen",
|
|
273
|
-
"Visible": "Sichtbar"
|
|
273
|
+
"Visible": "Sichtbar",
|
|
274
|
+
"Goal_line": "Torlinie",
|
|
275
|
+
"Display_goal_line": "Torlinie anzeigen",
|
|
276
|
+
"Goal_value": "Zielwert",
|
|
277
|
+
"Goal_label": "Zielbezeichnung"
|
|
274
278
|
};
|
|
275
279
|
export default de;
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -270,6 +270,10 @@ const en = {
|
|
|
270
270
|
"Enable_drill_down_feature": "Enable drill down feature",
|
|
271
271
|
"Field_settings": "Field settings",
|
|
272
272
|
"Select_all": "Select all",
|
|
273
|
-
"Visible": "Visible"
|
|
273
|
+
"Visible": "Visible",
|
|
274
|
+
"Goal_line": "Goal line",
|
|
275
|
+
"Display_goal_line": "Display goal line",
|
|
276
|
+
"Goal_value": "Goal value",
|
|
277
|
+
"Goal_label": "Goal label"
|
|
274
278
|
};
|
|
275
279
|
export default en;
|
package/dist/locale/lang/es.js
CHANGED
|
@@ -270,6 +270,10 @@ const es = {
|
|
|
270
270
|
"Enable_drill_down_feature": "Enable drill down feature",
|
|
271
271
|
"Field_settings": "Field settings",
|
|
272
272
|
"Select_all": "Select all",
|
|
273
|
-
"Visible": "Visible"
|
|
273
|
+
"Visible": "Visible",
|
|
274
|
+
"Goal_line": "Goal line",
|
|
275
|
+
"Display_goal_line": "Display goal line",
|
|
276
|
+
"Goal_value": "Goal value",
|
|
277
|
+
"Goal_label": "Goal label"
|
|
274
278
|
};
|
|
275
279
|
export default es;
|
package/dist/locale/lang/fr.js
CHANGED
|
@@ -270,6 +270,10 @@ const fr = {
|
|
|
270
270
|
"Enable_drill_down_feature": "Activer la fonctionnalité d'exploration vers le bas",
|
|
271
271
|
"Field_settings": "Paramètres de champ",
|
|
272
272
|
"Select_all": "Tout sélectionner",
|
|
273
|
-
"Visible": "Visible"
|
|
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"
|
|
274
278
|
};
|
|
275
279
|
export default fr;
|
package/dist/locale/lang/pt.js
CHANGED
|
@@ -270,6 +270,10 @@ const pt = {
|
|
|
270
270
|
"Enable_drill_down_feature": "Enable drill down feature",
|
|
271
271
|
"Field_settings": "Field settings",
|
|
272
272
|
"Select_all": "Select all",
|
|
273
|
-
"Visible": "Visible"
|
|
273
|
+
"Visible": "Visible",
|
|
274
|
+
"Goal_line": "Goal line",
|
|
275
|
+
"Display_goal_line": "Display goal line",
|
|
276
|
+
"Goal_value": "Goal value",
|
|
277
|
+
"Goal_label": "Goal label"
|
|
274
278
|
};
|
|
275
279
|
export default pt;
|
package/dist/locale/lang/ru.js
CHANGED
|
@@ -270,6 +270,10 @@ const ru = {
|
|
|
270
270
|
"Enable_drill_down_feature": "Enable drill down feature",
|
|
271
271
|
"Field_settings": "Field settings",
|
|
272
272
|
"Select_all": "Select all",
|
|
273
|
-
"Visible": "Visible"
|
|
273
|
+
"Visible": "Visible",
|
|
274
|
+
"Goal_line": "Goal line",
|
|
275
|
+
"Display_goal_line": "Display goal line",
|
|
276
|
+
"Goal_value": "Goal value",
|
|
277
|
+
"Goal_label": "Goal label"
|
|
274
278
|
};
|
|
275
279
|
export default ru;
|
|
@@ -270,6 +270,10 @@ const zh_CN = {
|
|
|
270
270
|
"Enable_drill_down_feature": "开启钻取功能",
|
|
271
271
|
"Field_settings": "字段设置",
|
|
272
272
|
"Select_all": "选择全部",
|
|
273
|
-
"Visible": "可见"
|
|
273
|
+
"Visible": "可见",
|
|
274
|
+
"Goal_line": "目标线",
|
|
275
|
+
"Display_goal_line": "显示目标线",
|
|
276
|
+
"Goal_value": "目标值",
|
|
277
|
+
"Goal_label": "目标值标签"
|
|
274
278
|
};
|
|
275
279
|
export default zh_CN;
|
|
@@ -7,22 +7,25 @@ import { CellType } from 'dtable-ui-component/lib/constants';
|
|
|
7
7
|
import Divider from '../widgets/divider';
|
|
8
8
|
import MinMaxSetting from '../widgets/min-max-setting';
|
|
9
9
|
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
10
|
-
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, SUPPORT_STACK_VALUE_CHART_TYPES, CHART_TYPE } from '../../constants';
|
|
10
|
+
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, SUPPORT_STACK_VALUE_CHART_TYPES, CHART_TYPE, SUPPORT_GOAL_LINE_CHART_TYPES } from '../../constants';
|
|
11
11
|
import intl from '../../intl';
|
|
12
12
|
import SelectLineType from '../widgets/select-line-type';
|
|
13
13
|
import ColorSelector from '../../components/chart-color-selector/color-selector';
|
|
14
14
|
import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
|
|
15
15
|
import { getColumnByKey } from '../../utils';
|
|
16
|
+
import GoalLineSetting from '../../components/goal-line-setting';
|
|
16
17
|
const StyleSettings = _ref => {
|
|
17
18
|
let {
|
|
18
19
|
chart,
|
|
19
20
|
xLabel,
|
|
20
21
|
yLabel,
|
|
21
22
|
onChange,
|
|
23
|
+
onStyleChange,
|
|
22
24
|
tables
|
|
23
25
|
} = _ref;
|
|
24
26
|
const {
|
|
25
|
-
config
|
|
27
|
+
config,
|
|
28
|
+
style_config
|
|
26
29
|
} = chart;
|
|
27
30
|
const {
|
|
28
31
|
x_axis_show_label,
|
|
@@ -42,6 +45,11 @@ const StyleSettings = _ref => {
|
|
|
42
45
|
column_groupby_column_key,
|
|
43
46
|
table_id
|
|
44
47
|
} = config;
|
|
48
|
+
const {
|
|
49
|
+
display_goal_line,
|
|
50
|
+
goal_value,
|
|
51
|
+
goal_label
|
|
52
|
+
} = style_config || {};
|
|
45
53
|
const table = tables.find(table => table._id === table_id);
|
|
46
54
|
const column = getColumnByKey(column_groupby_column_key, table.columns);
|
|
47
55
|
const isGroupBySingleSelectColumn = (column === null || column === void 0 ? void 0 : column.type) === CellType.SINGLE_SELECT;
|
|
@@ -219,7 +227,12 @@ const StyleSettings = _ref => {
|
|
|
219
227
|
}), isGroupBySingleSelectColumn && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(ColorSelector, {
|
|
220
228
|
colorTheme: color_theme || defaultColorTheme,
|
|
221
229
|
onChange: onChartColorChange
|
|
222
|
-
})), /*#__PURE__*/React.createElement(Divider, null),
|
|
230
|
+
})), /*#__PURE__*/React.createElement(Divider, null), SUPPORT_GOAL_LINE_CHART_TYPES.includes(type) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoalLineSetting, {
|
|
231
|
+
displayGoalLine: display_goal_line,
|
|
232
|
+
goalLabel: goal_label,
|
|
233
|
+
goalValue: goal_value,
|
|
234
|
+
onChange: onStyleChange
|
|
235
|
+
}), /*#__PURE__*/React.createElement(Divider, null)), ![CHART_TYPE.BAR_CUSTOM].includes(type) && /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
223
236
|
isShowValueKey: "y_axis_show_value",
|
|
224
237
|
isShowValue: y_axis_show_value,
|
|
225
238
|
fontSizeKey: "label_font_size",
|
|
@@ -7,15 +7,17 @@ import Divider from '../widgets/divider';
|
|
|
7
7
|
import MinMaxSetting from '../widgets/min-max-setting';
|
|
8
8
|
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
9
9
|
import ColorUseTypeSelector from '../widgets/color-settings';
|
|
10
|
-
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, CHART_TYPE } from '../../constants';
|
|
10
|
+
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, CHART_TYPE, SUPPORT_GOAL_LINE_CHART_TYPES } from '../../constants';
|
|
11
11
|
import intl from '../../intl';
|
|
12
12
|
import SelectLineType from '../widgets/select-line-type';
|
|
13
|
+
import GoalLineSetting from '../../components/goal-line-setting';
|
|
13
14
|
const StyleSettings = _ref => {
|
|
14
15
|
let {
|
|
15
16
|
chart,
|
|
16
17
|
xLabel,
|
|
17
18
|
yLabel,
|
|
18
19
|
onChange,
|
|
20
|
+
onStyleChange,
|
|
19
21
|
labelColorConfigs
|
|
20
22
|
} = _ref;
|
|
21
23
|
const xAxisLabelOptions = useMemo(() => {
|
|
@@ -95,7 +97,8 @@ const StyleSettings = _ref => {
|
|
|
95
97
|
onChange && onChange(update);
|
|
96
98
|
}, [onChange]);
|
|
97
99
|
const {
|
|
98
|
-
config
|
|
100
|
+
config,
|
|
101
|
+
style_config
|
|
99
102
|
} = chart;
|
|
100
103
|
const {
|
|
101
104
|
x_axis_show_label,
|
|
@@ -110,6 +113,11 @@ const StyleSettings = _ref => {
|
|
|
110
113
|
type,
|
|
111
114
|
line_type
|
|
112
115
|
} = config;
|
|
116
|
+
const {
|
|
117
|
+
display_goal_line,
|
|
118
|
+
goal_value,
|
|
119
|
+
goal_label
|
|
120
|
+
} = style_config || {};
|
|
113
121
|
const xAxisLabelPosition = x_axis_label_position || xAxisLabelOptions[0];
|
|
114
122
|
const yAxisLabelPosition = y_axis_label_position || yAxisLabelOptions[0];
|
|
115
123
|
const isLineChart = [CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP].includes(type);
|
|
@@ -171,7 +179,12 @@ const StyleSettings = _ref => {
|
|
|
171
179
|
chart: chart.config,
|
|
172
180
|
labelColorConfigs: labelColorConfigs,
|
|
173
181
|
updateChart: onColorChange
|
|
174
|
-
}), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(
|
|
182
|
+
}), /*#__PURE__*/React.createElement(Divider, null), SUPPORT_GOAL_LINE_CHART_TYPES.includes(type) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoalLineSetting, {
|
|
183
|
+
displayGoalLine: display_goal_line,
|
|
184
|
+
goalLabel: goal_label,
|
|
185
|
+
goalValue: goal_value,
|
|
186
|
+
onChange: onStyleChange
|
|
187
|
+
}), /*#__PURE__*/React.createElement(Divider, null)), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
175
188
|
isShowValueKey: "y_axis_show_value",
|
|
176
189
|
isShowValue: y_axis_show_value,
|
|
177
190
|
fontSizeKey: "label_font_size",
|
|
@@ -6,13 +6,15 @@ import { Label, Row } from 'reactstrap';
|
|
|
6
6
|
import Divider from '../widgets/divider';
|
|
7
7
|
import MinMaxSetting from '../widgets/min-max-setting';
|
|
8
8
|
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
9
|
-
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../constants';
|
|
9
|
+
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW, SUPPORT_GOAL_LINE_CHART_TYPES } from '../../constants';
|
|
10
10
|
import intl from '../../intl';
|
|
11
11
|
import SelectLineType from '../widgets/select-line-type';
|
|
12
|
+
import GoalLineSetting from '../../components/goal-line-setting';
|
|
12
13
|
const StyleSettings = _ref => {
|
|
13
14
|
let {
|
|
14
15
|
chart,
|
|
15
16
|
onChange,
|
|
17
|
+
onStyleChange,
|
|
16
18
|
xLabel
|
|
17
19
|
} = _ref;
|
|
18
20
|
const xAxisLabelOptions = X_LABEL_POSITIONS;
|
|
@@ -73,8 +75,14 @@ const StyleSettings = _ref => {
|
|
|
73
75
|
}, {});
|
|
74
76
|
};
|
|
75
77
|
const {
|
|
76
|
-
config
|
|
78
|
+
config,
|
|
79
|
+
style_config
|
|
77
80
|
} = chart;
|
|
81
|
+
const {
|
|
82
|
+
display_goal_line,
|
|
83
|
+
goal_value,
|
|
84
|
+
goal_label
|
|
85
|
+
} = style_config || {};
|
|
78
86
|
const {
|
|
79
87
|
x_axis_show_label,
|
|
80
88
|
x_axis_label_position,
|
|
@@ -90,7 +98,8 @@ const StyleSettings = _ref => {
|
|
|
90
98
|
y_axis_max_right,
|
|
91
99
|
display_data,
|
|
92
100
|
label_font_size,
|
|
93
|
-
line_type
|
|
101
|
+
line_type,
|
|
102
|
+
type
|
|
94
103
|
} = config;
|
|
95
104
|
const xAxisLabelPosition = x_axis_label_position || xAxisLabelOptions[0];
|
|
96
105
|
const yLeftAxisLabelPosition = y_axis_left_label_position || yAxisLabelOptions[0];
|
|
@@ -169,7 +178,12 @@ const StyleSettings = _ref => {
|
|
|
169
178
|
onMinChange: value => onYAxisMinChange('y_axis_min_right', value),
|
|
170
179
|
onMaxChange: value => onYAxisMaxChange('y_axis_max_right', value)
|
|
171
180
|
})))
|
|
172
|
-
}), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(
|
|
181
|
+
}), /*#__PURE__*/React.createElement(Divider, null), SUPPORT_GOAL_LINE_CHART_TYPES.includes(type) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoalLineSetting, {
|
|
182
|
+
displayGoalLine: display_goal_line,
|
|
183
|
+
goalLabel: goal_label,
|
|
184
|
+
goalValue: goal_value,
|
|
185
|
+
onChange: onStyleChange
|
|
186
|
+
}), /*#__PURE__*/React.createElement(Divider, null)), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
173
187
|
isShowValueKey: "display_data",
|
|
174
188
|
isShowValue: display_data,
|
|
175
189
|
fontSizeKey: "label_font_size",
|
|
@@ -30,6 +30,15 @@ const StyleSettings = _ref => {
|
|
|
30
30
|
config: newUpdate
|
|
31
31
|
});
|
|
32
32
|
}, [chart, onChange]);
|
|
33
|
+
const modifyStyleSettings = useCallback(update => {
|
|
34
|
+
const newUpdate = {
|
|
35
|
+
...chart.style_config,
|
|
36
|
+
...update
|
|
37
|
+
};
|
|
38
|
+
onChange({
|
|
39
|
+
style_config: newUpdate
|
|
40
|
+
});
|
|
41
|
+
}, [chart.style_config, onChange]);
|
|
33
42
|
const modifyTitle = useCallback(title => {
|
|
34
43
|
const {
|
|
35
44
|
style_config
|
|
@@ -70,6 +79,7 @@ const StyleSettings = _ref => {
|
|
|
70
79
|
chart,
|
|
71
80
|
tables,
|
|
72
81
|
onChange: modifyStatisticSettings,
|
|
82
|
+
onStyleChange: modifyStyleSettings,
|
|
73
83
|
labelColorConfigs
|
|
74
84
|
};
|
|
75
85
|
switch (type) {
|
|
@@ -141,7 +151,7 @@ const StyleSettings = _ref => {
|
|
|
141
151
|
return null;
|
|
142
152
|
}
|
|
143
153
|
}
|
|
144
|
-
}, [chart, labelColorConfigs, modifyStatisticSettings, tables]);
|
|
154
|
+
}, [chart, labelColorConfigs, modifyStatisticSettings, modifyStyleSettings, tables]);
|
|
145
155
|
return /*#__PURE__*/React.createElement(React.Fragment, null, renderTitleSettings(), renderStatisticStyleSettings());
|
|
146
156
|
};
|
|
147
157
|
export default StyleSettings;
|
|
@@ -413,6 +413,9 @@ BaseUtils.isChartSortChange = (preChartElement, curChartElement) => {
|
|
|
413
413
|
BaseUtils.isChartStyleChanged = (prevElement, currElement) => {
|
|
414
414
|
const prevStyleConfig = prevElement && prevElement.style_config;
|
|
415
415
|
const currStyleConfig = currElement && currElement.style_config;
|
|
416
|
+
if (prevStyleConfig.display_goal_line !== currStyleConfig.display_goal_line && (!currStyleConfig.goal_lable || !currStyleConfig.goal_value)) {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
416
419
|
if (!prevStyleConfig && !currStyleConfig) {
|
|
417
420
|
return false;
|
|
418
421
|
}
|
|
@@ -80,6 +80,13 @@ class Area extends ChartComponent {
|
|
|
80
80
|
color_option,
|
|
81
81
|
color_theme
|
|
82
82
|
} = chart.config;
|
|
83
|
+
const {
|
|
84
|
+
display_goal_line,
|
|
85
|
+
goal_label,
|
|
86
|
+
goal_value
|
|
87
|
+
} = chart.style_config;
|
|
88
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
89
|
+
|
|
83
90
|
const newData = this.getChartGroupData(data);
|
|
84
91
|
const isSmooth = line_type === CHART_LINE_TYPES[1];
|
|
85
92
|
const isMultipleSummary = summary_columns && summary_columns.length;
|
|
@@ -200,6 +207,9 @@ class Area extends ChartComponent {
|
|
|
200
207
|
});
|
|
201
208
|
this.chart.render();
|
|
202
209
|
});
|
|
210
|
+
if (display_goal_line && goal_label && goal_value) {
|
|
211
|
+
this.setDispalyGoalLine(goal_label, goal_value, chartWidth);
|
|
212
|
+
}
|
|
203
213
|
this.setToolTipForArea();
|
|
204
214
|
isFunction(customRender) && customRender(this.chart);
|
|
205
215
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
|
@@ -81,6 +81,11 @@ class BarCustom extends ChartComponent {
|
|
|
81
81
|
label_font_size,
|
|
82
82
|
display_each_block_data
|
|
83
83
|
} = chart.config;
|
|
84
|
+
const {
|
|
85
|
+
display_goal_line,
|
|
86
|
+
goal_value,
|
|
87
|
+
goal_label
|
|
88
|
+
} = chart.style_config;
|
|
84
89
|
const displayData = display_each_block_data;
|
|
85
90
|
this.chart.scale('group_name', {
|
|
86
91
|
type: 'cat'
|
|
@@ -169,6 +174,9 @@ class BarCustom extends ChartComponent {
|
|
|
169
174
|
};
|
|
170
175
|
}
|
|
171
176
|
});
|
|
177
|
+
if (display_goal_line && goal_label && goal_value) {
|
|
178
|
+
this.setDispalyGoalLine(goal_label, goal_value, chartWidth);
|
|
179
|
+
}
|
|
172
180
|
this.setToolTip();
|
|
173
181
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
|
174
182
|
this.setValueLabel(theme);
|
|
@@ -84,6 +84,11 @@ class BarGroup extends ChartComponent {
|
|
|
84
84
|
column_groupby_column_key,
|
|
85
85
|
color_theme
|
|
86
86
|
} = chart.config;
|
|
87
|
+
const {
|
|
88
|
+
display_goal_line,
|
|
89
|
+
goal_value,
|
|
90
|
+
goal_label
|
|
91
|
+
} = chart.style_config;
|
|
87
92
|
const theme = CHART_THEME_COLOR[globalTheme];
|
|
88
93
|
const isGroup = type === CHART_TYPE.BAR_GROUP;
|
|
89
94
|
const newData = this.getChartGroupData(data);
|
|
@@ -91,7 +96,7 @@ class BarGroup extends ChartComponent {
|
|
|
91
96
|
const useSingleSelectColumnColor = (column_groupby_column === null || column_groupby_column === void 0 ? void 0 : column_groupby_column.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
92
97
|
let singleBarWidth, singleBarRadius;
|
|
93
98
|
// y-axis label width:6 + 10
|
|
94
|
-
const chartWidth = this.chart.width - 6 - 10;
|
|
99
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
95
100
|
if (!isGroup) {
|
|
96
101
|
singleBarWidth = Math.round(chartWidth / (2 * newData.length));
|
|
97
102
|
this.markFirstOrLast(data, 'first');
|
|
@@ -199,6 +204,9 @@ class BarGroup extends ChartComponent {
|
|
|
199
204
|
if (isGroup) {
|
|
200
205
|
this.formatDataByName(data);
|
|
201
206
|
}
|
|
207
|
+
if (display_goal_line && goal_label && goal_value) {
|
|
208
|
+
this.setDispalyGoalLine(goal_label, goal_value, chartWidth);
|
|
209
|
+
}
|
|
202
210
|
this.setToolTip(isGroup, summaryColumn, y_axis_summary_method, useSingleSelectColumnColor);
|
|
203
211
|
isFunction(customRender) && customRender(this.chart);
|
|
204
212
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -69,8 +69,13 @@ class Bar extends ChartComponent {
|
|
|
69
69
|
y_axis_label_color_rules,
|
|
70
70
|
table_id
|
|
71
71
|
} = chart.config;
|
|
72
|
+
const {
|
|
73
|
+
display_goal_line,
|
|
74
|
+
goal_value,
|
|
75
|
+
goal_label
|
|
76
|
+
} = chart.style_config;
|
|
72
77
|
// y-axis label width:6 + 10
|
|
73
|
-
const chartWidth = this.chart.width - 6 - 10;
|
|
78
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
74
79
|
const singleBarWidth = Math.round(chartWidth / (2 * data.length));
|
|
75
80
|
const singleBarRadius = Math.min(singleBarWidth / 5, 10);
|
|
76
81
|
let chartBarColor = y_axis_label_color || CHART_STYLE_COLORS[0];
|
|
@@ -113,6 +118,9 @@ class Bar extends ChartComponent {
|
|
|
113
118
|
radius: [singleBarRadius, singleBarRadius, 0, 0]
|
|
114
119
|
};
|
|
115
120
|
});
|
|
121
|
+
if (display_goal_line && goal_label && goal_value) {
|
|
122
|
+
this.setDispalyGoalLine(goal_label, goal_value, chartWidth);
|
|
123
|
+
}
|
|
116
124
|
this.chart.legend(false);
|
|
117
125
|
this.setToolTip();
|
|
118
126
|
isFunction(customRender) && customRender(this.chart);
|
|
@@ -660,6 +660,28 @@ export default class ChartComponent extends Component {
|
|
|
660
660
|
}
|
|
661
661
|
return themeColors || CHART_THEME_COLOR[THEME_NAME_MAP.LIGHT];
|
|
662
662
|
};
|
|
663
|
+
this.setDispalyGoalLine = (goalLabel, goalValue, chartWidth) => {
|
|
664
|
+
this.chart.annotation().line({
|
|
665
|
+
// start of the annotation line start
|
|
666
|
+
// x start is -0.5
|
|
667
|
+
start: [-0.5, goalValue],
|
|
668
|
+
// x end is infinite
|
|
669
|
+
end: [99999, goalValue],
|
|
670
|
+
style: {
|
|
671
|
+
stroke: '#aaa',
|
|
672
|
+
// dash color
|
|
673
|
+
lineDash: [8, 3] // dash style
|
|
674
|
+
},
|
|
675
|
+
text: {
|
|
676
|
+
content: goalLabel,
|
|
677
|
+
offsetX: chartWidth - 70,
|
|
678
|
+
offsetY: -5,
|
|
679
|
+
style: {
|
|
680
|
+
fill: '#666'
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
};
|
|
663
685
|
this.initLabelStroke(props === null || props === void 0 ? void 0 : props.globalTheme);
|
|
664
686
|
}
|
|
665
687
|
componentDidUpdate(prevProps) {
|
|
@@ -51,6 +51,11 @@ class Combination extends ChartComponent {
|
|
|
51
51
|
label_font_size,
|
|
52
52
|
line_type
|
|
53
53
|
} = chart.config;
|
|
54
|
+
const {
|
|
55
|
+
display_goal_line,
|
|
56
|
+
goal_value,
|
|
57
|
+
goal_label
|
|
58
|
+
} = chart.style_config;
|
|
54
59
|
this.chart = new Chart({
|
|
55
60
|
container: this.container,
|
|
56
61
|
autoFit: true,
|
|
@@ -61,7 +66,7 @@ class Combination extends ChartComponent {
|
|
|
61
66
|
const isSmooth = line_type === CHART_LINE_TYPES[1] || !line_type;
|
|
62
67
|
|
|
63
68
|
// y-axis label width:6 + 10
|
|
64
|
-
const chartWidth = this.chart.width - 6 - 10;
|
|
69
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
65
70
|
const nameCountMap = data.reduce((acc, cur) => {
|
|
66
71
|
if (!acc[cur.name]) {
|
|
67
72
|
acc[cur.name] = 1;
|
|
@@ -395,6 +400,9 @@ class Combination extends ChartComponent {
|
|
|
395
400
|
});
|
|
396
401
|
this.chart.render(true);
|
|
397
402
|
}, 100));
|
|
403
|
+
if (display_goal_line && goal_label && goal_value) {
|
|
404
|
+
this.setDispalyGoalLine(goal_label, goal_value, chartWidth);
|
|
405
|
+
}
|
|
398
406
|
isFunction(customRender) && customRender(this.chart);
|
|
399
407
|
this.chart.removeInteraction('legend-filter');
|
|
400
408
|
requestAnimationFrame(() => {
|
|
@@ -91,7 +91,7 @@ class Compare extends ChartComponent {
|
|
|
91
91
|
// set the single bar width and radius
|
|
92
92
|
let singleBarWidth, singleBarRadius;
|
|
93
93
|
// y-axis label width:6 + 10
|
|
94
|
-
const chartWidth = this.chart.width - 6 - 10;
|
|
94
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
95
95
|
const maxCountGroup = maxBy(chartData, 'currentGroupCount');
|
|
96
96
|
singleBarWidth = Math.round(chartWidth / (2 * chartData.length * maxCountGroup.currentGroupCount));
|
|
97
97
|
singleBarRadius = Math.min(singleBarWidth / 5, 10);
|
|
@@ -65,6 +65,13 @@ class LineGroup extends ChartComponent {
|
|
|
65
65
|
const chartBarColor = this.groupName;
|
|
66
66
|
const newData = this.getChartGroupData(data);
|
|
67
67
|
this.drawLabels(newData);
|
|
68
|
+
const {
|
|
69
|
+
display_goal_line,
|
|
70
|
+
goal_label,
|
|
71
|
+
goal_value
|
|
72
|
+
} = chart.style_config;
|
|
73
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
74
|
+
|
|
68
75
|
const useSingleSelectColumnColor = (columnGroupbyColumn === null || columnGroupbyColumn === void 0 ? void 0 : columnGroupbyColumn.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
69
76
|
useSingleSelectColumnColor ? this.setSingleSelectColorMap(data) : this.setColorMap(data, chartColorTheme);
|
|
70
77
|
const isSmooth = line_type === CHART_LINE_TYPES[1];
|
|
@@ -143,6 +150,9 @@ class LineGroup extends ChartComponent {
|
|
|
143
150
|
// this.chart.render();
|
|
144
151
|
// });
|
|
145
152
|
|
|
153
|
+
if (display_goal_line && goal_label && goal_value) {
|
|
154
|
+
this.setDispalyGoalLine(goal_label, goal_value, chartWidth);
|
|
155
|
+
}
|
|
146
156
|
this.setToolTipForLine();
|
|
147
157
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
|
148
158
|
this.setValueLabel(theme);
|
|
@@ -66,6 +66,12 @@ class Line extends ChartComponent {
|
|
|
66
66
|
color_option
|
|
67
67
|
// y_axis_label_color_rules
|
|
68
68
|
} = chart.config;
|
|
69
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
70
|
+
const {
|
|
71
|
+
display_goal_line,
|
|
72
|
+
goal_label,
|
|
73
|
+
goal_value
|
|
74
|
+
} = chart.style_config;
|
|
69
75
|
let chartBarColor;
|
|
70
76
|
// default color
|
|
71
77
|
chartBarColor = CHART_STYLE_COLORS[0];
|
|
@@ -148,6 +154,10 @@ class Line extends ChartComponent {
|
|
|
148
154
|
// });
|
|
149
155
|
// this.chart.render();
|
|
150
156
|
// });
|
|
157
|
+
|
|
158
|
+
if (display_goal_line && goal_label && goal_value) {
|
|
159
|
+
this.setDispalyGoalLine(goal_label, goal_value, chartWidth);
|
|
160
|
+
}
|
|
151
161
|
this.setToolTipForLine();
|
|
152
162
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
|
153
163
|
this.setValueLabel(theme);
|