@eclipse-scout/chart 22.0.0-beta.10 → 22.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-scout/chart",
3
- "version": "22.0.0-beta.10",
3
+ "version": "22.0.1",
4
4
  "description": "Eclipse Scout chart",
5
5
  "author": "BSI Business Systems Integration AG",
6
6
  "homepage": "https://www.eclipse.org/scout",
@@ -25,13 +25,13 @@
25
25
  "src"
26
26
  ],
27
27
  "devDependencies": {
28
- "@eclipse-scout/cli": "22.0.0-beta.10",
28
+ "@eclipse-scout/cli": "22.0.1",
29
29
  "@eclipse-scout/releng": "^22.0.0",
30
30
  "jasmine-core": "3.10.1",
31
31
  "karma": "6.3.9"
32
32
  },
33
33
  "dependencies": {
34
- "@eclipse-scout/core": "22.0.0-beta.10",
34
+ "@eclipse-scout/core": "22.0.1",
35
35
  "jquery": "3.6.0",
36
36
  "chart.js": "3.7.0",
37
37
  "chartjs-plugin-datalabels": "2.0.0"
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2010-2020 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
@@ -96,13 +96,6 @@ export default class AbstractChartRenderer {
96
96
  // Override in subclasses
97
97
  }
98
98
 
99
- checkCompletlyRendered() {
100
- if (this.rendered || !this.chart.data) {
101
- return;
102
- }
103
- this.render();
104
- }
105
-
106
99
  renderCheckedItems() {
107
100
  if (this.rendered) {
108
101
  this._renderCheckedItems();
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
@@ -45,6 +45,7 @@ export default class Chart extends Widget {
45
45
 
46
46
  this._updateChartTimeoutId = null;
47
47
  this._updateChartOpts = null;
48
+ this._updateChartOptsWhileNotAttached = [];
48
49
  this.updatedOnce = false;
49
50
  }
50
51
 
@@ -103,6 +104,11 @@ export default class Chart extends Widget {
103
104
  });
104
105
  }
105
106
 
107
+ _renderOnAttach() {
108
+ super._renderOnAttach();
109
+ this._updateChartOptsWhileNotAttached.splice(0).forEach(opts => this.updateChart($.extend(true, {}, opts, {debounce: true})));
110
+ }
111
+
106
112
  _remove() {
107
113
  if (this.chartRenderer) {
108
114
  this.chartRenderer.remove(false);
@@ -278,6 +284,7 @@ export default class Chart extends Widget {
278
284
  */
279
285
  updateChart(opts) {
280
286
  opts = opts || {};
287
+ opts.enforceRerender = !opts.onlyUpdateData && !opts.onlyRefresh;
281
288
 
282
289
  // Cancel previously scheduled update and merge opts
283
290
  if (this._updateChartTimeoutId) {
@@ -287,6 +294,7 @@ export default class Chart extends Widget {
287
294
  opts.requestAnimation = opts.requestAnimation || this._updateChartOpts.requestAnimation;
288
295
  opts.onlyUpdateData = opts.onlyUpdateData || this._updateChartOpts.onlyUpdateData;
289
296
  opts.onlyRefresh = opts.onlyRefresh || this._updateChartOpts.onlyRefresh;
297
+ opts.enforceRerender = opts.enforceRerender || this._updateChartOpts.enforceRerender;
290
298
  }
291
299
  this._updateChartTimeoutId = null;
292
300
  this._updateChartOpts = null;
@@ -310,11 +318,17 @@ export default class Chart extends Widget {
310
318
  function updateChartImpl() {
311
319
  this._updateChartTimeoutId = null;
312
320
  this._updateChartOpts = null;
313
- if (opts.onlyUpdateData && this.chartRenderer && this.chartRenderer.isDataUpdatable()) {
314
- this.chartRenderer.updateData(opts.requestAnimation);
315
- } else if (opts.onlyRefresh && this.chartRenderer) {
316
- this.chartRenderer.refresh();
317
- } else if (this.chartRenderer) {
321
+
322
+ if (!this.$container || !this.$container.isAttached()) {
323
+ this._updateChartOptsWhileNotAttached.push(opts);
324
+ return;
325
+ }
326
+
327
+ this.updatedOnce = true;
328
+ if (!this.chartRenderer) {
329
+ return; // nothing to render when there is no renderer.
330
+ }
331
+ if (opts.enforceRerender) {
318
332
  this.chartRenderer.remove(this.chartRenderer.shouldAnimateRemoveOnUpdate(opts), chartAnimationStopping => {
319
333
  if (this.removing || chartAnimationStopping) {
320
334
  // prevent exceptions trying to render after navigated away, and do not update/render while a running animation is being stopped
@@ -323,8 +337,11 @@ export default class Chart extends Widget {
323
337
  this.chartRenderer.render(opts.requestAnimation);
324
338
  this.trigger('chartRender');
325
339
  });
340
+ } else if (opts.onlyUpdateData && this.chartRenderer.isDataUpdatable()) {
341
+ this.chartRenderer.updateData(opts.requestAnimation);
342
+ } else if (opts.onlyRefresh) {
343
+ this.chartRenderer.refresh();
326
344
  }
327
- this.updatedOnce = true;
328
345
  }
329
346
  }
330
347
 
@@ -986,7 +986,9 @@ export default class ChartJsRenderer extends AbstractChartRenderer {
986
986
  }
987
987
 
988
988
  let maxLabelPrefSize = 0;
989
- this._tooltip.$container.find('label').each((idx, elem) => maxLabelPrefSize = Math.max(maxLabelPrefSize, graphics.prefSize($(elem)).width));
989
+ this._tooltip.$container.find('label').each((idx, elem) => {
990
+ maxLabelPrefSize = Math.max(maxLabelPrefSize, graphics.prefSize($(elem)).width);
991
+ });
990
992
  if (maxLabelPrefSize > 0) {
991
993
  this._tooltip.$container
992
994
  .css('--chart-tooltip-label-width', Math.min(maxLabelPrefSize, 120) + 'px');
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
@@ -112,14 +112,6 @@ export default class VennChartRenderer extends AbstractSvgChartRenderer {
112
112
  }
113
113
  }
114
114
 
115
- checkCompletlyRendered() {
116
- if (this.readyToDraw) {
117
- this._draw(false, true);
118
- } else {
119
- super.checkCompletlyRendered();
120
- }
121
- }
122
-
123
115
  remove(requestAnimation, afterRemoveFunc) {
124
116
  this._cancelAsync3Calculator();
125
117
  super.remove(requestAnimation, afterRemoveFunc);
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2010-2020 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
@@ -36,11 +36,4 @@ export default class ChartField extends FormField {
36
36
  this.chart.remove();
37
37
  this._removeField();
38
38
  }
39
-
40
- _renderOnAttach() {
41
- super._renderOnAttach();
42
- if (this.chart && this.chart.chartRenderer) {
43
- this.chart.chartRenderer.checkCompletlyRendered();
44
- }
45
- }
46
39
  }