sea-chart 0.0.28-beta → 0.0.29
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/constants/index.js +0 -1
- package/dist/constants/type-image.js +1 -1
- package/dist/locale/lang/de.js +1 -1
- package/dist/locale/lang/en.js +3 -3
- package/dist/locale/lang/es.js +2 -3
- package/dist/locale/lang/fr.js +2 -3
- package/dist/locale/lang/pt.js +1 -2
- package/dist/locale/lang/ru.js +1 -2
- package/dist/locale/lang/zh_CN.js +2 -2
- package/dist/model/chart.js +7 -9
- package/dist/model/compare-bar.js +1 -1
- package/dist/settings/advance-bar-settings/style-settings.js +42 -22
- package/dist/settings/bar-settings/style-settings.js +2 -2
- package/dist/settings/scatter/data-settings.js +1 -1
- package/dist/settings/style-settings.js +3 -12
- package/dist/settings/widgets/divider/index.js +8 -1
- package/dist/utils/chart-utils/base-utils.js +1 -1
- package/dist/utils/sql/chart-data-sql.js +21 -38
- package/dist/view/title/index.js +2 -5
- package/dist/view/wrapper/bar-custom.js +3 -1
- package/dist/view/wrapper/bar-group.js +3 -1
- package/dist/view/wrapper/bar.js +3 -1
- package/dist/view/wrapper/combination.js +3 -1
- package/dist/view/wrapper/compare.js +5 -2
- package/dist/view/wrapper/completeness.js +3 -1
- package/dist/view/wrapper/horizontal-bar-group.js +3 -1
- package/dist/view/wrapper/horizontal-bar.js +3 -1
- package/dist/view/wrapper/map.js +3 -1
- package/dist/view/wrapper/mirror.js +3 -1
- package/dist/view/wrapper/scatter.js +3 -1
- package/dist/view/wrapper/world-map.js +4 -2
- package/package.json +2 -2
package/dist/constants/index.js
CHANGED
|
@@ -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]: '
|
|
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',
|
package/dist/locale/lang/de.js
CHANGED
|
@@ -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
|
|
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;
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -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,8 +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
|
|
248
|
-
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
249
|
-
'Count_description': 'Count the number of records based on data settings'
|
|
248
|
+
'Count_description': 'Count the number of records based on data settings',
|
|
249
|
+
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
250
250
|
};
|
|
251
251
|
export default en;
|
package/dist/locale/lang/es.js
CHANGED
|
@@ -167,8 +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
|
|
171
|
-
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
172
|
-
'Count_description': 'Count the number of records based on data settings'
|
|
170
|
+
'Count_description': 'Count the number of records based on data settings',
|
|
171
|
+
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
173
172
|
};
|
|
174
173
|
export default es;
|
package/dist/locale/lang/fr.js
CHANGED
|
@@ -167,8 +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
|
|
171
|
-
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
172
|
-
'Count_description': 'Count the number of records based on data settings'
|
|
170
|
+
'Count_description': 'Count the number of records based on data settings',
|
|
171
|
+
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
173
172
|
};
|
|
174
173
|
export default fr;
|
package/dist/locale/lang/pt.js
CHANGED
|
@@ -168,7 +168,6 @@ const pt = {
|
|
|
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
170
|
'Count_description': 'Count the number of records based on data settings',
|
|
171
|
-
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
172
|
-
'Count_description': 'Count the number of records based on data settings'
|
|
171
|
+
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
173
172
|
};
|
|
174
173
|
export default pt;
|
package/dist/locale/lang/ru.js
CHANGED
|
@@ -168,7 +168,6 @@ const ru = {
|
|
|
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
170
|
'Count_description': 'Count the number of records based on data settings',
|
|
171
|
-
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
172
|
-
'Count_description': 'Count the number of records based on data settings'
|
|
171
|
+
'Display_empty_when_data_is_zero': 'Display empty when data is zero'
|
|
173
172
|
};
|
|
174
173
|
export default ru;
|
|
@@ -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': '提交',
|
|
@@ -245,7 +246,6 @@ const zh_CN = {
|
|
|
245
246
|
'Line_type': '线型',
|
|
246
247
|
'Summarize_description': '按照一个字段计算记录的总和、最大值、最小值或者平均值',
|
|
247
248
|
'Count_description': '根据数据设置计算记录数量',
|
|
248
|
-
'Display_empty_when_data_is_zero': '数据为零时留空'
|
|
249
|
-
'Count_description': '根据数据设置计算记录数量'
|
|
249
|
+
'Display_empty_when_data_is_zero': '数据为零时留空'
|
|
250
250
|
};
|
|
251
251
|
export default zh_CN;
|
package/dist/model/chart.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generateChartConfig } from '../utils';
|
|
2
|
-
import { HORIZONTAL_ALIGN, DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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",
|
|
@@ -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('
|
|
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
|
|
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,
|
|
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
|
};
|
|
@@ -80,7 +80,7 @@ BaseUtils.isValidExistChart = (tables, chart) => {
|
|
|
80
80
|
// if current chart is using "groupby_column_key" as key
|
|
81
81
|
// if groupby_column_key is null, still return false
|
|
82
82
|
let groupByColumnKey = config.groupby_column_key || config.x_axis_column_key || config.vertical_axis_column_key || config.columnKey || config.date_column_key;
|
|
83
|
-
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)) {
|
|
84
84
|
groupByColumnKey = config.x_axis_column_key;
|
|
85
85
|
}
|
|
86
86
|
if ([CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.HORIZONTAL_GROUP_BAR, CHART_TYPE.STACKED_HORIZONTAL_BAR].includes(config.type)) {
|
|
@@ -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
|
|
394
|
-
|
|
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(
|
|
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 = '
|
|
378
|
+
this.error = 'Summary_column_not_found';
|
|
407
379
|
return '';
|
|
408
380
|
}
|
|
409
381
|
}
|
|
410
|
-
const summary_column = this.
|
|
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
|
|
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'] || '';
|
|
@@ -748,7 +720,14 @@ class ChartDataSQL {
|
|
|
748
720
|
}
|
|
749
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;
|
|
750
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;
|
|
751
|
-
if (!
|
|
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
|
+
}
|
|
752
731
|
if (column_groupby_column_key) {
|
|
753
732
|
const column_groupby_column = this._get_column_by_key(column_groupby_column_key);
|
|
754
733
|
if (!column_groupby_column) {
|
|
@@ -782,6 +761,10 @@ class ChartDataSQL {
|
|
|
782
761
|
// y axis column
|
|
783
762
|
const y_axis_column = this._get_column_by_key(y_axis_column_key);
|
|
784
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
|
+
}
|
|
785
768
|
if (column_groupby_column_key) {
|
|
786
769
|
const column_groupby_column = this._get_column_by_key(column_groupby_column_key);
|
|
787
770
|
if (!column_groupby_column) {
|
package/dist/view/title/index.js
CHANGED
|
@@ -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
|
|
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 (!
|
|
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 => {
|
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -78,7 +78,9 @@ 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
85
|
}).position('name*value').size(singleBarWidth).tooltip('name*value', (name, value) => {
|
|
84
86
|
return {
|
|
@@ -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,7 +76,9 @@ 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
83
|
}).position('name*value')
|
|
82
84
|
// .color(chartBarColor)
|
package/dist/view/wrapper/map.js
CHANGED
|
@@ -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 => {
|
|
@@ -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.
|
|
3
|
+
"version": "0.0.29",
|
|
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",
|