From 075e61a7f68404fb8ea61922c9d248702a4262dc Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Tue, 29 Jan 2019 19:09:59 +0200 Subject: [PATCH] revert numbering, add a TODO in Step3 --- src/core/core.layouts.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/core/core.layouts.js b/src/core/core.layouts.js index 2f0f314d7eb..cfa137c96bc 100644 --- a/src/core/core.layouts.js +++ b/src/core/core.layouts.js @@ -203,12 +203,13 @@ module.exports = { // What we do to find the best sizing, we do the following // 1. Determine the minimum size of the chart area. // 2. Split the remaining width equally between each vertical axis - // 3. Give each layout the maximum size it can be. The layout will return it's minimum size - // 4. Adjust the sizes of each axis based on it's minimum reported size. - // 5. Refit each axis - // 6. Position each axis in the final location - // 7. Tell the chart the final location of the chart area - // 8. Tell any axes that overlay the chart area the positions of the chart area + // 3. Split the remaining height equally between each horizontal axis + // 4. Give each layout the maximum size it can be. The layout will return it's minimum size + // 5. Adjust the sizes of each axis based on it's minimum reported size. + // 6. Refit each axis + // 7. Position each axis in the final location + // 8. Tell the chart the final location of the chart area + // 9. Tell any axes that overlay the chart area the positions of the chart area // Step 1 var chartWidth = width - leftPadding - rightPadding; @@ -219,6 +220,10 @@ module.exports = { var verticalBoxWidth = (width - chartAreaWidth) / verticalBoxes.length; // Step 3 + // TODO re-limit horizontal axis height (this limit has affected only padding calculation since PR 1837) + // var horizontalBoxHeight = (height - chartAreaHeight) / (topBoxes.length + bottomBoxes.length); + + // Step 4 var maxChartAreaWidth = chartWidth; var maxChartAreaHeight = chartHeight; var outerBoxSizes = {top: topPadding, left: leftPadding, bottom: bottomPadding, right: rightPadding}; @@ -251,7 +256,7 @@ module.exports = { // At this point, maxChartAreaHeight and maxChartAreaWidth are the size the chart area could // be if the axes are drawn at their minimum sizes. - // Steps 4 & 5 + // Steps 5 & 6 // Function to fit a box function fitBox(box) { @@ -339,7 +344,7 @@ module.exports = { maxChartAreaWidth = newMaxChartAreaWidth; } - // Step 6 - Position the boxes + // Step 7 - Position the boxes var left = leftPadding + leftPaddingAddition; var top = topPadding + topPaddingAddition; @@ -374,7 +379,7 @@ module.exports = { helpers.each(rightBoxes, placeBox); helpers.each(bottomBoxes, placeBox); - // Step 7 + // Step 8 chart.chartArea = { left: outerBoxSizes.left, top: outerBoxSizes.top, @@ -382,7 +387,7 @@ module.exports = { bottom: outerBoxSizes.top + maxChartAreaHeight }; - // Step 8 + // Step 9 helpers.each(chartAreaBoxes, function(box) { box.left = chart.chartArea.left; box.top = chart.chartArea.top;