sea-chart 1.1.21 → 1.1.22-alpha.1
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 +7 -6
- package/dist/utils/row-record-utils.js +0 -2
- package/dist/view/wrapper/area.js +7 -3
- package/dist/view/wrapper/bar-custom.js +8 -4
- package/dist/view/wrapper/bar-group.js +7 -3
- package/dist/view/wrapper/bar.js +9 -4
- package/dist/view/wrapper/chart-component.js +6 -2
- package/dist/view/wrapper/combination.js +10 -5
- package/dist/view/wrapper/compare.js +7 -3
- package/dist/view/wrapper/completeness.js +4 -2
- package/dist/view/wrapper/dashboard.js +2 -1
- package/dist/view/wrapper/funnel.js +4 -2
- package/dist/view/wrapper/heat-map.js +32 -16
- package/dist/view/wrapper/horizontal-bar-group.js +9 -4
- package/dist/view/wrapper/horizontal-bar.js +8 -4
- package/dist/view/wrapper/horizontal-component.js +4 -1
- package/dist/view/wrapper/line-group.js +7 -3
- package/dist/view/wrapper/line.js +7 -3
- package/dist/view/wrapper/mirror.js +4 -2
- package/dist/view/wrapper/pie.js +3 -1
- package/dist/view/wrapper/ring.js +3 -1
- package/package.json +1 -1
|
@@ -490,16 +490,17 @@ BaseUtils.getColumn = (tables, tableId, columnKey) => {
|
|
|
490
490
|
BaseUtils.formatEmptyName = (dataList, column_groupby_column_key, emptyName) => {
|
|
491
491
|
if (!Array.isArray(dataList)) return [];
|
|
492
492
|
let updatedStatistics = [];
|
|
493
|
-
dataList.
|
|
494
|
-
let
|
|
493
|
+
for (let i = 0; i < dataList.length; i++) {
|
|
494
|
+
let item = dataList[i];
|
|
495
|
+
// let updated = {};
|
|
495
496
|
if (!item.name) {
|
|
496
|
-
|
|
497
|
+
item.name = emptyName;
|
|
497
498
|
}
|
|
498
499
|
if (column_groupby_column_key && !item.group_name) {
|
|
499
|
-
|
|
500
|
+
item.group_name = emptyName;
|
|
500
501
|
}
|
|
501
|
-
updatedStatistics.push(
|
|
502
|
-
}
|
|
502
|
+
updatedStatistics.push(item);
|
|
503
|
+
}
|
|
503
504
|
return updatedStatistics;
|
|
504
505
|
};
|
|
505
506
|
// init
|
|
@@ -14,7 +14,6 @@ import { getColumnByKey } from '../utils/column-utils';
|
|
|
14
14
|
import context from '../context';
|
|
15
15
|
import { xAxisMap, groupAxisMap } from '../constants';
|
|
16
16
|
import { chartColumn2SqlColumn } from './sql';
|
|
17
|
-
import { BaseUtils } from './chart-utils';
|
|
18
17
|
export const UNSHOW_COLUMN_TYPE = [CellType.LINK, CellType.LONG_TEXT, CellType.FORMULA, CellType.LINK_FORMULA];
|
|
19
18
|
export const getCellRecordWidth = column => {
|
|
20
19
|
let {
|
|
@@ -609,7 +608,6 @@ export const getFilterConditions = (statisticRecord, chart, table) => {
|
|
|
609
608
|
const filters = [];
|
|
610
609
|
const columnKey = xAxisMap[type];
|
|
611
610
|
const groupColumnKey = groupAxisMap[type];
|
|
612
|
-
chart.config = BaseUtils.convertConfig(config);
|
|
613
611
|
const chartSQLMap = chartColumn2SqlColumn(chart, table);
|
|
614
612
|
const {
|
|
615
613
|
sqlColumnGroupbyColumnKey,
|
|
@@ -55,7 +55,9 @@ class Area extends ChartComponent {
|
|
|
55
55
|
this.loadData(data);
|
|
56
56
|
this.draw(data);
|
|
57
57
|
isFunction(customRender) && customRender(this.chart);
|
|
58
|
-
|
|
58
|
+
requestAnimationFrame(() => {
|
|
59
|
+
this.chart.render();
|
|
60
|
+
});
|
|
59
61
|
};
|
|
60
62
|
this.draw = data => {
|
|
61
63
|
const {
|
|
@@ -221,15 +223,17 @@ class Area extends ChartComponent {
|
|
|
221
223
|
componentDidUpdate(prevProps) {
|
|
222
224
|
super.componentDidUpdate(prevProps);
|
|
223
225
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
226
|
+
var _this$chart;
|
|
224
227
|
this.initChartType();
|
|
225
|
-
this.chart && this.chart.destroy();
|
|
228
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
226
229
|
this.createChart();
|
|
227
230
|
this.drawChart();
|
|
228
231
|
this.renderAxisLabel(prevProps.chart, prevProps.tables);
|
|
229
232
|
}
|
|
230
233
|
}
|
|
231
234
|
componentWillUnmount() {
|
|
232
|
-
|
|
235
|
+
var _this$chart2;
|
|
236
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
233
237
|
super.componentWillUnmount();
|
|
234
238
|
}
|
|
235
239
|
render() {
|
|
@@ -42,8 +42,10 @@ class BarCustom extends ChartComponent {
|
|
|
42
42
|
if (!Array.isArray(data)) return;
|
|
43
43
|
this.loadData(data);
|
|
44
44
|
this.draw(data);
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
requestAnimationFrame(() => {
|
|
46
|
+
this.chart.render();
|
|
47
|
+
this.renderAxisLabel(this.props.chart, this.props.tables);
|
|
48
|
+
});
|
|
47
49
|
};
|
|
48
50
|
this.organizeData = data => {
|
|
49
51
|
const dataMap = {};
|
|
@@ -183,13 +185,15 @@ class BarCustom extends ChartComponent {
|
|
|
183
185
|
componentDidUpdate(prevProps) {
|
|
184
186
|
super.componentDidUpdate(prevProps);
|
|
185
187
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
186
|
-
|
|
188
|
+
var _this$chart;
|
|
189
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
187
190
|
this.createChart();
|
|
188
191
|
this.drawChart();
|
|
189
192
|
}
|
|
190
193
|
}
|
|
191
194
|
componentWillUnmount() {
|
|
192
|
-
|
|
195
|
+
var _this$chart2;
|
|
196
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
193
197
|
window.removeEventListener('resize', this.handleResize);
|
|
194
198
|
}
|
|
195
199
|
render() {
|
|
@@ -60,7 +60,9 @@ class BarGroup extends ChartComponent {
|
|
|
60
60
|
}
|
|
61
61
|
this.loadData(data);
|
|
62
62
|
this.draw(data);
|
|
63
|
-
|
|
63
|
+
requestAnimationFrame(() => {
|
|
64
|
+
this.chart.render();
|
|
65
|
+
});
|
|
64
66
|
};
|
|
65
67
|
this.draw = data => {
|
|
66
68
|
const {
|
|
@@ -216,14 +218,16 @@ class BarGroup extends ChartComponent {
|
|
|
216
218
|
componentDidUpdate(prevProps) {
|
|
217
219
|
super.componentDidUpdate(prevProps);
|
|
218
220
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
219
|
-
|
|
221
|
+
var _this$chart;
|
|
222
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
220
223
|
this.createChart();
|
|
221
224
|
this.drawChart();
|
|
222
225
|
this.renderAxisLabel(prevProps.chart, prevProps.tables);
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
componentWillUnmount() {
|
|
226
|
-
|
|
229
|
+
var _this$chart2;
|
|
230
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
227
231
|
window.removeEventListener('resize', this.debouncedHandleResize);
|
|
228
232
|
}
|
|
229
233
|
render() {
|
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -42,8 +42,10 @@ class Bar extends ChartComponent {
|
|
|
42
42
|
if (!Array.isArray(data)) return;
|
|
43
43
|
this.loadData(data);
|
|
44
44
|
this.draw(data);
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
requestAnimationFrame(() => {
|
|
46
|
+
this.chart.render();
|
|
47
|
+
this.renderAxisLabel(this.props.chart, this.props.tables);
|
|
48
|
+
});
|
|
47
49
|
};
|
|
48
50
|
this.draw = data => {
|
|
49
51
|
const {
|
|
@@ -129,13 +131,16 @@ class Bar extends ChartComponent {
|
|
|
129
131
|
componentDidUpdate(prevProps) {
|
|
130
132
|
super.componentDidUpdate(prevProps);
|
|
131
133
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
132
|
-
|
|
134
|
+
var _this$chart;
|
|
135
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
133
136
|
this.createChart();
|
|
134
137
|
this.drawChart();
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
componentWillUnmount() {
|
|
138
|
-
|
|
141
|
+
var _this$chart2;
|
|
142
|
+
// chart doesn't have autoPadding before they were rendered
|
|
143
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
139
144
|
window.removeEventListener('resize', this.debouncedHandleResize);
|
|
140
145
|
}
|
|
141
146
|
render() {
|
|
@@ -18,8 +18,9 @@ export default class ChartComponent extends Component {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
this.handleResize = debounce(() => {
|
|
21
|
+
var _this$chart;
|
|
21
22
|
if (!this.createChart || !this.drawChart) return;
|
|
22
|
-
this.chart && this.chart.destroy();
|
|
23
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
23
24
|
this.createChart();
|
|
24
25
|
this.drawChart();
|
|
25
26
|
if (this.needRenderAxisLabel) {
|
|
@@ -206,6 +207,7 @@ export default class ChartComponent extends Component {
|
|
|
206
207
|
}
|
|
207
208
|
};
|
|
208
209
|
this.renderAxisLabel = (chart, tables) => {
|
|
210
|
+
var _this$chart2;
|
|
209
211
|
if (!this.chart || !chart) return;
|
|
210
212
|
let {
|
|
211
213
|
table_id,
|
|
@@ -226,7 +228,9 @@ export default class ChartComponent extends Component {
|
|
|
226
228
|
y_axis_column_key = y_axis_summary_column_key;
|
|
227
229
|
}
|
|
228
230
|
const table = getTableById(tables, table_id);
|
|
229
|
-
const autoPadding = this.chart.autoPadding
|
|
231
|
+
const autoPadding = ((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) || {
|
|
232
|
+
bottom: 0
|
|
233
|
+
};
|
|
230
234
|
let textColor;
|
|
231
235
|
this.globalTheme === THEME_NAME_MAP.DARK ? textColor = '#fff' : textColor = '#999';
|
|
232
236
|
const xAxisID = "chart-x-axis-label_".concat(chart.id);
|
|
@@ -397,10 +397,13 @@ class Combination extends ChartComponent {
|
|
|
397
397
|
}, 100));
|
|
398
398
|
isFunction(customRender) && customRender(this.chart);
|
|
399
399
|
this.chart.removeInteraction('legend-filter');
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
requestAnimationFrame(() => {
|
|
401
|
+
this.chart.render();
|
|
402
|
+
this.renderAxisLabel();
|
|
403
|
+
});
|
|
402
404
|
};
|
|
403
405
|
this.renderAxisLabel = () => {
|
|
406
|
+
var _this$chart;
|
|
404
407
|
if (!this.chart) return;
|
|
405
408
|
let {
|
|
406
409
|
chart,
|
|
@@ -424,7 +427,7 @@ class Combination extends ChartComponent {
|
|
|
424
427
|
y_axis_right_summary_type
|
|
425
428
|
} = config;
|
|
426
429
|
const table = getTableById(tables, table_id);
|
|
427
|
-
const autoPadding = this.chart.autoPadding;
|
|
430
|
+
const autoPadding = ((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) || 0;
|
|
428
431
|
const textColor = '#999';
|
|
429
432
|
const xAxisID = "chart-x-axis-label_".concat(chart.id);
|
|
430
433
|
const chartContainer = this.chart.getCanvas().get('container');
|
|
@@ -648,13 +651,15 @@ class Combination extends ChartComponent {
|
|
|
648
651
|
componentDidUpdate(prevProps) {
|
|
649
652
|
super.componentDidUpdate(prevProps);
|
|
650
653
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
651
|
-
|
|
654
|
+
var _this$chart2;
|
|
655
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
652
656
|
this.drawChart();
|
|
653
657
|
this.renderAxisLabel(prevProps.chart, prevProps.tables);
|
|
654
658
|
}
|
|
655
659
|
}
|
|
656
660
|
componentWillUnmount() {
|
|
657
|
-
|
|
661
|
+
var _this$chart3;
|
|
662
|
+
((_this$chart3 = this.chart) === null || _this$chart3 === void 0 ? void 0 : _this$chart3.autoPadding) && this.chart.destroy();
|
|
658
663
|
}
|
|
659
664
|
render() {
|
|
660
665
|
const {
|
|
@@ -38,7 +38,9 @@ class Compare extends ChartComponent {
|
|
|
38
38
|
if (!Array.isArray(data)) return;
|
|
39
39
|
this.loadData(data);
|
|
40
40
|
this.draw(data);
|
|
41
|
-
|
|
41
|
+
requestAnimationFrame(() => {
|
|
42
|
+
this.chart.render();
|
|
43
|
+
});
|
|
42
44
|
};
|
|
43
45
|
this.draw = data => {
|
|
44
46
|
const {
|
|
@@ -335,14 +337,16 @@ class Compare extends ChartComponent {
|
|
|
335
337
|
componentDidUpdate(prevProps) {
|
|
336
338
|
super.componentDidUpdate(prevProps);
|
|
337
339
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
338
|
-
|
|
340
|
+
var _this$chart;
|
|
341
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
339
342
|
this.createChart();
|
|
340
343
|
this.drawChart();
|
|
341
344
|
this.renderAxisLabel(this.props.chart, this.props.tables);
|
|
342
345
|
}
|
|
343
346
|
}
|
|
344
347
|
componentWillUnmount() {
|
|
345
|
-
|
|
348
|
+
var _this$chart2;
|
|
349
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
346
350
|
}
|
|
347
351
|
render() {
|
|
348
352
|
const {
|
|
@@ -48,8 +48,10 @@ export default function Completeness(_ref) {
|
|
|
48
48
|
if (!Array.isArray(currentData)) return;
|
|
49
49
|
currentChart.loadData(currentData);
|
|
50
50
|
draw(currentData);
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
requestAnimationFrame(() => {
|
|
52
|
+
currentChart.chart.render();
|
|
53
|
+
currentChart.renderAxisLabel(chart, tables);
|
|
54
|
+
});
|
|
53
55
|
}
|
|
54
56
|
function draw(data) {
|
|
55
57
|
const theme = CHART_THEME_COLOR[globalTheme];
|
|
@@ -157,7 +157,8 @@ class Dashboard extends Component {
|
|
|
157
157
|
}
|
|
158
158
|
componentDidUpdate(prevProps) {
|
|
159
159
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
160
|
-
|
|
160
|
+
var _this$chart;
|
|
161
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
161
162
|
this.drawChart();
|
|
162
163
|
}
|
|
163
164
|
}
|
|
@@ -178,13 +178,15 @@ class Funnel extends ChartComponent {
|
|
|
178
178
|
}
|
|
179
179
|
componentDidUpdate(prevProps) {
|
|
180
180
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
181
|
-
|
|
181
|
+
var _this$chart;
|
|
182
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
182
183
|
this.createChart();
|
|
183
184
|
this.drawChart();
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
componentWillUnmount() {
|
|
187
|
-
|
|
188
|
+
var _this$chart2;
|
|
189
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
188
190
|
}
|
|
189
191
|
render() {
|
|
190
192
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -56,32 +56,44 @@ class HeatMap extends ChartComponent {
|
|
|
56
56
|
return [];
|
|
57
57
|
};
|
|
58
58
|
this.generateBackgroundGridData = statData => {
|
|
59
|
-
let
|
|
60
|
-
const year =
|
|
59
|
+
let currentDate = new Date(this.firstDate);
|
|
60
|
+
const year = currentDate.getFullYear();
|
|
61
61
|
const gridData = [];
|
|
62
|
-
const isLeapYear = year % 4
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
const isLeapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
63
|
+
const yearDayCount = isLeapYear ? 366 : 365;
|
|
64
|
+
const getISOWeek = date => {
|
|
65
|
+
const target = new Date(date.valueOf());
|
|
66
|
+
// set 0 to monday, 6 to sunday
|
|
67
|
+
const dayNumber = (date.getUTCDay() + 6) % 7;
|
|
68
|
+
// set target to Thursday of this week, daynumber is days passed this week, 3 is Thursday
|
|
69
|
+
target.setUTCDate(target.getUTCDate() - dayNumber + 3);
|
|
70
|
+
const firstThursday = target.valueOf();
|
|
71
|
+
target.setUTCMonth(0, 1);
|
|
72
|
+
// find first thursday of the year
|
|
73
|
+
// https://blog.csdn.net/theadore2017/article/details/88578753
|
|
74
|
+
if (target.getUTCDay() !== 4) {
|
|
75
|
+
target.setUTCMonth(0, 1 + (4 - target.getUTCDay() + 7) % 7);
|
|
76
|
+
}
|
|
77
|
+
return 1 + Math.ceil((firstThursday - target) / 604800000); // 604800000ms in one week
|
|
78
|
+
};
|
|
67
79
|
for (let i = 0; i < yearDayCount; i++) {
|
|
68
|
-
const day =
|
|
69
|
-
let week =
|
|
70
|
-
const month =
|
|
80
|
+
const day = currentDate.getDay();
|
|
81
|
+
let week = getISOWeek(currentDate) - 1;
|
|
82
|
+
const month = currentDate.getMonth();
|
|
71
83
|
if (week === 0 && month === 11) {
|
|
72
84
|
week = 52;
|
|
73
85
|
}
|
|
74
|
-
const yearDate =
|
|
86
|
+
const yearDate = currentDate.toISOString().split('T')[0];
|
|
75
87
|
const value = statData[yearDate] || 0;
|
|
76
88
|
this.maxValue = Math.max(this.maxValue, value);
|
|
77
89
|
gridData.push({
|
|
78
90
|
date: yearDate,
|
|
79
|
-
value
|
|
91
|
+
value,
|
|
80
92
|
day,
|
|
81
93
|
week,
|
|
82
94
|
month
|
|
83
95
|
});
|
|
84
|
-
|
|
96
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
85
97
|
}
|
|
86
98
|
return gridData;
|
|
87
99
|
};
|
|
@@ -261,7 +273,9 @@ class HeatMap extends ChartComponent {
|
|
|
261
273
|
items: this.getLegendItems(exampleColors)
|
|
262
274
|
});
|
|
263
275
|
this.chart.removeInteraction('legend-filter');
|
|
264
|
-
|
|
276
|
+
requestAnimationFrame(() => {
|
|
277
|
+
this.chart.render();
|
|
278
|
+
});
|
|
265
279
|
};
|
|
266
280
|
dayjs.locale('en');
|
|
267
281
|
this.chart = null;
|
|
@@ -314,13 +328,15 @@ class HeatMap extends ChartComponent {
|
|
|
314
328
|
componentDidUpdate(prevProps) {
|
|
315
329
|
super.componentDidUpdate(prevProps);
|
|
316
330
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
317
|
-
|
|
331
|
+
var _this$chart;
|
|
332
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
318
333
|
this.createChart();
|
|
319
334
|
this.drawChart();
|
|
320
335
|
}
|
|
321
336
|
}
|
|
322
337
|
componentWillUnmount() {
|
|
323
|
-
|
|
338
|
+
var _this$chart2;
|
|
339
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
324
340
|
}
|
|
325
341
|
getLegendItemPath(x, y, r, index, textWidth) {
|
|
326
342
|
// x, y represents the coordinates of the center point of the legend item marker
|
|
@@ -13,7 +13,8 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
13
13
|
constructor(props) {
|
|
14
14
|
super(props);
|
|
15
15
|
this.handleResize = debounce(() => {
|
|
16
|
-
|
|
16
|
+
var _this$chart;
|
|
17
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
17
18
|
this.createChart();
|
|
18
19
|
this.drawChart();
|
|
19
20
|
this.renderHorizontalLabel(this.props.chart, this.props.tables);
|
|
@@ -59,7 +60,9 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
59
60
|
this.loadData(data);
|
|
60
61
|
this.draw(data);
|
|
61
62
|
isFunction(customRender) && customRender(this.chart);
|
|
62
|
-
|
|
63
|
+
requestAnimationFrame(() => {
|
|
64
|
+
this.chart.render();
|
|
65
|
+
});
|
|
63
66
|
};
|
|
64
67
|
this.draw = data => {
|
|
65
68
|
const {
|
|
@@ -175,14 +178,16 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
175
178
|
componentDidUpdate(prevProps) {
|
|
176
179
|
super.componentDidUpdate(prevProps);
|
|
177
180
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
178
|
-
|
|
181
|
+
var _this$chart2;
|
|
182
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
179
183
|
this.createChart();
|
|
180
184
|
this.drawChart();
|
|
181
185
|
this.renderHorizontalLabel(prevProps.chart, prevProps.tables);
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
188
|
componentWillUnmount() {
|
|
185
|
-
|
|
189
|
+
var _this$chart3;
|
|
190
|
+
((_this$chart3 = this.chart) === null || _this$chart3 === void 0 ? void 0 : _this$chart3.autoPadding) && this.chart.destroy();
|
|
186
191
|
window.removeEventListener('resize', this.handleResize);
|
|
187
192
|
}
|
|
188
193
|
render() {
|
|
@@ -38,8 +38,10 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
38
38
|
this.loadData(data);
|
|
39
39
|
this.draw(data);
|
|
40
40
|
isFunction(customRender) && customRender(this.chart);
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
requestAnimationFrame(() => {
|
|
42
|
+
this.chart.render();
|
|
43
|
+
this.renderHorizontalLabel(this.props.chart, this.props.tables);
|
|
44
|
+
});
|
|
43
45
|
};
|
|
44
46
|
this.draw = data => {
|
|
45
47
|
const {
|
|
@@ -127,13 +129,15 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
127
129
|
componentDidUpdate(prevProps) {
|
|
128
130
|
super.componentDidUpdate(prevProps);
|
|
129
131
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
130
|
-
|
|
132
|
+
var _this$chart;
|
|
133
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
131
134
|
this.createChart();
|
|
132
135
|
this.drawChart();
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
componentWillUnmount() {
|
|
136
|
-
|
|
139
|
+
var _this$chart2;
|
|
140
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
137
141
|
super.componentWillUnmount();
|
|
138
142
|
}
|
|
139
143
|
render() {
|
|
@@ -6,6 +6,7 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.renderHorizontalLabel = (chart, tables) => {
|
|
9
|
+
var _this$chart;
|
|
9
10
|
if (!this.chart || !chart) return;
|
|
10
11
|
let {
|
|
11
12
|
table_id,
|
|
@@ -18,7 +19,9 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
18
19
|
show_horizontal_axis_label
|
|
19
20
|
} = chart.config;
|
|
20
21
|
const table = getTableById(tables, table_id);
|
|
21
|
-
const autoPadding = this.chart.autoPadding
|
|
22
|
+
const autoPadding = ((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) || {
|
|
23
|
+
bottom: 0
|
|
24
|
+
};
|
|
22
25
|
const textColor = '#999999';
|
|
23
26
|
const xAxisID = "chart-x-axis-label_".concat(chart.id);
|
|
24
27
|
const chartContainer = this.chart.getCanvas().get('container');
|
|
@@ -42,7 +42,9 @@ class LineGroup extends ChartComponent {
|
|
|
42
42
|
this.loadData(data);
|
|
43
43
|
this.draw(data);
|
|
44
44
|
isFunction(customRender) && customRender(this.chart);
|
|
45
|
-
|
|
45
|
+
requestAnimationFrame(() => {
|
|
46
|
+
this.chart.render();
|
|
47
|
+
});
|
|
46
48
|
};
|
|
47
49
|
this.draw = data => {
|
|
48
50
|
const {
|
|
@@ -159,14 +161,16 @@ class LineGroup extends ChartComponent {
|
|
|
159
161
|
componentDidUpdate(prevProps) {
|
|
160
162
|
super.componentDidUpdate(prevProps);
|
|
161
163
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
162
|
-
|
|
164
|
+
var _this$chart;
|
|
165
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
163
166
|
this.createChart();
|
|
164
167
|
this.drawChart();
|
|
165
168
|
this.renderAxisLabel(prevProps.chart, prevProps.tables);
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
componentWillUnmount() {
|
|
169
|
-
|
|
172
|
+
var _this$chart2;
|
|
173
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
170
174
|
super.componentWillUnmount();
|
|
171
175
|
}
|
|
172
176
|
render() {
|
|
@@ -40,7 +40,9 @@ class Line extends ChartComponent {
|
|
|
40
40
|
this.draw(data);
|
|
41
41
|
this.autoAdjustDataOptions(chart, data, summaryColumn);
|
|
42
42
|
isFunction(customRender) && customRender(this.chart);
|
|
43
|
-
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
this.chart.render();
|
|
45
|
+
});
|
|
44
46
|
};
|
|
45
47
|
this.draw = data => {
|
|
46
48
|
const {
|
|
@@ -162,14 +164,16 @@ class Line extends ChartComponent {
|
|
|
162
164
|
componentDidUpdate(prevProps) {
|
|
163
165
|
super.componentDidUpdate(prevProps);
|
|
164
166
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
165
|
-
|
|
167
|
+
var _this$chart;
|
|
168
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
166
169
|
this.createChart();
|
|
167
170
|
this.drawChart();
|
|
168
171
|
this.renderAxisLabel(prevProps.chart, prevProps.tables);
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
componentWillUnmount() {
|
|
172
|
-
|
|
175
|
+
var _this$chart2;
|
|
176
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
173
177
|
super.componentWillUnmount();
|
|
174
178
|
}
|
|
175
179
|
render() {
|
|
@@ -179,13 +179,15 @@ class Mirror extends ChartComponent {
|
|
|
179
179
|
componentDidUpdate(prevProps) {
|
|
180
180
|
super.componentDidUpdate(prevProps);
|
|
181
181
|
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
182
|
-
|
|
182
|
+
var _this$chart;
|
|
183
|
+
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
183
184
|
this.createChart();
|
|
184
185
|
this.drawChart();
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
componentWillUnmount() {
|
|
188
|
-
|
|
189
|
+
var _this$chart2;
|
|
190
|
+
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
189
191
|
}
|
|
190
192
|
render() {
|
|
191
193
|
return /*#__PURE__*/React.createElement("div", {
|
package/dist/view/wrapper/pie.js
CHANGED
|
@@ -128,7 +128,9 @@ class Pie extends ChartComponent {
|
|
|
128
128
|
summaryMethod: summary_method
|
|
129
129
|
}));
|
|
130
130
|
isFunction(customRender) && customRender(this.chart);
|
|
131
|
-
|
|
131
|
+
requestAnimationFrame(() => {
|
|
132
|
+
this.chart.render();
|
|
133
|
+
});
|
|
132
134
|
};
|
|
133
135
|
this.onEnterElement = (evt, _ref) => {
|
|
134
136
|
let {
|
|
@@ -153,7 +153,9 @@ class Ring extends ChartComponent {
|
|
|
153
153
|
}));
|
|
154
154
|
this.chart.interaction('element-highlight');
|
|
155
155
|
isFunction(customRender) && customRender(this.chart);
|
|
156
|
-
|
|
156
|
+
requestAnimationFrame(() => {
|
|
157
|
+
this.chart.render();
|
|
158
|
+
});
|
|
157
159
|
};
|
|
158
160
|
this.getLabel = (value, percent) => {
|
|
159
161
|
const {
|