@eclipse-scout/chart 25.2.0-beta.2 → 25.2.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.
@@ -84,7 +84,7 @@ __webpack_require__.r(__webpack_exports__);
84
84
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @eclipse-scout/core */ "@eclipse-scout/core");
85
85
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__);
86
86
  /*
87
- * Copyright (c) 2010, 2024 BSI Business Systems Integration AG
87
+ * Copyright (c) 2010, 2025 BSI Business Systems Integration AG
88
88
  *
89
89
  * This program and the accompanying materials are made
90
90
  * available under the terms of the Eclipse Public License 2.0
@@ -210,6 +210,9 @@ class AbstractChartRenderer extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE
210
210
  return true;
211
211
  }
212
212
  refresh() {
213
+ if (this.rendering) {
214
+ return;
215
+ }
213
216
  if (this.rendered) {
214
217
  this.remove(false);
215
218
  }
@@ -3353,12 +3356,12 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
3353
3356
  });
3354
3357
  }
3355
3358
  _adjustSize(config, chartArea, options) {
3356
- this._adjustBubbleSizes(config, chartArea, options);
3359
+ chartArea = this._adjustBubbleSizes(config, chartArea, options);
3357
3360
  this._adjustGridMaxMin(config, chartArea, options);
3358
3361
  }
3359
3362
  _adjustBubbleSizes(config, chartArea, options) {
3360
3363
  if (config.type !== _index__WEBPACK_IMPORTED_MODULE_0__.Chart.Type.BUBBLE) {
3361
- return;
3364
+ return chartArea;
3362
3365
  }
3363
3366
  let datasets = config.data.datasets;
3364
3367
  // Scale all bubbles so that the largest radius is equal to sizeOfLargestBubble and the smallest greater than or equal to minBubbleSize.
@@ -3421,6 +3424,13 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
3421
3424
  data.r = data.r * bubbleScalingFactor + bubbleRadiusOffset;
3422
3425
  }
3423
3426
  }));
3427
+ if (!this.chartJs) {
3428
+ return chartArea;
3429
+ }
3430
+ // chartJs sets the chartArea depending on the bubble sizes and subtracts the max radius from the height / width.
3431
+ // this results in a different grid layout, and we need to refresh before the next calculations.
3432
+ this.refresh();
3433
+ return this.chartJs.chartArea;
3424
3434
  }
3425
3435
  _computeMaxMinValue(config, datasets, options) {
3426
3436
  if (!datasets) {
@@ -3431,7 +3441,8 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
3431
3441
  exact,
3432
3442
  boundRange,
3433
3443
  padding,
3434
- space
3444
+ space,
3445
+ offset
3435
3446
  } = options || {};
3436
3447
  const isDatasetVisible = options?.isDatasetVisible || (i => true);
3437
3448
  // do not use 0 as default as the max-min-range might not include 0, e.g. all values are greater than 10.000
@@ -3506,6 +3517,11 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
3506
3517
  if (padding && space && space > 2 * padding) {
3507
3518
  let valuePerPixel = (maxValue - minValue) / (space - 2 * padding),
3508
3519
  paddingValue = valuePerPixel * padding;
3520
+ // When there are only integers and an offset, the offset will cover at least a span of 0.5 (half the space between two ticks, stepSize = 1).
3521
+ // Therefore, a paddingValue between 0 and 0.5 can be eliminated.
3522
+ if (offset && this.onlyIntegers && 0 < paddingValue && paddingValue <= 0.5) {
3523
+ paddingValue = 0;
3524
+ }
3509
3525
  maxBoundary = Math.max(maxBoundary, maxValue - adjust + paddingValue);
3510
3526
  minBoundary = Math.min(minBoundary, minValue - adjust - paddingValue);
3511
3527
  }
@@ -3624,22 +3640,21 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
3624
3640
  if (config.options.elements && config.options.elements.point && config.options.elements.point.hoverRadius) {
3625
3641
  padding = padding + config.options.elements.point.hoverRadius;
3626
3642
  }
3627
- if (offset) {
3628
- boundary = this._computeMaxMinValue(config, datasets, {
3629
- ...options,
3630
- exact: !!labelMap,
3631
- boundRange: true,
3632
- space: null
3633
- });
3634
- } else {
3635
- boundary = this._computeMaxMinValue(config, datasets, {
3636
- ...options,
3637
- exact: !!labelMap,
3638
- boundRange: true,
3639
- padding
3640
- });
3641
- }
3643
+ boundary = this._computeMaxMinValue(config, datasets, {
3644
+ ...options,
3645
+ exact: !!labelMap,
3646
+ boundRange: true,
3647
+ padding,
3648
+ offset
3649
+ });
3642
3650
  if (labelMap) {
3651
+ // if we have a labelMap compare the min and max key of the labelMap and the boundary.
3652
+ // in order to show all data and labels we have to take lowest and highest value.
3653
+ const keys = Object.keys(labelMap).map(Number).filter(isFinite);
3654
+ if (keys.length) {
3655
+ boundary.minValue = Math.min(boundary.minValue, Math.min(...keys));
3656
+ boundary.maxValue = Math.max(boundary.maxValue, Math.max(...keys));
3657
+ }
3643
3658
  boundary.maxValue = Math.ceil(boundary.maxValue);
3644
3659
  boundary.minValue = Math.floor(boundary.minValue);
3645
3660
  }
@@ -4421,6 +4436,7 @@ __webpack_require__.r(__webpack_exports__);
4421
4436
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @eclipse-scout/core */ "@eclipse-scout/core");
4422
4437
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__);
4423
4438
  /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index */ "./src/index.ts");
4439
+ var _staticBlock;
4424
4440
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4425
4441
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4426
4442
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -4471,11 +4487,10 @@ class SpeedoChartRenderer extends _index__WEBPACK_IMPORTED_MODULE_1__.AbstractSv
4471
4487
  static TEN_THOUSAND = 10000;
4472
4488
  static ONE_MILLION = 1000000;
4473
4489
  static ARC_MIN = (() => -0.25)();
4474
- static ARC_MAX = 0.25;
4475
- static #_ = (() => {
4490
+ static ARC_MAX = (() => (_staticBlock = () => {
4476
4491
  _defineProperty(this, "ARC_RANGE", SpeedoChartRenderer.ARC_MAX - SpeedoChartRenderer.ARC_MIN);
4477
4492
  _defineProperty(this, "SEGMENT_GAP", 0.0103);
4478
- })();
4493
+ }, 0.25))();
4479
4494
  // space between two segments (lines)
4480
4495
  _validate() {
4481
4496
  let chartData = this.chart.data;
@@ -4787,6 +4802,7 @@ class SpeedoChartRenderer extends _index__WEBPACK_IMPORTED_MODULE_1__.AbstractSv
4787
4802
  });
4788
4803
  }
4789
4804
  }
4805
+ _staticBlock();
4790
4806
 
4791
4807
  /***/ }),
4792
4808