Skip to content

Commit

Permalink
use same heigth for horizontal axes in step 4 thats used in steps 5/6
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Jan 28, 2019
1 parent 7c0ad5a commit 5aa6c63
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/core/core.layouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ 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. 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
Expand All @@ -183,13 +182,10 @@ module.exports = {
var chartWidth = width - leftPadding - rightPadding;
var chartHeight = height - topPadding - bottomPadding;
var chartAreaWidth = chartWidth / 2; // min 50%
var chartAreaHeight = chartHeight / 2; // min 50%

// Step 2
var verticalBoxWidth = (width - chartAreaWidth) / (leftBoxes.length + rightBoxes.length);

// Step 3
var horizontalBoxHeight = (height - chartAreaHeight) / (topBoxes.length + bottomBoxes.length);

// Step 4
var maxChartAreaWidth = chartWidth;
Expand All @@ -201,7 +197,7 @@ module.exports = {
var isHorizontal = box.isHorizontal();

if (isHorizontal) {
minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, horizontalBoxHeight);
minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2);
maxChartAreaHeight -= minSize.height;
} else {
minSize = box.update(verticalBoxWidth, maxChartAreaHeight);
Expand Down

0 comments on commit 5aa6c63

Please sign in to comment.