sea-chart 0.0.12 → 0.0.13
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/model/area-group.js +2 -2
- package/dist/model/area.js +2 -2
- package/dist/model/bar-custom.js +2 -2
- package/dist/model/bar-group.js +2 -2
- package/dist/model/bar-stack.js +2 -2
- package/dist/model/bar.js +2 -2
- package/dist/model/completeness.js +2 -2
- package/dist/model/horizontal-bar.js +2 -2
- package/dist/model/horizontal-group-bar.js +2 -2
- package/dist/model/line-group.js +2 -2
- package/dist/model/line.js +2 -2
- package/dist/settings/advance-bar-settings/style-settings.js +18 -2
- package/dist/settings/bar-settings/style-settings.js +18 -2
- package/dist/settings/data-settings.js +17 -1
- package/dist/settings/horizontal-bar-settings/data-settings.js +2 -4
- package/dist/settings/horizontal-bar-settings/style-settings.js +3 -1
- package/dist/settings/index.js +4 -3
- package/dist/settings/widgets/color-settings/color-use-type-selector.js +15 -26
- package/dist/settings/widgets/date-summary-item.js +1 -1
- package/dist/settings/widgets/numeric-summary-item.js +1 -1
- package/dist/settings/widgets/summary-method-setting.js +1 -5
- package/dist/settings/widgets/summary-settings.js +1 -1
- package/dist/utils/chart-utils/base-utils.js +7 -1
- package/dist/view/wrapper/area.js +6 -2
- package/dist/view/wrapper/bar.js +6 -2
- package/dist/view/wrapper/horizontal-bar.js +6 -2
- package/dist/view/wrapper/horizontal-component.js +9 -9
- package/dist/view/wrapper/line.js +6 -2
- package/package.json +1 -1
package/dist/model/area-group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class AreaGroup extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -26,7 +26,7 @@ class AreaGroup extends BaseModel {
|
|
|
26
26
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
27
27
|
this.y_axis_min = options.y_axis_min;
|
|
28
28
|
this.y_axis_max = options.y_axis_max;
|
|
29
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
29
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
30
30
|
|
|
31
31
|
// column-group
|
|
32
32
|
this.column_groupby_column_key = options.column_groupby_column_key;
|
package/dist/model/area.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class Area extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -24,7 +24,7 @@ class Area extends BaseModel {
|
|
|
24
24
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
25
25
|
this.y_axis_min = options.y_axis_min;
|
|
26
26
|
this.y_axis_max = options.y_axis_max;
|
|
27
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
27
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
28
28
|
this.sort_type = options.sort_type;
|
|
29
29
|
this.label_font_size = options.label_font_size;
|
|
30
30
|
}
|
package/dist/model/bar-custom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class BarCustom extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -30,7 +30,7 @@ class BarCustom extends BaseModel {
|
|
|
30
30
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
31
31
|
this.y_axis_min = options.y_axis_min;
|
|
32
32
|
this.y_axis_max = options.y_axis_max;
|
|
33
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
33
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
34
34
|
this.display_each_block_data = options.display_each_block_data || false;
|
|
35
35
|
this.sort_type = options.sort_type;
|
|
36
36
|
this.label_font_size = options.label_font_size;
|
package/dist/model/bar-group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class BarGroup extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -30,7 +30,7 @@ class BarGroup extends BaseModel {
|
|
|
30
30
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
31
31
|
this.y_axis_min = options.y_axis_min;
|
|
32
32
|
this.y_axis_max = options.y_axis_max;
|
|
33
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
33
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
34
34
|
|
|
35
35
|
// column group
|
|
36
36
|
this.column_groupby_column_key = options.column_groupby_column_key;
|
package/dist/model/bar-stack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class BarStack extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -26,7 +26,7 @@ class BarStack extends BaseModel {
|
|
|
26
26
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
27
27
|
this.y_axis_min = options.y_axis_min;
|
|
28
28
|
this.y_axis_max = options.y_axis_max;
|
|
29
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
29
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
30
30
|
|
|
31
31
|
// column-group
|
|
32
32
|
this.column_groupby_column_key = options.column_groupby_column_key;
|
package/dist/model/bar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class Bar extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -30,7 +30,7 @@ class Bar extends BaseModel {
|
|
|
30
30
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
31
31
|
this.y_axis_min = options.y_axis_min;
|
|
32
32
|
this.y_axis_max = options.y_axis_max;
|
|
33
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
33
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
34
34
|
this.sort_type = options.sort_type;
|
|
35
35
|
this.label_font_size = options.label_font_size;
|
|
36
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE } from '../constants';
|
|
4
4
|
class Completeness extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -10,7 +10,7 @@ class Completeness extends BaseModel {
|
|
|
10
10
|
this.name_column_key = options.x_axis_column_key;
|
|
11
11
|
this.completed_column_key = options.completed_column_key;
|
|
12
12
|
this.target_column_key = options.target_column_key;
|
|
13
|
-
this.completed_color = options.completed_color
|
|
13
|
+
this.completed_color = options.completed_color;
|
|
14
14
|
this.display_percentage = isBoolean(options.display_percentage) ? options.display_percentage : true;
|
|
15
15
|
this.label_font_size = options.label_font_size;
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class HorizontalBar extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -24,7 +24,7 @@ class HorizontalBar extends BaseModel {
|
|
|
24
24
|
this.horizontal_axis_summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
25
25
|
|
|
26
26
|
// horizontal axis style
|
|
27
|
-
this.horizontal_axis_label_color = options.y_axis_label_color
|
|
27
|
+
this.horizontal_axis_label_color = options.y_axis_label_color;
|
|
28
28
|
this.show_horizontal_axis_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
|
|
29
29
|
this.horizontal_axis_label_position = options.y_axis_label_position;
|
|
30
30
|
this.display_data = isBoolean(options.y_axis_show_value) ? options.y_axis_show_value : false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import { CHART_TYPE,
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class HorizontalGroupBar extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -24,7 +24,7 @@ class HorizontalGroupBar extends BaseModel {
|
|
|
24
24
|
this.horizontal_axis_summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
25
25
|
|
|
26
26
|
// horizontal axis style
|
|
27
|
-
this.horizontal_axis_label_color = options.y_axis_label_color
|
|
27
|
+
this.horizontal_axis_label_color = options.y_axis_label_color;
|
|
28
28
|
this.show_horizontal_axis_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
|
|
29
29
|
this.horizontal_axis_label_position = options.y_axis_label_position;
|
|
30
30
|
this.horizontal_axis_auto_range = options.y_axis_auto_range;
|
package/dist/model/line-group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class LineGroup extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -30,7 +30,7 @@ class LineGroup extends BaseModel {
|
|
|
30
30
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
31
31
|
this.y_axis_min = options.y_axis_min;
|
|
32
32
|
this.y_axis_max = options.y_axis_max;
|
|
33
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
33
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
34
34
|
|
|
35
35
|
// column group
|
|
36
36
|
this.column_groupby_column_key = options.column_groupby_column_key;
|
package/dist/model/line.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseModel from './base-model';
|
|
2
2
|
import { isBoolean } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
4
|
class Line extends BaseModel {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super({
|
|
@@ -30,7 +30,7 @@ class Line extends BaseModel {
|
|
|
30
30
|
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
31
31
|
this.y_axis_min = options.y_axis_min;
|
|
32
32
|
this.y_axis_max = options.y_axis_max;
|
|
33
|
-
this.y_axis_label_color = options.y_axis_label_color
|
|
33
|
+
this.y_axis_label_color = options.y_axis_label_color;
|
|
34
34
|
this.sort_type = options.sort_type;
|
|
35
35
|
this.label_font_size = options.label_font_size;
|
|
36
36
|
}
|
|
@@ -17,21 +17,37 @@ const StyleSettings = _ref => {
|
|
|
17
17
|
onChange
|
|
18
18
|
} = _ref;
|
|
19
19
|
const xAxisLabelOptions = useMemo(() => {
|
|
20
|
+
if (xLabel === 'Vertical_axis') {
|
|
21
|
+
return Y_LABEL_POSITIONS.map(item => {
|
|
22
|
+
return {
|
|
23
|
+
value: item,
|
|
24
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
20
28
|
return X_LABEL_POSITIONS.map(item => {
|
|
21
29
|
return {
|
|
22
30
|
value: item,
|
|
23
31
|
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
24
32
|
};
|
|
25
33
|
});
|
|
26
|
-
}, []);
|
|
34
|
+
}, [xLabel]);
|
|
27
35
|
const yAxisLabelOptions = useMemo(() => {
|
|
36
|
+
if (yLabel === 'Horizontal_axis') {
|
|
37
|
+
return X_LABEL_POSITIONS.map(item => {
|
|
38
|
+
return {
|
|
39
|
+
value: item,
|
|
40
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
28
44
|
return Y_LABEL_POSITIONS.map(item => {
|
|
29
45
|
return {
|
|
30
46
|
value: item,
|
|
31
47
|
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
32
48
|
};
|
|
33
49
|
});
|
|
34
|
-
}, []);
|
|
50
|
+
}, [yLabel]);
|
|
35
51
|
const onAxisLabelShowChange = useCallback((event, labelKey) => {
|
|
36
52
|
eventStopPropagation(event);
|
|
37
53
|
const {
|
|
@@ -18,21 +18,37 @@ const StyleSettings = _ref => {
|
|
|
18
18
|
labelColorConfigs
|
|
19
19
|
} = _ref;
|
|
20
20
|
const xAxisLabelOptions = useMemo(() => {
|
|
21
|
+
if (xLabel === 'Vertical_axis') {
|
|
22
|
+
return Y_LABEL_POSITIONS.map(item => {
|
|
23
|
+
return {
|
|
24
|
+
value: item,
|
|
25
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
21
29
|
return X_LABEL_POSITIONS.map(item => {
|
|
22
30
|
return {
|
|
23
31
|
value: item,
|
|
24
32
|
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
25
33
|
};
|
|
26
34
|
});
|
|
27
|
-
}, []);
|
|
35
|
+
}, [xLabel]);
|
|
28
36
|
const yAxisLabelOptions = useMemo(() => {
|
|
37
|
+
if (yLabel === 'Horizontal_axis') {
|
|
38
|
+
return X_LABEL_POSITIONS.map(item => {
|
|
39
|
+
return {
|
|
40
|
+
value: item,
|
|
41
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
29
45
|
return Y_LABEL_POSITIONS.map(item => {
|
|
30
46
|
return {
|
|
31
47
|
value: item,
|
|
32
48
|
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
33
49
|
};
|
|
34
50
|
});
|
|
35
|
-
}, []);
|
|
51
|
+
}, [yLabel]);
|
|
36
52
|
const onAxisLabelShowChange = useCallback((event, labelKey) => {
|
|
37
53
|
eventStopPropagation(event);
|
|
38
54
|
const {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { CHART_TYPE } from '../constants';
|
|
3
3
|
import { BarDataSettings } from './bar-settings';
|
|
4
4
|
import { AdvanceBarDataSettings } from './advance-bar-settings';
|
|
@@ -10,6 +10,8 @@ import { BasicNumberCardDataSettings } from './basic-number-card';
|
|
|
10
10
|
import { CombinationDataSettings } from './combination-settings';
|
|
11
11
|
import { DashboardDataSettings } from './dashboard-settings';
|
|
12
12
|
const DataSettings = props => {
|
|
13
|
+
const [refreshToggle, setRefreshToggle] = useState(false);
|
|
14
|
+
const cacheRef = useRef(props);
|
|
13
15
|
const {
|
|
14
16
|
chart
|
|
15
17
|
} = props;
|
|
@@ -19,6 +21,20 @@ const DataSettings = props => {
|
|
|
19
21
|
const {
|
|
20
22
|
type
|
|
21
23
|
} = config;
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const {
|
|
26
|
+
chart: oldChart
|
|
27
|
+
} = cacheRef.current;
|
|
28
|
+
const {
|
|
29
|
+
chart
|
|
30
|
+
} = props;
|
|
31
|
+
// Refresh settings after changing chart type
|
|
32
|
+
if (oldChart.config.type !== chart.config.type) {
|
|
33
|
+
cacheRef.current = props;
|
|
34
|
+
setRefreshToggle(!refreshToggle);
|
|
35
|
+
}
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
+
}, [props]);
|
|
22
38
|
switch (type) {
|
|
23
39
|
case CHART_TYPE.BAR:
|
|
24
40
|
case CHART_TYPE.BAR_CUSTOM:
|
|
@@ -22,13 +22,11 @@ const DataSettings = _ref => {
|
|
|
22
22
|
...oldConfig,
|
|
23
23
|
...update
|
|
24
24
|
};
|
|
25
|
-
Object.keys(
|
|
25
|
+
Object.keys(update).forEach(key => {
|
|
26
26
|
if (BAR_MAP_TO_HORIZONTAL_MAP[key]) {
|
|
27
27
|
updateConfig[BAR_MAP_TO_HORIZONTAL_MAP[key]] = newConfig[key];
|
|
28
28
|
} else {
|
|
29
|
-
|
|
30
|
-
updateConfig[key] = newConfig[key];
|
|
31
|
-
}
|
|
29
|
+
updateConfig[key] = newConfig[key];
|
|
32
30
|
}
|
|
33
31
|
});
|
|
34
32
|
oldOnChange && oldOnChange(updateConfig);
|
|
@@ -7,6 +7,7 @@ const StyleSettings = _ref => {
|
|
|
7
7
|
let {
|
|
8
8
|
chart,
|
|
9
9
|
tables,
|
|
10
|
+
labelColorConfigs,
|
|
10
11
|
onChange: oldOnChange
|
|
11
12
|
} = _ref;
|
|
12
13
|
const onChange = useCallback(update => {
|
|
@@ -15,7 +16,7 @@ const StyleSettings = _ref => {
|
|
|
15
16
|
...chart.config,
|
|
16
17
|
...update
|
|
17
18
|
};
|
|
18
|
-
Object.keys(
|
|
19
|
+
Object.keys(update).forEach(key => {
|
|
19
20
|
if (BAR_MAP_TO_HORIZONTAL_MAP[key]) {
|
|
20
21
|
updateConfig[BAR_MAP_TO_HORIZONTAL_MAP[key]] = newConfig[key];
|
|
21
22
|
} else {
|
|
@@ -40,6 +41,7 @@ const StyleSettings = _ref => {
|
|
|
40
41
|
return /*#__PURE__*/React.createElement(BarStyleComponent, {
|
|
41
42
|
xLabel: 'Vertical_axis',
|
|
42
43
|
yLabel: 'Horizontal_axis',
|
|
44
|
+
labelColorConfigs: labelColorConfigs,
|
|
43
45
|
chart: newChart,
|
|
44
46
|
onChange: onChange
|
|
45
47
|
});
|
package/dist/settings/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState, useEffect } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { eventStopPropagation } from '../utils';
|
|
4
|
+
import { BaseUtils } from '../utils';
|
|
4
5
|
import DataSettings from './data-settings';
|
|
5
6
|
import StyleSettings from './style-settings';
|
|
6
|
-
import { CHART_SETTINGS_TYPE,
|
|
7
|
+
import { CHART_SETTINGS_TYPE, CHART_SETTINGS } from '../constants';
|
|
7
8
|
import intl from '../intl';
|
|
8
9
|
import Divider from './widgets/divider';
|
|
9
10
|
import './index.css';
|
|
@@ -21,7 +22,7 @@ const Settings = _ref => {
|
|
|
21
22
|
useEffect(() => {
|
|
22
23
|
var _window$dtable;
|
|
23
24
|
const systemCustomColors = ((_window$dtable = window.dtable) === null || _window$dtable === void 0 ? void 0 : _window$dtable.customColors) || [];
|
|
24
|
-
const colorConfigs = [...
|
|
25
|
+
const colorConfigs = [...BaseUtils.getCurrentTheme().colors.map(color => ({
|
|
25
26
|
color: color.toUpperCase(),
|
|
26
27
|
text_color: '#fff'
|
|
27
28
|
})), ...systemCustomColors.map(customColor => ({
|
|
@@ -51,7 +52,7 @@ const Settings = _ref => {
|
|
|
51
52
|
...chart,
|
|
52
53
|
...update
|
|
53
54
|
};
|
|
54
|
-
onChange && onChange(newChart, CHART_SETTINGS_TYPE.
|
|
55
|
+
onChange && onChange(newChart, CHART_SETTINGS_TYPE.CHART_STYLE);
|
|
55
56
|
}, [chart, onChange]);
|
|
56
57
|
const validTitle = useMemo(() => {
|
|
57
58
|
return title || {};
|
|
@@ -56,6 +56,7 @@ class ColorUseTypeSelector extends Component {
|
|
|
56
56
|
return [TYPE_COLOR_USING.USE_DEFAULT, TYPE_COLOR_USING.USE_COLUMN_COLORS];
|
|
57
57
|
}
|
|
58
58
|
case CHART_TYPE.BAR:
|
|
59
|
+
case CHART_TYPE.AREA:
|
|
59
60
|
case CHART_TYPE.LINE:
|
|
60
61
|
case CHART_TYPE.HORIZONTAL_BAR:
|
|
61
62
|
{
|
|
@@ -79,7 +80,7 @@ class ColorUseTypeSelector extends Component {
|
|
|
79
80
|
return {
|
|
80
81
|
value: colorType,
|
|
81
82
|
label: /*#__PURE__*/React.createElement("span", {
|
|
82
|
-
className: "select-module
|
|
83
|
+
className: "select-module"
|
|
83
84
|
}, intl.get(TYPE_DISPLAY_COLOR_USING[colorType]))
|
|
84
85
|
};
|
|
85
86
|
});
|
|
@@ -94,7 +95,9 @@ class ColorUseTypeSelector extends Component {
|
|
|
94
95
|
} = chart;
|
|
95
96
|
switch (type) {
|
|
96
97
|
case CHART_TYPE.LINE:
|
|
98
|
+
case CHART_TYPE.AREA:
|
|
97
99
|
case CHART_TYPE.BAR:
|
|
100
|
+
case CHART_TYPE.HORIZONTAL_BAR:
|
|
98
101
|
{
|
|
99
102
|
const {
|
|
100
103
|
y_axis_label_color
|
|
@@ -104,16 +107,6 @@ class ColorUseTypeSelector extends Component {
|
|
|
104
107
|
}
|
|
105
108
|
return labelColorConfigs[0].color;
|
|
106
109
|
}
|
|
107
|
-
case CHART_TYPE.HORIZONTAL_BAR:
|
|
108
|
-
{
|
|
109
|
-
const {
|
|
110
|
-
horizontal_axis_label_color
|
|
111
|
-
} = chart;
|
|
112
|
-
if (horizontal_axis_label_color) {
|
|
113
|
-
return horizontal_axis_label_color.toUpperCase();
|
|
114
|
-
}
|
|
115
|
-
return labelColorConfigs[0].color;
|
|
116
|
-
}
|
|
117
110
|
default:
|
|
118
111
|
{
|
|
119
112
|
return '';
|
|
@@ -169,27 +162,26 @@ class ColorUseTypeSelector extends Component {
|
|
|
169
162
|
chart,
|
|
170
163
|
labelColorConfigs
|
|
171
164
|
} = this.props;
|
|
172
|
-
let updatedChart =
|
|
165
|
+
let updatedChart = {
|
|
173
166
|
color_option
|
|
174
|
-
}
|
|
167
|
+
};
|
|
175
168
|
if (color_option === TYPE_COLOR_USING.USE_SPECIFIC_COLORS) {
|
|
176
169
|
switch (chart.type) {
|
|
170
|
+
case CHART_TYPE.HORIZONTAL_BAR:
|
|
177
171
|
case CHART_TYPE.BAR:
|
|
178
172
|
{
|
|
179
173
|
updatedChart.y_axis_label_color = updatedChart.y_axis_label_color || labelColorConfigs[0].color;
|
|
180
174
|
break;
|
|
181
175
|
}
|
|
182
|
-
case CHART_TYPE.HORIZONTAL_BAR:
|
|
183
|
-
{
|
|
184
|
-
updatedChart.horizontal_axis_label_color = updatedChart.horizontal_axis_label_color || labelColorConfigs[0].color;
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
176
|
default:
|
|
188
177
|
{
|
|
189
178
|
break;
|
|
190
179
|
}
|
|
191
180
|
}
|
|
192
181
|
}
|
|
182
|
+
if (color_option === TYPE_COLOR_USING.USE_DEFAULT) {
|
|
183
|
+
updatedChart.y_axis_label_color = labelColorConfigs[0].color;
|
|
184
|
+
}
|
|
193
185
|
this.props.updateChart(updatedChart);
|
|
194
186
|
};
|
|
195
187
|
this.onToggleColorSelector = () => {
|
|
@@ -218,16 +210,14 @@ class ColorUseTypeSelector extends Component {
|
|
|
218
210
|
const {
|
|
219
211
|
chart
|
|
220
212
|
} = this.props;
|
|
221
|
-
let updatedChart =
|
|
213
|
+
let updatedChart = {};
|
|
222
214
|
switch (chart.type) {
|
|
223
215
|
case CHART_TYPE.BAR:
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
216
|
+
case CHART_TYPE.AREA:
|
|
217
|
+
case CHART_TYPE.LINE:
|
|
228
218
|
case CHART_TYPE.HORIZONTAL_BAR:
|
|
229
219
|
{
|
|
230
|
-
updatedChart.
|
|
220
|
+
updatedChart.y_axis_label_color = color;
|
|
231
221
|
break;
|
|
232
222
|
}
|
|
233
223
|
default:
|
|
@@ -251,8 +241,7 @@ class ColorUseTypeSelector extends Component {
|
|
|
251
241
|
const {
|
|
252
242
|
chart
|
|
253
243
|
} = this.props;
|
|
254
|
-
|
|
255
|
-
let updatedChart = Object.assign({}, chart);
|
|
244
|
+
let updatedChart = {};
|
|
256
245
|
switch (chart.type) {
|
|
257
246
|
case CHART_TYPE.BAR:
|
|
258
247
|
{
|
|
@@ -85,7 +85,7 @@ class DateSummaryItem extends Component {
|
|
|
85
85
|
}, /*#__PURE__*/React.createElement("i", {
|
|
86
86
|
onClick: this.onToggleExpand,
|
|
87
87
|
className: "icon dtable-font ".concat(isExpand ? 'dtable-icon-drop-down' : 'dtable-icon-right-slide')
|
|
88
|
-
}), /*#__PURE__*/React.createElement("label", null,
|
|
88
|
+
}), /*#__PURE__*/React.createElement("label", null, intl.get('Summary_field') + (1 + index))), /*#__PURE__*/React.createElement("span", {
|
|
89
89
|
className: "title-item title-right"
|
|
90
90
|
}, index !== 0 && /*#__PURE__*/React.createElement("i", {
|
|
91
91
|
className: "dtable-font dtable-icon-fork-number close-icon",
|
|
@@ -47,7 +47,7 @@ class NumericSummaryItem extends Component {
|
|
|
47
47
|
column_key,
|
|
48
48
|
summary_method
|
|
49
49
|
} = value;
|
|
50
|
-
const selectedColumnOption = numericColumnOptions.find(option => option.value === column_key);
|
|
50
|
+
const selectedColumnOption = numericColumnOptions.find(option => option.value.key === column_key);
|
|
51
51
|
const selectedSummaryMethodOption = this.summaryMethodOptions.find(option => option.value === summary_method);
|
|
52
52
|
const {
|
|
53
53
|
isExpand
|
|
@@ -34,13 +34,9 @@ class SummaryMethodSettings extends Component {
|
|
|
34
34
|
}
|
|
35
35
|
render() {
|
|
36
36
|
const {
|
|
37
|
-
chart,
|
|
38
37
|
value,
|
|
39
38
|
numericColumnOptions
|
|
40
39
|
} = this.props;
|
|
41
|
-
const {
|
|
42
|
-
type
|
|
43
|
-
} = chart.config;
|
|
44
40
|
const {
|
|
45
41
|
column_key,
|
|
46
42
|
summary_method
|
|
@@ -49,7 +45,7 @@ class SummaryMethodSettings extends Component {
|
|
|
49
45
|
const selectedSummaryMethodOption = this.summaryMethodOptions.find(option => option.value === summary_method);
|
|
50
46
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
51
47
|
className: "chart-parameter-item"
|
|
52
|
-
}, /*#__PURE__*/React.createElement(Label, null,
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Summary_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
53
49
|
value: selectedColumnOption,
|
|
54
50
|
placeholder: intl.get('Select_a_column'),
|
|
55
51
|
onChange: this.props.onColumnOptionChange,
|
|
@@ -186,7 +186,7 @@ class SummarySettings extends Component {
|
|
|
186
186
|
let selectedColumnOption = this.numericColumnsOptions.find(o => o.value.key === summaryColumn);
|
|
187
187
|
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
188
188
|
className: "sea-chart-parameter-item"
|
|
189
|
-
}, /*#__PURE__*/React.createElement("label", null, intl.get('
|
|
189
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
190
190
|
value: selectedColumnOption,
|
|
191
191
|
onChange: this.onSelectSummaryColumn,
|
|
192
192
|
options: this.numericColumnsOptions,
|
|
@@ -72,7 +72,13 @@ BaseUtils.isValidExistChart = (tables, chart, rule) => {
|
|
|
72
72
|
if (!getTableColumnByKey(table, targetColumnKey)) return false;
|
|
73
73
|
return getTableColumnByKey(table, totalColumnKey);
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
let groupByColumnKey = config.groupby_column_key || config.x_axis_column_key || config.vertical_axis_column_key;
|
|
76
|
+
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)) {
|
|
77
|
+
groupByColumnKey = config.x_axis_column_key;
|
|
78
|
+
}
|
|
79
|
+
if ([CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.HORIZONTAL_GROUP_BAR].includes(config.type)) {
|
|
80
|
+
groupByColumnKey = config.vertical_axis_column_key;
|
|
81
|
+
}
|
|
76
82
|
if (!groupByColumnKey) return false;
|
|
77
83
|
if (!getTableColumnByKey(table, groupByColumnKey)) return false;
|
|
78
84
|
if (type === CHART_TYPE.COMBINATION) {
|
|
@@ -42,7 +42,8 @@ class Area extends ChartComponent {
|
|
|
42
42
|
chart,
|
|
43
43
|
summaryColumn,
|
|
44
44
|
theme,
|
|
45
|
-
customRender
|
|
45
|
+
customRender,
|
|
46
|
+
themeName
|
|
46
47
|
} = this.props;
|
|
47
48
|
const {
|
|
48
49
|
y_axis_summary_type,
|
|
@@ -51,7 +52,10 @@ class Area extends ChartComponent {
|
|
|
51
52
|
y_axis_show_value,
|
|
52
53
|
label_font_size
|
|
53
54
|
} = chart.config;
|
|
54
|
-
|
|
55
|
+
let chartBarColor = y_axis_label_color || '#5B8FF9';
|
|
56
|
+
if (themeName) {
|
|
57
|
+
chartBarColor = BaseUtils.getCurrentTheme(themeName).colors[0];
|
|
58
|
+
}
|
|
55
59
|
this.drawLabels(data);
|
|
56
60
|
|
|
57
61
|
// set Coord type
|
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -44,7 +44,8 @@ class Bar extends ChartComponent {
|
|
|
44
44
|
chart,
|
|
45
45
|
summaryColumn,
|
|
46
46
|
theme,
|
|
47
|
-
customRender
|
|
47
|
+
customRender,
|
|
48
|
+
themeName
|
|
48
49
|
} = this.props;
|
|
49
50
|
const {
|
|
50
51
|
y_axis_summary_type,
|
|
@@ -55,7 +56,10 @@ class Bar extends ChartComponent {
|
|
|
55
56
|
color_option,
|
|
56
57
|
y_axis_label_color_rules
|
|
57
58
|
} = chart.config;
|
|
58
|
-
|
|
59
|
+
let chartBarColor = y_axis_label_color || '#5B8FF9';
|
|
60
|
+
if (themeName) {
|
|
61
|
+
chartBarColor = BaseUtils.getCurrentTheme(themeName).colors[0];
|
|
62
|
+
}
|
|
59
63
|
const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && getConvertedColorRules(y_axis_label_color_rules);
|
|
60
64
|
this.drawLabels(data);
|
|
61
65
|
|
|
@@ -44,7 +44,8 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
44
44
|
const {
|
|
45
45
|
chart,
|
|
46
46
|
summaryColumn,
|
|
47
|
-
theme
|
|
47
|
+
theme,
|
|
48
|
+
themeName
|
|
48
49
|
} = this.props;
|
|
49
50
|
const {
|
|
50
51
|
horizontal_axis_summary_type,
|
|
@@ -53,7 +54,10 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
53
54
|
display_data,
|
|
54
55
|
label_font_size
|
|
55
56
|
} = chart.config;
|
|
56
|
-
|
|
57
|
+
let chartBarColor = horizontal_axis_label_color || '#5B8FF9';
|
|
58
|
+
if (themeName) {
|
|
59
|
+
chartBarColor = BaseUtils.getCurrentTheme(themeName).colors[0];
|
|
60
|
+
}
|
|
57
61
|
data.reverse();
|
|
58
62
|
this.drawLabels(data);
|
|
59
63
|
|
|
@@ -11,8 +11,8 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
11
11
|
table_id,
|
|
12
12
|
x_axis_column_key,
|
|
13
13
|
y_axis_summary_column_key,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
vertical_axis_label_position,
|
|
15
|
+
horizontal_axis_label_position,
|
|
16
16
|
y_axis_summary_type,
|
|
17
17
|
show_vertical_axis_label,
|
|
18
18
|
show_horizontal_axis_label
|
|
@@ -33,11 +33,11 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
33
33
|
const column = getTableColumnByKey(table, y_axis_summary_column_key);
|
|
34
34
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
35
35
|
}
|
|
36
|
-
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(
|
|
36
|
+
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(horizontal_axis_label_position, "; bottom: -20px; position: absolute"));
|
|
37
37
|
chartContainer.appendChild(div);
|
|
38
38
|
}
|
|
39
39
|
if (xLabel && show_horizontal_axis_label) {
|
|
40
|
-
xLabel.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(
|
|
40
|
+
xLabel.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(horizontal_axis_label_position, "; bottom: -20px; position: absolute"));
|
|
41
41
|
}
|
|
42
42
|
if (xLabel && !show_horizontal_axis_label) {
|
|
43
43
|
xLabel.parentNode.removeChild(xLabel);
|
|
@@ -52,16 +52,16 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
52
52
|
div.innerHTML = column.name || '';
|
|
53
53
|
const containerHeight = chartContainer.offsetHeight;
|
|
54
54
|
let textAlign = 'center';
|
|
55
|
-
if (
|
|
56
|
-
if (
|
|
57
|
-
div.setAttribute('style', "color:".concat(textColor, "; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2
|
|
55
|
+
if (vertical_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
56
|
+
if (vertical_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
57
|
+
div.setAttribute('style', "color:".concat(textColor, "; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2, "px) rotate(-90deg)"));
|
|
58
58
|
chartContainer.appendChild(div);
|
|
59
59
|
}
|
|
60
60
|
if (yLabel && show_horizontal_axis_label) {
|
|
61
61
|
const containerHeight = chartContainer.offsetHeight;
|
|
62
62
|
let textAlign = 'center';
|
|
63
|
-
if (
|
|
64
|
-
if (
|
|
63
|
+
if (vertical_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
64
|
+
if (vertical_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
65
65
|
yLabel.setAttribute('style', "color:".concat(textColor, "; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2 + autoPadding.bottom / 4, "px) rotate(-90deg)"));
|
|
66
66
|
}
|
|
67
67
|
if (yLabel && !show_horizontal_axis_label) {
|
|
@@ -44,14 +44,18 @@ class Line extends ChartComponent {
|
|
|
44
44
|
this.draw = data => {
|
|
45
45
|
const {
|
|
46
46
|
chart,
|
|
47
|
-
theme
|
|
47
|
+
theme,
|
|
48
|
+
themeName
|
|
48
49
|
} = this.props;
|
|
49
50
|
const {
|
|
50
51
|
y_axis_label_color,
|
|
51
52
|
y_axis_show_value,
|
|
52
53
|
label_font_size
|
|
53
54
|
} = chart.config;
|
|
54
|
-
|
|
55
|
+
let chartBarColor = y_axis_label_color || '#5B8FF9';
|
|
56
|
+
if (themeName) {
|
|
57
|
+
chartBarColor = BaseUtils.getCurrentTheme(themeName).colors[0];
|
|
58
|
+
}
|
|
55
59
|
this.drawLabels(data);
|
|
56
60
|
|
|
57
61
|
// set Coord type
|