@eclipse-scout/chart 22.0.0-beta.5 → 22.0.2

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.
@@ -13,7 +13,7 @@ __webpack_require__.r(__webpack_exports__);
13
13
  /* harmony export */ "default": () => (/* binding */ AbstractChartRenderer)
14
14
  /* harmony export */ });
15
15
  /*
16
- * Copyright (c) 2010-2020 BSI Business Systems Integration AG.
16
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
17
17
  * All rights reserved. This program and the accompanying materials
18
18
  * are made available under the terms of the Eclipse Public License v1.0
19
19
  * which accompanies this distribution, and is available at
@@ -119,14 +119,6 @@ class AbstractChartRenderer {
119
119
  _render() {// Override in subclasses
120
120
  }
121
121
 
122
- checkCompletlyRendered() {
123
- if (this.rendered || !this.chart.data) {
124
- return;
125
- }
126
-
127
- this.render();
128
- }
129
-
130
122
  renderCheckedItems() {
131
123
  if (this.rendered) {
132
124
  this._renderCheckedItems();
@@ -669,7 +661,7 @@ __webpack_require__.r(__webpack_exports__);
669
661
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
670
662
 
671
663
  /*
672
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
664
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
673
665
  * All rights reserved. This program and the accompanying materials
674
666
  * are made available under the terms of the Eclipse Public License v1.0
675
667
  * which accompanies this distribution, and is available at
@@ -712,6 +704,7 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
712
704
  this.checkedItems = [];
713
705
  this._updateChartTimeoutId = null;
714
706
  this._updateChartOpts = null;
707
+ this._updateChartOptsWhileNotAttached = [];
715
708
  this.updatedOnce = false;
716
709
  }
717
710
 
@@ -747,6 +740,14 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
747
740
  });
748
741
  }
749
742
 
743
+ _renderOnAttach() {
744
+ super._renderOnAttach();
745
+
746
+ this._updateChartOptsWhileNotAttached.splice(0).forEach(opts => this.updateChart($.extend(true, {}, opts, {
747
+ debounce: true
748
+ })));
749
+ }
750
+
750
751
  _remove() {
751
752
  if (this.chartRenderer) {
752
753
  this.chartRenderer.remove(false);
@@ -945,7 +946,8 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
945
946
 
946
947
 
947
948
  updateChart(opts) {
948
- opts = opts || {}; // Cancel previously scheduled update and merge opts
949
+ opts = opts || {};
950
+ opts.enforceRerender = !opts.onlyUpdateData && !opts.onlyRefresh; // Cancel previously scheduled update and merge opts
949
951
 
950
952
  if (this._updateChartTimeoutId) {
951
953
  clearTimeout(this._updateChartTimeoutId);
@@ -953,6 +955,9 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
953
955
  if (this._updateChartOpts) {
954
956
  // Inherit 'true' values from previously scheduled updates
955
957
  opts.requestAnimation = opts.requestAnimation || this._updateChartOpts.requestAnimation;
958
+ opts.onlyUpdateData = opts.onlyUpdateData || this._updateChartOpts.onlyUpdateData;
959
+ opts.onlyRefresh = opts.onlyRefresh || this._updateChartOpts.onlyRefresh;
960
+ opts.enforceRerender = opts.enforceRerender || this._updateChartOpts.enforceRerender;
956
961
  }
957
962
 
958
963
  this._updateChartTimeoutId = null;
@@ -979,11 +984,19 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
979
984
  this._updateChartTimeoutId = null;
980
985
  this._updateChartOpts = null;
981
986
 
982
- if (opts.onlyUpdateData && this.chartRenderer && this.chartRenderer.isDataUpdatable()) {
983
- this.chartRenderer.updateData(opts.requestAnimation);
984
- } else if (opts.onlyRefresh && this.chartRenderer) {
985
- this.chartRenderer.refresh();
986
- } else if (this.chartRenderer) {
987
+ if (!this.$container || !this.$container.isAttached()) {
988
+ this._updateChartOptsWhileNotAttached.push(opts);
989
+
990
+ return;
991
+ }
992
+
993
+ this.updatedOnce = true;
994
+
995
+ if (!this.chartRenderer) {
996
+ return; // nothing to render when there is no renderer.
997
+ }
998
+
999
+ if (opts.enforceRerender) {
987
1000
  this.chartRenderer.remove(this.chartRenderer.shouldAnimateRemoveOnUpdate(opts), chartAnimationStopping => {
988
1001
  if (this.removing || chartAnimationStopping) {
989
1002
  // prevent exceptions trying to render after navigated away, and do not update/render while a running animation is being stopped
@@ -993,9 +1006,11 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
993
1006
  this.chartRenderer.render(opts.requestAnimation);
994
1007
  this.trigger('chartRender');
995
1008
  });
1009
+ } else if (opts.onlyUpdateData && this.chartRenderer.isDataUpdatable()) {
1010
+ this.chartRenderer.updateData(opts.requestAnimation);
1011
+ } else if (opts.onlyRefresh) {
1012
+ this.chartRenderer.refresh();
996
1013
  }
997
-
998
- this.updatedOnce = true;
999
1014
  }
1000
1015
  }
1001
1016
 
@@ -2181,16 +2196,28 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
2181
2196
 
2182
2197
  this._tooltip.$container.css('pointer-events', 'none');
2183
2198
 
2199
+ let reposition = false;
2200
+
2184
2201
  if ((tooltipOptions.titleFont || {}).family) {
2185
2202
  this._tooltip.$container.css('--chart-tooltip-font-family', tooltipOptions.titleFont.family);
2203
+
2204
+ reposition = true;
2186
2205
  }
2187
2206
 
2188
2207
  let maxLabelPrefSize = 0;
2189
2208
 
2190
- this._tooltip.$container.find('label').each((idx, elem) => maxLabelPrefSize = Math.max(maxLabelPrefSize, _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_2__.graphics.prefSize(jquery__WEBPACK_IMPORTED_MODULE_4___default()(elem)).width));
2209
+ this._tooltip.$container.find('label').each((idx, elem) => {
2210
+ maxLabelPrefSize = Math.max(maxLabelPrefSize, _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_2__.graphics.prefSize(jquery__WEBPACK_IMPORTED_MODULE_4___default()(elem)).width);
2211
+ });
2191
2212
 
2192
2213
  if (maxLabelPrefSize > 0) {
2193
2214
  this._tooltip.$container.css('--chart-tooltip-label-width', Math.min(maxLabelPrefSize, 120) + 'px');
2215
+
2216
+ reposition = true;
2217
+ }
2218
+
2219
+ if (reposition) {
2220
+ this._tooltip.position();
2194
2221
  }
2195
2222
  }
2196
2223
 
@@ -5434,7 +5461,7 @@ __webpack_require__.r(__webpack_exports__);
5434
5461
  /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ "jquery");
5435
5462
  /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);
5436
5463
  /*
5437
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
5464
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
5438
5465
  * All rights reserved. This program and the accompanying materials
5439
5466
  * are made available under the terms of the Eclipse Public License v1.0
5440
5467
  * which accompanies this distribution, and is available at
@@ -5546,14 +5573,6 @@ class VennChartRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractSvgC
5546
5573
  }
5547
5574
  }
5548
5575
 
5549
- checkCompletlyRendered() {
5550
- if (this.readyToDraw) {
5551
- this._draw(false, true);
5552
- } else {
5553
- super.checkCompletlyRendered();
5554
- }
5555
- }
5556
-
5557
5576
  remove(requestAnimation, afterRemoveFunc) {
5558
5577
  this._cancelAsync3Calculator();
5559
5578
 
@@ -6004,7 +6023,7 @@ __webpack_require__.r(__webpack_exports__);
6004
6023
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @eclipse-scout/core */ "@eclipse-scout/core");
6005
6024
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__);
6006
6025
  /*
6007
- * Copyright (c) 2010-2020 BSI Business Systems Integration AG.
6026
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
6008
6027
  * All rights reserved. This program and the accompanying materials
6009
6028
  * are made available under the terms of the Eclipse Public License v1.0
6010
6029
  * which accompanies this distribution, and is available at
@@ -6043,14 +6062,6 @@ class ChartField extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__.FormFi
6043
6062
  this._removeField();
6044
6063
  }
6045
6064
 
6046
- _renderOnAttach() {
6047
- super._renderOnAttach();
6048
-
6049
- if (this.chart && this.chart.chartRenderer) {
6050
- this.chart.chartRenderer.checkCompletlyRendered();
6051
- }
6052
- }
6053
-
6054
6065
  }
6055
6066
 
6056
6067
  /***/ }),