sea-chart 2.0.29 → 2.0.30

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.
@@ -503,6 +503,8 @@ BaseUtils.shouldChartComponentUpdate = (prevProps, currentProps) => {
503
503
  // global theme changed
504
504
  !(0, _shallowequal.default)(prevProps.chartColorTheme, currentProps.chartColorTheme) ||
505
505
  // chart color theme changed
506
+ !(0, _shallowequal.default)(prevProps.resizeSignal, currentProps.resizeSignal) ||
507
+ // chart container resize changed
506
508
  _BaseUtils._isChartDataChange(prevProps, currentProps) || _BaseUtils.isChartStyleChanged(prevProps.chart, currentProps.chart);
507
509
  };
508
510
  BaseUtils._isCombinationDataChange = (prevResult, currentResult) => {
@@ -250,16 +250,20 @@ class View extends _react.default.PureComponent {
250
250
  render() {
251
251
  var _title$text, _chart$config3;
252
252
  const {
253
- chart,
253
+ // style
254
254
  className,
255
- tables,
256
255
  canvasStyle,
257
256
  render,
258
257
  hideTitle = false,
259
258
  globalTheme,
260
259
  chartColorTheme,
260
+ resizeSignal,
261
+ // data
262
+ chart,
263
+ tables,
261
264
  isCalculateByView,
262
265
  dtableStoreValue,
266
+ // event
263
267
  integratedEventTypes,
264
268
  integratedEventBus,
265
269
  isBigScreenPlugin
@@ -329,6 +333,7 @@ class View extends _react.default.PureComponent {
329
333
  isCalculateByView: isCalculateByView,
330
334
  isBigScreenPlugin: isBigScreenPlugin,
331
335
  chartColorTheme: chartColorTheme,
336
+ resizeSignal: resizeSignal,
332
337
  integratedEventTypes: integratedEventTypes,
333
338
  integratedEventBus: integratedEventBus
334
339
  }))));
@@ -344,7 +349,7 @@ const propTypes = exports.propTypes = {
344
349
  hideTitle: _propTypes.default.bool,
345
350
  render: _propTypes.default.func,
346
351
  // User-defined rendering content
347
-
352
+ resizeSignal: _propTypes.default.number,
348
353
  // data
349
354
  chart: _propTypes.default.object.isRequired,
350
355
  tables: _propTypes.default.array.isRequired,
@@ -22,7 +22,7 @@ class AreaGroup extends _chartComponent.default {
22
22
  constructor(props) {
23
23
  super(props);
24
24
  this.handleResize = () => {
25
- this.chart.node() && this.chart.node().remove();
25
+ this.destroyChart();
26
26
  this.createChart();
27
27
  this.drawChart();
28
28
  };
@@ -370,13 +370,13 @@ class AreaGroup extends _chartComponent.default {
370
370
  componentDidUpdate(prevProps) {
371
371
  super.componentDidUpdate(prevProps);
372
372
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
373
- this.chart.node() && this.chart.node().remove();
373
+ this.destroyChart();
374
374
  this.createChart();
375
375
  this.drawChart();
376
376
  }
377
377
  }
378
378
  componentWillUnmount() {
379
- this.chart.node() && this.chart.node().remove();
379
+ this.destroyChart();
380
380
  window.removeEventListener('resize', this.debouncedHandleResize);
381
381
  super.componentWillUnmount();
382
382
  }
@@ -20,7 +20,7 @@ class Area extends _chartComponent.default {
20
20
  constructor(props) {
21
21
  super(props);
22
22
  this.handleResize = () => {
23
- this.chart.node() && this.chart.node().remove();
23
+ this.destroyChart();
24
24
  this.createChart();
25
25
  this.drawChart();
26
26
  };
@@ -343,13 +343,13 @@ class Area extends _chartComponent.default {
343
343
  componentDidUpdate(prevProps) {
344
344
  super.componentDidUpdate(prevProps);
345
345
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
346
- this.chart.node() && this.chart.node().remove();
346
+ this.destroyChart();
347
347
  this.createChart();
348
348
  this.drawChart();
349
349
  }
350
350
  }
351
351
  componentWillUnmount() {
352
- this.chart.node() && this.chart.node().remove();
352
+ this.destroyChart();
353
353
  window.removeEventListener('resize', this.debouncedHandleResize);
354
354
  super.componentWillUnmount();
355
355
  }
@@ -299,12 +299,13 @@ class BarCompare extends _chartComponent.default {
299
299
  componentDidUpdate(prevProps) {
300
300
  super.componentDidUpdate(prevProps);
301
301
  if (_chartUtils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
302
+ this.destroyChart();
302
303
  this.createChart();
303
304
  this.drawChart();
304
305
  }
305
306
  }
306
307
  componentWillUnmount() {
307
- this.chart.node() && this.chart.node().remove();
308
+ this.destroyChart();
308
309
  }
309
310
  render() {
310
311
  const {
@@ -21,7 +21,7 @@ class BarCustom extends _chartComponent.default {
21
21
  constructor(props) {
22
22
  super(props);
23
23
  this.handleResize = (0, _lodashEs.debounce)(() => {
24
- this.chart.node() && this.chart.node().remove();
24
+ this.destroyChart();
25
25
  this.createChart();
26
26
  this.drawChart();
27
27
  }, 300);
@@ -361,13 +361,13 @@ class BarCustom extends _chartComponent.default {
361
361
  componentDidUpdate(prevProps) {
362
362
  super.componentDidUpdate(prevProps);
363
363
  if (_chartUtils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
364
- this.chart.node() && this.chart.node().remove();
364
+ this.destroyChart();
365
365
  this.createChart();
366
366
  this.drawChart();
367
367
  }
368
368
  }
369
369
  componentWillUnmount() {
370
- this.chart.node() && this.chart.node().remove();
370
+ this.destroyChart();
371
371
  window.removeEventListener('resize', this.handleResize);
372
372
  }
373
373
  render() {
@@ -22,7 +22,7 @@ class BarGroup extends _chartComponent.default {
22
22
  constructor(props) {
23
23
  super(props);
24
24
  this.handleResize = () => {
25
- this.chart.node() && this.chart.node().remove();
25
+ this.destroyChart();
26
26
  this.createChart();
27
27
  this.drawChart();
28
28
  };
@@ -239,12 +239,13 @@ class BarGroup extends _chartComponent.default {
239
239
  componentDidUpdate(prevProps) {
240
240
  super.componentDidUpdate(prevProps);
241
241
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
242
+ this.destroyChart();
242
243
  this.createChart();
243
244
  this.drawChart();
244
245
  }
245
246
  }
246
247
  componentWillUnmount() {
247
- this.chart.node() && this.chart.node().remove();
248
+ this.destroyChart();
248
249
  window.removeEventListener('resize', this.debouncedHandleResize);
249
250
  }
250
251
  render() {
@@ -23,7 +23,7 @@ class BarStack extends _chartComponent.default {
23
23
  constructor(props) {
24
24
  super(props);
25
25
  this.handleResize = () => {
26
- this.chart.node() && this.chart.node().remove();
26
+ this.destroyChart();
27
27
  this.createChart();
28
28
  this.drawChart();
29
29
  };
@@ -342,12 +342,13 @@ class BarStack extends _chartComponent.default {
342
342
  componentDidUpdate(prevProps) {
343
343
  super.componentDidUpdate(prevProps);
344
344
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
345
+ this.destroyChart();
345
346
  this.createChart();
346
347
  this.drawChart();
347
348
  }
348
349
  }
349
350
  componentWillUnmount() {
350
- this.chart.node() && this.chart.node().remove();
351
+ this.destroyChart();
351
352
  window.removeEventListener('resize', this.debouncedHandleResize);
352
353
  }
353
354
  render() {
@@ -21,7 +21,7 @@ class Bar extends _chartComponent.default {
21
21
  constructor(props) {
22
22
  super(props);
23
23
  this.handleResize = () => {
24
- this.chart.node() && this.chart.node().remove();
24
+ this.destroyChart();
25
25
  this.createChart();
26
26
  this.drawChart();
27
27
  };
@@ -228,12 +228,13 @@ class Bar extends _chartComponent.default {
228
228
  componentDidUpdate(prevProps) {
229
229
  super.componentDidUpdate(prevProps);
230
230
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
231
+ this.destroyChart();
231
232
  this.createChart();
232
233
  this.drawChart();
233
234
  }
234
235
  }
235
236
  componentWillUnmount() {
236
- this.chart.node() && this.chart.node().remove();
237
+ this.destroyChart();
237
238
  window.removeEventListener('resize', this.debouncedHandleResize);
238
239
  }
239
240
  render() {
@@ -27,15 +27,17 @@ class ChartComponent extends _react.Component {
27
27
  };
28
28
  };
29
29
  this.handleResize = (0, _lodashEs.debounce)(() => {
30
- var _this$chart;
31
30
  if (!this.createChart || !this.drawChart) return;
32
- ((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
31
+ this.destroyChart();
33
32
  this.createChart();
34
33
  this.drawChart();
35
34
  if (this.needRenderAxisLabel) {
36
35
  this.renderAxisLabel(this.props.chart, this.props.tables);
37
36
  }
38
37
  }, 300);
38
+ this.destroyChart = () => {
39
+ this.chart.node() && this.chart.node().remove();
40
+ };
39
41
  this.getTitle = (tables, table_id, yAxisType, yAxisKey) => {
40
42
  return yAxisType === _constants.CHART_SUMMARY_TYPE.COUNT ? _intl.default.get('Amount') : this.getAxisLabel(tables, table_id, yAxisKey);
41
43
  };
@@ -1676,14 +1678,14 @@ class ChartComponent extends _react.Component {
1676
1678
  this.transitionDuration = 500;
1677
1679
  this.areaTransitionDuration = 200;
1678
1680
  }
1681
+ componentDidMount() {
1682
+ window.addEventListener('resize', this.handleResize);
1683
+ }
1679
1684
  componentDidUpdate(prevProps) {
1680
1685
  if (prevProps.globalTheme !== this.props.globalTheme) {
1681
1686
  this.initLabelStroke(this.props.globalTheme);
1682
1687
  }
1683
1688
  }
1684
- componentDidMount() {
1685
- window.addEventListener('resize', this.handleResize);
1686
- }
1687
1689
  componentWillUnmount() {
1688
1690
  window.removeEventListener('resize', this.handleResize);
1689
1691
  }
@@ -21,7 +21,7 @@ class Combination extends _chartComponent.default {
21
21
  constructor(props) {
22
22
  super(props);
23
23
  this.handleResize = () => {
24
- this.chart.node() && this.chart.node().remove();
24
+ this.destroyChart();
25
25
  this.createChart();
26
26
  this.drawChart();
27
27
  };
@@ -458,12 +458,13 @@ class Combination extends _chartComponent.default {
458
458
  componentDidUpdate(prevProps) {
459
459
  super.componentDidUpdate(prevProps);
460
460
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
461
+ this.destroyChart();
461
462
  this.createChart();
462
463
  this.drawChart();
463
464
  }
464
465
  }
465
466
  componentWillUnmount() {
466
- this.chart.node() && this.chart.node().remove();
467
+ this.destroyChart();
467
468
  window.removeEventListener('resize', this.debouncedHandleResize);
468
469
  }
469
470
  render() {
@@ -20,7 +20,7 @@ class Completeness extends _chartComponent.default {
20
20
  constructor(props) {
21
21
  super(props);
22
22
  this.handleResize = () => {
23
- this.chart.node() && this.chart.node().remove();
23
+ this.destroyChart();
24
24
  this.createChart();
25
25
  this.drawChart();
26
26
  };
@@ -357,12 +357,14 @@ class Completeness extends _chartComponent.default {
357
357
  componentDidUpdate(prevProps) {
358
358
  super.componentDidUpdate(prevProps);
359
359
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
360
+ this.destroyChart();
361
+ this.createChart();
360
362
  this.drawChart();
361
363
  }
362
364
  }
363
365
  componentWillUnmount() {
364
366
  super.componentWillUnmount();
365
- this.chart.node() && this.chart.node().remove();
367
+ this.destroyChart();
366
368
  window.removeEventListener('resize', this.debouncedHandleResize);
367
369
  }
368
370
  render() {
@@ -20,7 +20,7 @@ class Completeness extends _chartComponent.default {
20
20
  constructor(props) {
21
21
  super(props);
22
22
  this.handleResize = () => {
23
- this.chart.node() && this.chart.node().remove();
23
+ this.destroyChart();
24
24
  this.createChart();
25
25
  this.drawChart();
26
26
  };
@@ -300,12 +300,14 @@ class Completeness extends _chartComponent.default {
300
300
  componentDidUpdate(prevProps) {
301
301
  super.componentDidUpdate(prevProps);
302
302
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
303
+ this.destroyChart();
304
+ this.createChart();
303
305
  this.drawChart();
304
306
  }
305
307
  }
306
308
  componentWillUnmount() {
307
309
  super.componentWillUnmount();
308
- this.chart.node() && this.chart.node().remove();
310
+ this.destroyChart();
309
311
  window.removeEventListener('resize', this.debouncedHandleResize);
310
312
  }
311
313
  render() {
@@ -23,7 +23,7 @@ class HorizontalBarGroup extends _chartComponent.default {
23
23
  constructor(props) {
24
24
  super(props);
25
25
  this.handleResize = (0, _lodashEs.debounce)(() => {
26
- this.chart.node() && this.chart.node().remove();
26
+ this.destroyChart();
27
27
  this.createChart();
28
28
  this.drawChart();
29
29
  }, 300);
@@ -253,14 +253,13 @@ class HorizontalBarGroup extends _chartComponent.default {
253
253
  componentDidUpdate(prevProps) {
254
254
  super.componentDidUpdate(prevProps);
255
255
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
256
- this.chart.node() && this.chart.node().remove();
256
+ this.destroyChart();
257
257
  this.createChart();
258
258
  this.drawChart();
259
259
  }
260
260
  }
261
261
  componentWillUnmount() {
262
- var _this$chart;
263
- ((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
262
+ this.destroyChart();
264
263
  window.removeEventListener('resize', this.handleResize);
265
264
  }
266
265
  render() {
@@ -23,7 +23,7 @@ class HorizontalBarStack extends _chartComponent.default {
23
23
  constructor(props) {
24
24
  super(props);
25
25
  this.handleResize = (0, _lodashEs.debounce)(() => {
26
- this.chart.node() && this.chart.node().remove();
26
+ this.destroyChart();
27
27
  this.createChart();
28
28
  this.drawChart();
29
29
  }, 300);
@@ -327,7 +327,7 @@ class HorizontalBarStack extends _chartComponent.default {
327
327
  componentDidUpdate(prevProps) {
328
328
  super.componentDidUpdate(prevProps);
329
329
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
330
- this.chart.node() && this.chart.node().remove();
330
+ this.destroyChart();
331
331
  this.createChart();
332
332
  this.drawChart();
333
333
  }
@@ -21,7 +21,7 @@ class HorizontalBar extends _chartComponent.default {
21
21
  constructor(props) {
22
22
  super(props);
23
23
  this.handleResize = () => {
24
- this.chart.node() && this.chart.node().remove();
24
+ this.destroyChart();
25
25
  this.createChart();
26
26
  this.drawChart();
27
27
  };
@@ -234,12 +234,14 @@ class HorizontalBar extends _chartComponent.default {
234
234
  componentDidUpdate(prevProps) {
235
235
  super.componentDidUpdate(prevProps);
236
236
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
237
+ this.destroyChart();
238
+ this.createChart();
237
239
  this.drawChart();
238
240
  }
239
241
  }
240
242
  componentWillUnmount() {
241
243
  super.componentWillUnmount();
242
- this.chart.node() && this.chart.node().remove();
244
+ this.destroyChart();
243
245
  window.removeEventListener('resize', this.debouncedHandleResize);
244
246
  }
245
247
  render() {
@@ -49,7 +49,8 @@ const Wrapper = _ref => {
49
49
  chartColorTheme,
50
50
  integratedEventTypes,
51
51
  integratedEventBus,
52
- isBigScreenPlugin
52
+ isBigScreenPlugin,
53
+ resizeSignal
53
54
  } = _ref;
54
55
  const [statisticRecords, setStatisticRecords] = (0, _react.useState)({});
55
56
  const [pivotTableColumnRow, setPivotTableColumnRow] = (0, _react.useState)({});
@@ -89,6 +90,7 @@ const Wrapper = _ref => {
89
90
  summaryColumnsWithMethod,
90
91
  globalTheme,
91
92
  chartColorTheme,
93
+ resizeSignal,
92
94
  toggleRecords: toggleStatisticRecordsDialog,
93
95
  isCalculateByView,
94
96
  isBigScreenPlugin
@@ -22,7 +22,7 @@ class LineGroup extends _chartComponent.default {
22
22
  constructor(props) {
23
23
  super(props);
24
24
  this.handleResize = () => {
25
- this.chart.node() && this.chart.node().remove();
25
+ this.destroyChart();
26
26
  this.createChart();
27
27
  this.drawChart();
28
28
  };
@@ -353,12 +353,13 @@ class LineGroup extends _chartComponent.default {
353
353
  componentDidUpdate(prevProps) {
354
354
  super.componentDidUpdate(prevProps);
355
355
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
356
+ this.destroyChart();
356
357
  this.createChart();
357
358
  this.drawChart();
358
359
  }
359
360
  }
360
361
  componentWillUnmount() {
361
- this.chart.node() && this.chart.node().remove();
362
+ this.destroyChart();
362
363
  window.removeEventListener('resize', this.debouncedHandleResize);
363
364
  }
364
365
  render() {
@@ -20,7 +20,7 @@ class Line extends _chartComponent.default {
20
20
  constructor(props) {
21
21
  super(props);
22
22
  this.handleResize = () => {
23
- this.chart.node() && this.chart.node().remove();
23
+ this.destroyChart();
24
24
  this.createChart();
25
25
  this.drawChart();
26
26
  };
@@ -330,12 +330,13 @@ class Line extends _chartComponent.default {
330
330
  componentDidUpdate(prevProps) {
331
331
  super.componentDidUpdate(prevProps);
332
332
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
333
+ this.destroyChart();
333
334
  this.createChart();
334
335
  this.drawChart();
335
336
  }
336
337
  }
337
338
  componentWillUnmount() {
338
- this.chart.node() && this.chart.node().remove();
339
+ this.destroyChart();
339
340
  window.removeEventListener('resize', this.debouncedHandleResize);
340
341
  }
341
342
  render() {
@@ -22,7 +22,7 @@ class MapBubble extends _chartComponent.default {
22
22
  constructor(props) {
23
23
  super(props);
24
24
  this.handleResize = () => {
25
- this.chart.node() && this.chart.node().remove();
25
+ this.destroyChart();
26
26
  this.createChart();
27
27
  this.drawChart();
28
28
  };
@@ -228,12 +228,13 @@ class MapBubble extends _chartComponent.default {
228
228
  componentDidUpdate(prevProps) {
229
229
  super.componentDidUpdate(prevProps);
230
230
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
231
+ this.destroyChart();
231
232
  this.createChart();
232
233
  this.drawChart();
233
234
  }
234
235
  }
235
236
  componentWillUnmount() {
236
- this.chart.node() && this.chart.node().remove();
237
+ this.destroyChart();
237
238
  window.removeEventListener('resize', this.debouncedHandleResize);
238
239
  }
239
240
  render() {
@@ -22,7 +22,7 @@ class MapBubble extends _chartComponent.default {
22
22
  constructor(props) {
23
23
  super(props);
24
24
  this.handleResize = () => {
25
- this.chart.node() && this.chart.node().remove();
25
+ this.destroyChart();
26
26
  this.createChart();
27
27
  this.drawChart();
28
28
  };
@@ -227,12 +227,13 @@ class MapBubble extends _chartComponent.default {
227
227
  componentDidUpdate(prevProps) {
228
228
  super.componentDidUpdate(prevProps);
229
229
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
230
+ this.destroyChart();
230
231
  this.createChart();
231
232
  this.drawChart();
232
233
  }
233
234
  }
234
235
  componentWillUnmount() {
235
- this.chart.node() && this.chart.node().remove();
236
+ this.destroyChart();
236
237
  window.removeEventListener('resize', this.debouncedHandleResize);
237
238
  }
238
239
  render() {
@@ -23,7 +23,7 @@ class Map extends _chartComponent.default {
23
23
  constructor(props) {
24
24
  super(props);
25
25
  this.handleResize = () => {
26
- this.chart.node() && this.chart.node().remove();
26
+ this.destroyChart();
27
27
  this.createChart();
28
28
  this.drawChart();
29
29
  };
@@ -240,12 +240,13 @@ class Map extends _chartComponent.default {
240
240
  componentDidUpdate(prevProps) {
241
241
  super.componentDidUpdate(prevProps);
242
242
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
243
+ this.destroyChart();
243
244
  this.createChart();
244
245
  this.drawChart();
245
246
  }
246
247
  }
247
248
  componentWillUnmount() {
248
- this.chart.node() && this.chart.node().remove();
249
+ this.destroyChart();
249
250
  window.removeEventListener('resize', this.debouncedHandleResize);
250
251
  }
251
252
  render() {
@@ -23,7 +23,7 @@ class Map extends _chartComponent.default {
23
23
  constructor(props) {
24
24
  super(props);
25
25
  this.handleResize = () => {
26
- this.chart.node() && this.chart.node().remove();
26
+ this.destroyChart();
27
27
  this.createChart();
28
28
  this.drawChart();
29
29
  };
@@ -228,12 +228,13 @@ class Map extends _chartComponent.default {
228
228
  componentDidUpdate(prevProps) {
229
229
  super.componentDidUpdate(prevProps);
230
230
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
231
+ this.destroyChart();
231
232
  this.createChart();
232
233
  this.drawChart();
233
234
  }
234
235
  }
235
236
  componentWillUnmount() {
236
- this.chart.node() && this.chart.node().remove();
237
+ this.destroyChart();
237
238
  window.removeEventListener('resize', this.debouncedHandleResize);
238
239
  }
239
240
  render() {
@@ -19,6 +19,11 @@ var _chartComponent = _interopRequireDefault(require("./chart-component"));
19
19
  class Pie extends _chartComponent.default {
20
20
  constructor(props) {
21
21
  super(props);
22
+ this.handleResize = () => {
23
+ this.destroyChart();
24
+ this.createChart();
25
+ this.drawChart();
26
+ };
22
27
  this.createChart = () => {
23
28
  const {
24
29
  chart
@@ -32,11 +37,6 @@ class Pie extends _chartComponent.default {
32
37
  };
33
38
  this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
34
39
  };
35
- this.handleResize = () => {
36
- this.chart.node() && this.chart.node().remove();
37
- this.createChart();
38
- this.drawChart();
39
- };
40
40
  this.drawChart = () => {
41
41
  const {
42
42
  result: data,
@@ -236,13 +236,13 @@ class Pie extends _chartComponent.default {
236
236
  componentDidUpdate(prevProps) {
237
237
  super.componentDidUpdate(prevProps);
238
238
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
239
- this.chart.node() && this.chart.node().remove();
239
+ this.destroyChart();
240
240
  this.createChart();
241
241
  this.drawChart();
242
242
  }
243
243
  }
244
244
  componentWillUnmount() {
245
- this.chart.node() && this.chart.node().remove();
245
+ this.destroyChart();
246
246
  window.removeEventListener('resize', this.debouncedHandleResize);
247
247
  }
248
248
  render() {
@@ -19,6 +19,11 @@ var _chartComponent = _interopRequireDefault(require("./chart-component"));
19
19
  class Ring extends _chartComponent.default {
20
20
  constructor(props) {
21
21
  super(props);
22
+ this.handleResize = () => {
23
+ this.destroyChart();
24
+ this.createChart();
25
+ this.drawChart();
26
+ };
22
27
  this.createChart = () => {
23
28
  const {
24
29
  chart
@@ -32,11 +37,6 @@ class Ring extends _chartComponent.default {
32
37
  };
33
38
  this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
34
39
  };
35
- this.handleResize = () => {
36
- this.chart.node() && this.chart.node().remove();
37
- this.createChart();
38
- this.drawChart();
39
- };
40
40
  this.drawChart = () => {
41
41
  const {
42
42
  result: data,
@@ -289,13 +289,13 @@ class Ring extends _chartComponent.default {
289
289
  componentDidUpdate(prevProps) {
290
290
  super.componentDidUpdate(prevProps);
291
291
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
292
- this.chart.node() && this.chart.node().remove();
292
+ this.destroyChart();
293
293
  this.createChart();
294
294
  this.drawChart();
295
295
  }
296
296
  }
297
297
  componentWillUnmount() {
298
- this.chart.node() && this.chart.node().remove();
298
+ this.destroyChart();
299
299
  window.removeEventListener('resize', this.debouncedHandleResize);
300
300
  }
301
301
  render() {
@@ -21,7 +21,7 @@ class Scatter extends _chartComponent.default {
21
21
  constructor(props) {
22
22
  super(props);
23
23
  this.handleResize = () => {
24
- this.chart.node() && this.chart.node().remove();
24
+ this.destroyChart();
25
25
  this.createChart();
26
26
  this.drawChart();
27
27
  };
@@ -290,12 +290,13 @@ class Scatter extends _chartComponent.default {
290
290
  componentDidUpdate(prevProps) {
291
291
  super.componentDidUpdate(prevProps);
292
292
  if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
293
+ this.destroyChart();
293
294
  this.createChart();
294
295
  this.drawChart();
295
296
  }
296
297
  }
297
298
  componentWillUnmount() {
298
- this.chart.node() && this.chart.node().remove();
299
+ this.destroyChart();
299
300
  window.removeEventListener('resize', this.debouncedHandleResize);
300
301
  }
301
302
  render() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "2.0.29",
3
+ "version": "2.0.30",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -158,4 +158,4 @@
158
158
  "publishConfig": {
159
159
  "access": "public"
160
160
  }
161
- }
161
+ }