@progress/kendo-charts 2.11.1-develop.1 → 2.11.1-develop.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.
@@ -344,28 +344,53 @@ class PlotAreaBase extends ChartElement {
344
344
  const unclipBox = pane.unclipBox();
345
345
  const clipBox = pane.chartContainer._clipBox();
346
346
  const padding = getSpacing(pane.options.padding || {});
347
-
348
- if (unclipBox.y1 < clipBox.y1 + padding.top) {
349
- change = true;
350
- padding.top = clipBox.y1 - unclipBox.y1 + padding.top;
347
+ const paneWidth = clipBox.width() + padding.left + padding.right;
348
+ const paneHeight = clipBox.height() + padding.top + padding.bottom;
349
+ const maxCorrectionFactor = 0.2;
350
+ let paneChange = false;
351
+
352
+ if (unclipBox.y1 < clipBox.y1 - padding.top) {
353
+ const top = clipBox.y1 - unclipBox.y1;
354
+ const maxTop = paneHeight * maxCorrectionFactor;
355
+
356
+ if (top <= maxTop && top > padding.top) {
357
+ paneChange = true;
358
+ padding.top = top;
359
+ }
351
360
  }
352
361
 
353
- if (unclipBox.y2 > clipBox.y2 - padding.bottom) {
354
- change = true;
355
- padding.bottom = unclipBox.y2 - clipBox.y2 + padding.bottom;
362
+ if (unclipBox.y2 > clipBox.y2 + padding.bottom) {
363
+ const bottom = unclipBox.y2 - clipBox.y2;
364
+ const maxBottom = paneHeight * maxCorrectionFactor;
365
+
366
+ if (bottom <= maxBottom && bottom > padding.bottom) {
367
+ paneChange = true;
368
+ padding.bottom = bottom;
369
+ }
356
370
  }
357
371
 
358
- if (unclipBox.x1 < clipBox.x1 + padding.left) {
359
- change = true;
360
- padding.left = clipBox.x1 - unclipBox.x1 + padding.left;
372
+ if (unclipBox.x1 < clipBox.x1 - padding.left) {
373
+ const left = clipBox.x1 - unclipBox.x1;
374
+ const maxLeft = paneWidth * maxCorrectionFactor;
375
+
376
+ if (left <= maxLeft && left > padding.left) {
377
+ paneChange = true;
378
+ padding.left = left;
379
+ }
361
380
  }
362
381
 
363
- if (unclipBox.x2 > clipBox.x2 - padding.right) {
364
- change = true;
365
- padding.right = unclipBox.x2 - clipBox.x2 + padding.right;
382
+ if (unclipBox.x2 > clipBox.x2 + padding.right) {
383
+ const right = unclipBox.x2 - clipBox.x2;
384
+ const maxRight = paneWidth * maxCorrectionFactor;
385
+
386
+ if (right <= maxRight && right > padding.right) {
387
+ paneChange = true;
388
+ padding.right = right;
389
+ }
366
390
  }
367
391
 
368
- if (change) {
392
+ if (paneChange) {
393
+ change = true;
369
394
  pane.options.padding = padding;
370
395
  }
371
396
  });
@@ -344,28 +344,53 @@ class PlotAreaBase extends ChartElement {
344
344
  const unclipBox = pane.unclipBox();
345
345
  const clipBox = pane.chartContainer._clipBox();
346
346
  const padding = getSpacing(pane.options.padding || {});
347
-
348
- if (unclipBox.y1 < clipBox.y1 + padding.top) {
349
- change = true;
350
- padding.top = clipBox.y1 - unclipBox.y1 + padding.top;
347
+ const paneWidth = clipBox.width() + padding.left + padding.right;
348
+ const paneHeight = clipBox.height() + padding.top + padding.bottom;
349
+ const maxCorrectionFactor = 0.2;
350
+ let paneChange = false;
351
+
352
+ if (unclipBox.y1 < clipBox.y1 - padding.top) {
353
+ const top = clipBox.y1 - unclipBox.y1;
354
+ const maxTop = paneHeight * maxCorrectionFactor;
355
+
356
+ if (top <= maxTop && top > padding.top) {
357
+ paneChange = true;
358
+ padding.top = top;
359
+ }
351
360
  }
352
361
 
353
- if (unclipBox.y2 > clipBox.y2 - padding.bottom) {
354
- change = true;
355
- padding.bottom = unclipBox.y2 - clipBox.y2 + padding.bottom;
362
+ if (unclipBox.y2 > clipBox.y2 + padding.bottom) {
363
+ const bottom = unclipBox.y2 - clipBox.y2;
364
+ const maxBottom = paneHeight * maxCorrectionFactor;
365
+
366
+ if (bottom <= maxBottom && bottom > padding.bottom) {
367
+ paneChange = true;
368
+ padding.bottom = bottom;
369
+ }
356
370
  }
357
371
 
358
- if (unclipBox.x1 < clipBox.x1 + padding.left) {
359
- change = true;
360
- padding.left = clipBox.x1 - unclipBox.x1 + padding.left;
372
+ if (unclipBox.x1 < clipBox.x1 - padding.left) {
373
+ const left = clipBox.x1 - unclipBox.x1;
374
+ const maxLeft = paneWidth * maxCorrectionFactor;
375
+
376
+ if (left <= maxLeft && left > padding.left) {
377
+ paneChange = true;
378
+ padding.left = left;
379
+ }
361
380
  }
362
381
 
363
- if (unclipBox.x2 > clipBox.x2 - padding.right) {
364
- change = true;
365
- padding.right = unclipBox.x2 - clipBox.x2 + padding.right;
382
+ if (unclipBox.x2 > clipBox.x2 + padding.right) {
383
+ const right = unclipBox.x2 - clipBox.x2;
384
+ const maxRight = paneWidth * maxCorrectionFactor;
385
+
386
+ if (right <= maxRight && right > padding.right) {
387
+ paneChange = true;
388
+ padding.right = right;
389
+ }
366
390
  }
367
391
 
368
- if (change) {
392
+ if (paneChange) {
393
+ change = true;
369
394
  pane.options.padding = padding;
370
395
  }
371
396
  });