From 2ac0436bd497e7b660f5d2ff7104d1f6a4331358 Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Fri, 2 Oct 2020 15:13:04 +0300 Subject: [PATCH] Use full height for fullWidth box when left/right (#7836) Use full height for fullWidth box when left/right --- src/core/core.layouts.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/core/core.layouts.js b/src/core/core.layouts.js index 585bedd67..18e2aff7f 100644 --- a/src/core/core.layouts.js +++ b/src/core/core.layouts.js @@ -47,12 +47,14 @@ function setLayoutDims(layouts, params) { let i, ilen, layout; for (i = 0, ilen = layouts.length; i < ilen; ++i) { layout = layouts[i]; - // store width used instead of chartArea.w in fitBoxes - layout.width = layout.horizontal - ? layout.box.fullWidth && params.availableWidth - : params.vBoxMaxWidth; - // store height used instead of chartArea.h in fitBoxes - layout.height = layout.horizontal && params.hBoxMaxHeight; + // store dimensions used instead of available chartArea in fitBoxes + if (layout.horizontal) { + layout.width = layout.box.fullWidth && params.availableWidth; + layout.height = params.hBoxMaxHeight; + } else { + layout.width = params.vBoxMaxWidth; + layout.height = layout.box.fullWidth && params.availableHeight; + } } } @@ -187,8 +189,8 @@ function placeBoxes(boxes, chartArea, params) { } else { box.left = x; box.right = x + box.width; - box.top = chartArea.top; - box.bottom = chartArea.top + chartArea.h; + box.top = box.fullWidth ? userPadding.top : chartArea.top; + box.bottom = box.fullWidth ? params.outerHeight - userPadding.right : chartArea.top + chartArea.h; box.height = box.bottom - box.top; x = box.right; } @@ -344,6 +346,7 @@ export default { outerHeight: height, padding, availableWidth, + availableHeight, vBoxMaxWidth: availableWidth / 2 / verticalBoxes.length, hBoxMaxHeight: availableHeight / 2 }); -- 2.47.2