sea-chart 0.0.19 → 0.0.21
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 +4 -1
- package/dist/locale/lang/de.js +4 -1
- package/dist/locale/lang/en.js +6 -1
- package/dist/locale/lang/es.js +4 -1
- package/dist/locale/lang/fr.js +4 -1
- package/dist/locale/lang/pt.js +4 -1
- package/dist/locale/lang/ru.js +4 -1
- package/dist/locale/lang/zh_CN.js +9 -4
- package/dist/model/area-group.js +4 -2
- package/dist/model/area.js +3 -2
- package/dist/model/basic-number-card.js +5 -1
- package/dist/model/line-group.js +3 -2
- package/dist/model/line.js +3 -2
- package/dist/settings/advance-bar-settings/style-settings.js +8 -2
- package/dist/settings/bar-settings/style-settings.js +10 -3
- package/dist/settings/basic-number-card/style-settings.js +48 -3
- package/dist/settings/widgets/select-line-type/index.css +0 -0
- package/dist/settings/widgets/select-line-type/index.js +27 -0
- package/dist/view/index.css +16 -6
- package/dist/view/index.js +7 -5
- package/dist/view/wrapper/area.js +77 -41
- package/dist/view/wrapper/bar-custom.js +2 -2
- package/dist/view/wrapper/bar-group.js +2 -2
- package/dist/view/wrapper/bar.js +2 -2
- package/dist/view/wrapper/basic-number-card.js +6 -33
- package/dist/view/wrapper/chart-component.js +49 -3
- package/dist/view/wrapper/combination.js +1 -1
- package/dist/view/wrapper/compare.js +1 -1
- package/dist/view/wrapper/completeness.js +2 -2
- package/dist/view/wrapper/dashboard.js +1 -1
- package/dist/view/wrapper/horizontal-bar-group.js +2 -2
- package/dist/view/wrapper/horizontal-bar.js +4 -10
- package/dist/view/wrapper/line-group.js +64 -48
- package/dist/view/wrapper/line.js +69 -64
- package/dist/view/wrapper/map.js +1 -1
- package/dist/view/wrapper/pie.js +1 -1
- package/dist/view/wrapper/ring.js +2 -2
- package/dist/view/wrapper/scatter.js +1 -1
- package/dist/view/wrapper/treemap.js +1 -1
- package/dist/view/wrapper/world-map.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
+
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
4
5
|
import { BaseUtils, isFunction } from '../../utils';
|
|
5
|
-
import ChartComponent from './chart-component';
|
|
6
6
|
import intl from '../../intl';
|
|
7
|
+
import { CHART_LINE_TYPES, CHART_SUMMARY_SHOW, CHART_SUMMARY_TYPE } from '../../constants';
|
|
8
|
+
import ChartComponent from './chart-component';
|
|
7
9
|
class Line extends ChartComponent {
|
|
8
10
|
constructor(props) {
|
|
9
11
|
super(props);
|
|
@@ -14,7 +16,7 @@ class Line extends ChartComponent {
|
|
|
14
16
|
const {
|
|
15
17
|
y_axis_show_value
|
|
16
18
|
} = chart.config;
|
|
17
|
-
const appendPadding = [y_axis_show_value ?
|
|
19
|
+
const appendPadding = [y_axis_show_value ? 17 : 0, 0, 0, 0];
|
|
18
20
|
this.initChart(this.container, {
|
|
19
21
|
appendPadding
|
|
20
22
|
});
|
|
@@ -45,95 +47,97 @@ class Line extends ChartComponent {
|
|
|
45
47
|
const {
|
|
46
48
|
chart,
|
|
47
49
|
theme,
|
|
48
|
-
themeName
|
|
50
|
+
themeName,
|
|
51
|
+
summaryColumn
|
|
49
52
|
} = this.props;
|
|
50
53
|
const {
|
|
51
54
|
y_axis_label_color,
|
|
52
55
|
y_axis_show_value,
|
|
53
|
-
label_font_size
|
|
56
|
+
label_font_size,
|
|
57
|
+
line_type,
|
|
58
|
+
y_axis_column_key,
|
|
59
|
+
y_axis_summary_type,
|
|
60
|
+
y_axis_summary_method
|
|
54
61
|
} = chart.config;
|
|
55
62
|
let chartBarColor = y_axis_label_color || '#5B8FF9';
|
|
56
63
|
if (themeName) {
|
|
57
64
|
chartBarColor = BaseUtils.getCurrentTheme(themeName).colors[0];
|
|
58
65
|
}
|
|
59
66
|
this.drawLabels(data);
|
|
67
|
+
const isSmooth = line_type === CHART_LINE_TYPES[1];
|
|
60
68
|
|
|
61
69
|
// set Coord type
|
|
62
70
|
this.chart.coordinate('rect');
|
|
63
|
-
this.chart.line().label(y_axis_show_value ? 'value' : false, {
|
|
71
|
+
const line = this.chart.line().label(y_axis_show_value ? 'value' : false, {
|
|
64
72
|
style: {
|
|
65
73
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
66
|
-
fill: theme.
|
|
74
|
+
fill: theme.labelColor
|
|
67
75
|
}
|
|
68
|
-
}).
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
}).animate({
|
|
77
|
+
appear: {
|
|
78
|
+
animation: 'fadeIn',
|
|
79
|
+
duration: 1000,
|
|
80
|
+
easing: 'easeLinear'
|
|
81
|
+
}
|
|
82
|
+
}).position('name*value').color(chartBarColor).shape(isSmooth ? 'smooth' : 'line').style({
|
|
83
|
+
lineWidth: 3,
|
|
84
|
+
opacity: 1
|
|
85
|
+
}).tooltip('name*value', (name, value) => {
|
|
86
|
+
return {
|
|
87
|
+
title: y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT ? intl.get('Amount') : intl.get(CHART_SUMMARY_SHOW[y_axis_summary_method]),
|
|
88
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
|
|
89
|
+
name
|
|
90
|
+
};
|
|
72
91
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
borderRadius: '3px',
|
|
81
|
-
backgroundColor: '#fff',
|
|
82
|
-
padding: '16px',
|
|
83
|
-
width: '180px',
|
|
84
|
-
border: '1px solid #E2E2E2'
|
|
85
|
-
},
|
|
86
|
-
'g2-tooltip-title': {
|
|
87
|
-
color: '#333333',
|
|
88
|
-
fontSize: '14px',
|
|
89
|
-
marginTop: '-1px'
|
|
90
|
-
},
|
|
91
|
-
'tooltip-item': {
|
|
92
|
-
display: 'flex',
|
|
93
|
-
width: '100%',
|
|
94
|
-
justifyContent: 'space-between',
|
|
95
|
-
marginTop: '8px',
|
|
96
|
-
color: '#333333',
|
|
97
|
-
fontSize: '12px'
|
|
98
|
-
},
|
|
99
|
-
'tooltip-item-left': {
|
|
100
|
-
display: 'flex',
|
|
101
|
-
justifyContent: 'space-between',
|
|
102
|
-
alignItem: 'center'
|
|
103
|
-
},
|
|
104
|
-
'tooltip-item-rect': {
|
|
105
|
-
display: 'inline-block',
|
|
106
|
-
width: '12px',
|
|
107
|
-
height: '12px',
|
|
108
|
-
borderRadius: '2px',
|
|
109
|
-
marginRight: '8px'
|
|
92
|
+
let point;
|
|
93
|
+
if (y_axis_show_value) {
|
|
94
|
+
point = this.chart.point().position('name*value').color(chartBarColor).animate({
|
|
95
|
+
appear: {
|
|
96
|
+
animation: 'fadeIn',
|
|
97
|
+
duration: 1000,
|
|
98
|
+
easing: 'easeLinear'
|
|
110
99
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
100
|
+
}).shape('circle').size(4).style({
|
|
101
|
+
stroke: 0,
|
|
102
|
+
fillOpacity: 1
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
this.chart.on('tooltip:show', () => {
|
|
106
|
+
if (line.styleOption.cfg.opacity === 0.3) return;
|
|
107
|
+
line.style({
|
|
108
|
+
opacity: 0.3,
|
|
109
|
+
lineWidth: 3
|
|
110
|
+
});
|
|
111
|
+
if (point) point.style({
|
|
112
|
+
fillOpacity: 0.3,
|
|
113
|
+
stroke: 0
|
|
114
|
+
});
|
|
115
|
+
this.chart.render();
|
|
113
116
|
});
|
|
117
|
+
this.chart.on('tooltip:hide', () => {
|
|
118
|
+
if (line.styleOption.cfg.opacity === 1) return;
|
|
119
|
+
line.style({
|
|
120
|
+
opacity: 1,
|
|
121
|
+
lineWidth: 3
|
|
122
|
+
});
|
|
123
|
+
if (point) point.style({
|
|
124
|
+
fillOpacity: 1,
|
|
125
|
+
stroke: 0
|
|
126
|
+
});
|
|
127
|
+
this.chart.render();
|
|
128
|
+
});
|
|
129
|
+
this.setToolTipForLine();
|
|
114
130
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
|
115
131
|
this.setValueLabel(theme);
|
|
116
|
-
this.chart.theme({
|
|
117
|
-
geometries: {
|
|
118
|
-
point: {
|
|
119
|
-
circle: {
|
|
120
|
-
active: {
|
|
121
|
-
style: {
|
|
122
|
-
stroke: 'rgba(0, 0, 0, 0)',
|
|
123
|
-
r: 4
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
132
|
};
|
|
131
133
|
this.chart = null;
|
|
134
|
+
this.needRenderAxisLabel = true;
|
|
132
135
|
}
|
|
133
136
|
componentDidMount() {
|
|
134
137
|
this.createChart();
|
|
135
138
|
this.drawChart();
|
|
136
139
|
this.renderAxisLabel(this.props.chart, this.props.tables);
|
|
140
|
+
super.componentDidMount();
|
|
137
141
|
}
|
|
138
142
|
componentDidUpdate(prevProps) {
|
|
139
143
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
@@ -145,13 +149,14 @@ class Line extends ChartComponent {
|
|
|
145
149
|
}
|
|
146
150
|
componentWillUnmount() {
|
|
147
151
|
this.chart && this.chart.destroy();
|
|
152
|
+
super.componentWillUnmount();
|
|
148
153
|
}
|
|
149
154
|
render() {
|
|
150
155
|
const {
|
|
151
156
|
chart
|
|
152
157
|
} = this.props;
|
|
153
158
|
return /*#__PURE__*/React.createElement("div", {
|
|
154
|
-
className: classnames('sea-chart-container
|
|
159
|
+
className: classnames('sea-chart-container ', {
|
|
155
160
|
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
156
161
|
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
157
162
|
}),
|
package/dist/view/wrapper/map.js
CHANGED
|
@@ -316,7 +316,7 @@ export default function Map(props) {
|
|
|
316
316
|
return /*#__PURE__*/React.createElement(React.Fragment, null, isLoading && /*#__PURE__*/React.createElement("div", {
|
|
317
317
|
className: 'statistic-chart-loading-container'
|
|
318
318
|
}, /*#__PURE__*/React.createElement(Loading, null)), /*#__PURE__*/React.createElement("div", {
|
|
319
|
-
className: classnames('sea-chart-container
|
|
319
|
+
className: classnames('sea-chart-container '),
|
|
320
320
|
ref: chartContainerRef
|
|
321
321
|
}));
|
|
322
322
|
}
|
package/dist/view/wrapper/pie.js
CHANGED
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS } from '../../constants';
|
|
4
4
|
import { BaseUtils, isFunction } from '../../utils';
|
|
5
|
-
import ChartComponent from './chart-component';
|
|
6
5
|
import intl from '../../intl';
|
|
6
|
+
import ChartComponent from './chart-component';
|
|
7
7
|
class Ring extends ChartComponent {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
var _this;
|
|
@@ -248,7 +248,7 @@ class Ring extends ChartComponent {
|
|
|
248
248
|
}
|
|
249
249
|
render() {
|
|
250
250
|
return /*#__PURE__*/React.createElement("div", {
|
|
251
|
-
className: "sea-chart-container
|
|
251
|
+
className: "sea-chart-container ",
|
|
252
252
|
ref: ref => this.container = ref
|
|
253
253
|
});
|
|
254
254
|
}
|
|
@@ -121,7 +121,7 @@ export function Scatter(props) {
|
|
|
121
121
|
const showXLabel = chartRef.current.isShowXAxisLabel(chart);
|
|
122
122
|
const showYLabel = chartRef.current.isShowYAxisLabel(chart);
|
|
123
123
|
return /*#__PURE__*/React.createElement("div", {
|
|
124
|
-
className: classnames('sea-chart-container
|
|
124
|
+
className: classnames('sea-chart-container ', {
|
|
125
125
|
'show-x-axis-label': showXLabel,
|
|
126
126
|
'show-y-axis-label': showYLabel
|
|
127
127
|
}),
|