sea-chart 1.1.133 → 1.1.134
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/utils/chart-utils/base-utils.js +1 -1
- package/dist/view/wrapper/area.js +5 -3
- package/dist/view/wrapper/bar-group.js +6 -6
- package/dist/view/wrapper/chart-component.js +3 -2
- package/dist/view/wrapper/horizontal-bar-group.js +4 -2
- package/dist/view/wrapper/line-group.js +8 -6
- package/package.json +1 -1
|
@@ -546,7 +546,7 @@ BaseUtils.formatEmptyName = (dataList, column_groupby_column_key, emptyName) =>
|
|
|
546
546
|
if (!item.name && item.name !== 0) {
|
|
547
547
|
item.name = emptyName;
|
|
548
548
|
}
|
|
549
|
-
if (column_groupby_column_key && !item.group_name) {
|
|
549
|
+
if (column_groupby_column_key && !item.group_name && item.group_name !== 0) {
|
|
550
550
|
item.group_name = emptyName;
|
|
551
551
|
}
|
|
552
552
|
updatedStatistics.push(item);
|
|
@@ -43,9 +43,10 @@ class Area extends ChartComponent {
|
|
|
43
43
|
this.drawChart = () => {
|
|
44
44
|
let {
|
|
45
45
|
result: data,
|
|
46
|
-
customRender
|
|
46
|
+
customRender,
|
|
47
|
+
chart
|
|
47
48
|
} = this.props;
|
|
48
|
-
data = BaseUtils.formatEmptyName(data,
|
|
49
|
+
data = BaseUtils.formatEmptyName(data, chart.config.column_groupby_column_key, intl.get('Empty'));
|
|
49
50
|
if (!Array.isArray(data)) return;
|
|
50
51
|
if (this.isGroupChart) {
|
|
51
52
|
this.chart.scale(this.groupName, {
|
|
@@ -98,7 +99,8 @@ class Area extends ChartComponent {
|
|
|
98
99
|
useSingleSelectColumnColor ? this.setSingleSelectColorMap(data) : this.setColorMap(data, chartColorTheme);
|
|
99
100
|
chartBarColor = this.groupName;
|
|
100
101
|
colorCallBack = group_name => {
|
|
101
|
-
|
|
102
|
+
const colorKey = group_name || group_name === 0 ? group_name : '';
|
|
103
|
+
return this.colorMap[colorKey];
|
|
102
104
|
};
|
|
103
105
|
this.drawLabels(newData);
|
|
104
106
|
} else {
|
|
@@ -42,16 +42,14 @@ class BarGroup extends ChartComponent {
|
|
|
42
42
|
};
|
|
43
43
|
this.drawChart = () => {
|
|
44
44
|
let {
|
|
45
|
-
result: data
|
|
45
|
+
result: data,
|
|
46
|
+
chart
|
|
46
47
|
} = this.props;
|
|
47
|
-
data = BaseUtils.formatEmptyName(data,
|
|
48
|
+
data = BaseUtils.formatEmptyName(data, chart.config.column_groupby_column_key, intl.get('Empty'));
|
|
48
49
|
if (!Array.isArray(data)) return;
|
|
49
50
|
this.chart.scale(this.groupName, {
|
|
50
51
|
type: 'cat'
|
|
51
52
|
});
|
|
52
|
-
const {
|
|
53
|
-
chart
|
|
54
|
-
} = this.props;
|
|
55
53
|
const {
|
|
56
54
|
sort_type,
|
|
57
55
|
type
|
|
@@ -173,8 +171,10 @@ class BarGroup extends ChartComponent {
|
|
|
173
171
|
},
|
|
174
172
|
position: type === CHART_TYPE.BAR_STACK ? 'middle' : ''
|
|
175
173
|
}).position('name*value').size(singleBarWidth).color('group_name', group_name => {
|
|
174
|
+
var _this$colorMap$colorK;
|
|
176
175
|
const groupName = isGroupByDate ? dayjs(group_name).format('YYYY-MM-DD') : group_name;
|
|
177
|
-
|
|
176
|
+
const colorKey = groupName || groupName === 0 ? groupName : '';
|
|
177
|
+
return (_this$colorMap$colorK = this.colorMap[colorKey]) !== null && _this$colorMap$colorK !== void 0 ? _this$colorMap$colorK : CHART_STYLE_COLORS[0];
|
|
178
178
|
}).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
|
|
179
179
|
return {
|
|
180
180
|
title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
|
|
@@ -628,8 +628,9 @@ export default class ChartComponent extends Component {
|
|
|
628
628
|
colors = BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
629
629
|
}
|
|
630
630
|
const colorMap = data.reduce((acc, cur) => {
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
const key = cur.group_name || cur.group_name === 0 ? cur.group_name : '';
|
|
632
|
+
if (!acc.hasOwnProperty(key)) {
|
|
633
|
+
acc[key] = colors[currentIdx++ % colors.length];
|
|
633
634
|
}
|
|
634
635
|
return acc;
|
|
635
636
|
}, {});
|
|
@@ -46,7 +46,7 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
46
46
|
customRender,
|
|
47
47
|
chart
|
|
48
48
|
} = this.props;
|
|
49
|
-
data = BaseUtils.formatEmptyName(data,
|
|
49
|
+
data = BaseUtils.formatEmptyName(data, chart.config.column_groupby_column_key, intl.get('Empty'));
|
|
50
50
|
if (!Array.isArray(data)) return;
|
|
51
51
|
this.chart.scale(this.groupName, {
|
|
52
52
|
type: 'cat'
|
|
@@ -139,8 +139,10 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
139
139
|
...this.labelStroke
|
|
140
140
|
}
|
|
141
141
|
}).position('name*value').size(singleBarWidth).color('group_name', group_name => {
|
|
142
|
+
var _this$colorMap$colorK;
|
|
142
143
|
const groupName = isGroupByDate ? dayjs(group_name).format('YYYY-MM-DD') : group_name;
|
|
143
|
-
|
|
144
|
+
const colorKey = groupName || groupName === 0 ? groupName : '';
|
|
145
|
+
return (_this$colorMap$colorK = this.colorMap[colorKey]) !== null && _this$colorMap$colorK !== void 0 ? _this$colorMap$colorK : CHART_STYLE_COLORS[0];
|
|
144
146
|
}).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
|
|
145
147
|
return {
|
|
146
148
|
title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
|
|
@@ -32,9 +32,10 @@ class LineGroup extends ChartComponent {
|
|
|
32
32
|
this.drawChart = () => {
|
|
33
33
|
let {
|
|
34
34
|
result: data,
|
|
35
|
-
customRender
|
|
35
|
+
customRender,
|
|
36
|
+
chart
|
|
36
37
|
} = this.props;
|
|
37
|
-
data = BaseUtils.formatEmptyName(data,
|
|
38
|
+
data = BaseUtils.formatEmptyName(data, chart.config.column_groupby_column_key, intl.get('Empty'));
|
|
38
39
|
if (!Array.isArray(data)) return;
|
|
39
40
|
this.chart.scale(this.groupName, {
|
|
40
41
|
type: 'cat'
|
|
@@ -98,7 +99,8 @@ class LineGroup extends ChartComponent {
|
|
|
98
99
|
easing: 'easeLinear'
|
|
99
100
|
}
|
|
100
101
|
}).position('name*value').color(chartBarColor, group_name => {
|
|
101
|
-
|
|
102
|
+
const colorKey = group_name || group_name === 0 ? group_name : '';
|
|
103
|
+
return this.colorMap[colorKey];
|
|
102
104
|
}).shape(isSmooth ? 'smooth' : 'line').style({
|
|
103
105
|
lineWidth: 2,
|
|
104
106
|
opacity: 1
|
|
@@ -109,9 +111,9 @@ class LineGroup extends ChartComponent {
|
|
|
109
111
|
name: !group_name && typeof group_name !== 'number' ? intl.get(EMPTY_NAME) : group_name
|
|
110
112
|
};
|
|
111
113
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return this.colorMap[
|
|
114
|
+
this.chart.point().position('name*value').color(chartBarColor, group_name => {
|
|
115
|
+
const colorKey = group_name || group_name === 0 ? group_name : '';
|
|
116
|
+
return this.colorMap[colorKey];
|
|
115
117
|
}).animate({
|
|
116
118
|
appear: {
|
|
117
119
|
animation: 'fadeIn',
|