Skip to content

Commit

Permalink
fix: Fixing issue with calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin Pillet committed Sep 15, 2022
1 parent d887495 commit 3fea7c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/custom-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default {
* @member {Number}
* @default 50 (%)
*/
maxZoomOutPercentage: 50,
maxZoomOutPercentage: 60,

/**
* The count of numbers after the point separator for float values of percent property
Expand Down
7 changes: 4 additions & 3 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export default {
}

outlabelPlugin.update(el, elements, index);
const x = outlabelPlugin.labelRect.x + (!outlabelPlugin.labelRect.isLeft ? 0 : outlabelPlugin.labelRect.width);
const y = outlabelPlugin.labelRect.y + (outlabelPlugin.labelRect.isTop ? 0 : outlabelPlugin.labelRect.height);
const x = outlabelPlugin.labelRect.x - (!outlabelPlugin.labelRect.isLeft ? 0 : outlabelPlugin.labelRect.width);
const y = outlabelPlugin.labelRect.y - (outlabelPlugin.labelRect.isTop ? 0 : outlabelPlugin.labelRect.height);
if (x < rect.x1) {
rect.x1 = x;
}
Expand All @@ -71,7 +71,8 @@ export default {
rect.x2 - chart.chartArea.right,
rect.y2 - chart.chartArea.bottom
];
const diff = Math.max(...maxDeltas.filter(x => x > 0), 0);
let diff = Math.max(...maxDeltas.filter(x => x > 0));
diff = Math.abs(diff) === Infinity ? 0 : diff;
const percent = diff * 100 / ctrl.outerRadius;
ctrl.outerRadius -= percent < max ? diff : max * 100 / ctrl.outerRadius;
ctrl.innerRadius = ctrl.outerRadius / 2;
Expand Down

0 comments on commit 3fea7c1

Please sign in to comment.