docs: function(chart, width, height) {
  		if (!chart) {
  			return;
  		}
  
  		var layoutOptions = chart.options.layout || {};
  		var padding = helpers$1.options.toPadding(layoutOptions.padding);
  		var leftPadding = padding.left;
  		var rightPadding = padding.right;
  		var topPadding = padding.top;
  		var bottomPadding = padding.bottom;
  
  		var leftBoxes = filterByPosition(chart.boxes, 'left');
  		var rightBoxes = filterByPosition(chart.boxes, 'right');
  		var topBoxes = filterByPosition(chart.boxes, 'top');
  		var bottomBoxes = filterByPosition(chart.boxes, 'bottom');
  		var chartAreaBoxes = filterByPosition(chart.boxes, 'chartArea');
  
  		// Sort boxes by weight. A higher weight is further away from the chart area
  		sortByWeight(leftBoxes, true);
  		sortByWeight(rightBoxes, false);
  		sortByWeight(topBoxes, true);
  		sortByWeight(bottomBoxes, false);
  
  		var verticalBoxes = leftBoxes.concat(rightBoxes);
  		var horizontalBoxes = topBoxes.concat(bottomBoxes);
  		var outerBoxes = verticalBoxes.concat(horizontalBoxes);
  
  		// Essentially we now have any number of boxes on each of the 4 sides.
  		// Our canvas looks like the following.
  		// The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and
  		// B1 is the bottom axis
  		// There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays
  		// These locations are single-box locations only, when trying to register a chartArea location that is already taken,
  		// an error will be thrown.
  		//
  		// |----------------------------------------------------|
  		// |                  T1 (Full Width)                   |
  		// |----------------------------------------------------|
  		// |    |    |                 T2                  |    |
  		// |    |----|-------------------------------------|----|
  		// |    |    | C1 |                           | C2 |    |
  		// |    |    |----|                           |----|    |
  		// |    |    |                                     |    |
  		// | L1 | L2 |           ChartArea (C0)            | R1 |
  		// |    |    |                                     |    |
  		// |    |    |----|                           |----|    |
  		// |    |    | C3 |                           | C4 |    |
  		// |    |----|-------------------------------------|----|
  		// |    |    |                 B1                  |    |
  		// |----------------------------------------------------|
  		// |                  B2 (Full Width)                   |
  		// |----------------------------------------------------|
  		//
  		// 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
  		// 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;
  		var chartHeight = height - topPadding - bottomPadding;
  		var chartAreaWidth = chartWidth / 2; // min 50%
  
  		// Step 2
  		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) / horizontalBoxes.length;
  
  		// Step 4
  		var maxChartAreaWidth = chartWidth;
  		var maxChartAreaHeight = chartHeight;
  		var outerBoxSizes = {top: topPadding, left: leftPadding, bottom: bottomPadding, right: rightPadding};
  		var minBoxSizes = [];
  		var maxPadding;
  
  		function getMinimumBoxSize(box) {
  			var minSize;
  			var isHorizontal = box.isHorizontal();
  
  			if (isHorizontal) {
  				minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2);
  				maxChartAreaHeight -= minSize.height;
  			} else {
  				minSize = box.update(verticalBoxWidth, maxChartAreaHeight);
  				maxChartAreaWidth -= minSize.width;
  			}
  
  			minBoxSizes.push({
  				horizontal: isHorizontal,
  				width: minSize.width,
  				box: box,
  			});
  		}
  
  		helpers$1.each(outerBoxes, getMinimumBoxSize);
  
  		// If a horizontal box has padding, we move the left boxes over to avoid ugly charts (see issue #2478)
  		maxPadding = findMaxPadding(outerBoxes);
  
  		// At this point, maxChartAreaHeight and maxChartAreaWidth are the size the chart area could
  		// be if the axes are drawn at their minimum sizes.
  		// Steps 5 & 6
  
  		// Function to fit a box
  		function fitBox(box) {
  			var minBoxSize = helpers$1.findNextWhere(minBoxSizes, function(minBox) {
  				return minBox.box === box;
  			});
  
  			if (minBoxSize) {
  				if (minBoxSize.horizontal) {
  					var scaleMargin = {
  						left: Math.max(outerBoxSizes.left, maxPadding.left),
  						right: Math.max(outerBoxSizes.right, maxPadding.right),
  						top: 0,
  						bottom: 0
  					};
  
  					// Don't use min size here because of label rotation. When the labels are rotated, their rotation highly depends
  					// on the margin. Sometimes they need to increase in size slightly
  					box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin);
  				} else {
  					box.update(minBoxSize.width, maxChartAreaHeight);
  				}
  			}
  		}
  
  		// Update, and calculate the left and right margins for the horizontal boxes
  		helpers$1.each(verticalBoxes, fitBox);
  		addSizeByPosition(verticalBoxes, outerBoxSizes);
  
  		// Set the Left and Right margins for the horizontal boxes
  		helpers$1.each(horizontalBoxes, fitBox);
  		addSizeByPosition(horizontalBoxes, outerBoxSizes);
  
  		function finalFitVerticalBox(box) {
  			var minBoxSize = helpers$1.findNextWhere(minBoxSizes, function(minSize) {
  				return minSize.box === box;
  			});
  
  			var scaleMargin = {
  				left: 0,
  				right: 0,
  				top: outerBoxSizes.top,
  				bottom: outerBoxSizes.bottom
  			};
  
  			if (minBoxSize) {
  				box.update(minBoxSize.width, maxChartAreaHeight, scaleMargin);
  			}
  		}
  
  		// Let the left layout know the final margin
  		helpers$1.each(verticalBoxes, finalFitVerticalBox);
  
  		// Recalculate because the size of each layout might have changed slightly due to the margins (label rotation for instance)
  		outerBoxSizes = {top: topPadding, left: leftPadding, bottom: bottomPadding, right: rightPadding};
  		addSizeByPosition(outerBoxes, outerBoxSizes);
  
  		// We may be adding some padding to account for rotated x axis labels
  		var leftPaddingAddition = Math.max(maxPadding.left - outerBoxSizes.left, 0);
  		outerBoxSizes.left += leftPaddingAddition;
  		outerBoxSizes.right += Math.max(maxPadding.right - outerBoxSizes.right, 0);
  
  		var topPaddingAddition = Math.max(maxPadding.top - outerBoxSizes.top, 0);
  		outerBoxSizes.top += topPaddingAddition;
  		outerBoxSizes.bottom += Math.max(maxPadding.bottom - outerBoxSizes.bottom, 0);
  
  		// Figure out if our chart area changed. This would occur if the dataset layout label rotation
  		// changed due to the application of the margins in step 6. Since we can only get bigger, this is safe to do
  		// without calling `fit` again
  		var newMaxChartAreaHeight = height - outerBoxSizes.top - outerBoxSizes.bottom;
  		var newMaxChartAreaWidth = width - outerBoxSizes.left - outerBoxSizes.right;
  
  		if (newMaxChartAreaWidth !== maxChartAreaWidth || newMaxChartAreaHeight !== maxChartAreaHeight) {
  			helpers$1.each(verticalBoxes, function(box) {
  				box.height = newMaxChartAreaHeight;
  			});
  
  			helpers$1.each(horizontalBoxes, function(box) {
  				if (!box.fullWidth) {
  					box.width = newMaxChartAreaWidth;
  				}
  			});
  
  			maxChartAreaHeight = newMaxChartAreaHeight;
  			maxChartAreaWidth = newMaxChartAreaWidth;
  		}
  
  		// Step 7 - Position the boxes
  		var left = leftPadding + leftPaddingAddition;
  		var top = topPadding + topPaddingAddition;
  
  		function placeBox(box) {
  			if (box.isHorizontal()) {
  				box.left = box.fullWidth ? leftPadding : outerBoxSizes.left;
  				box.right = box.fullWidth ? width - rightPadding : outerBoxSizes.left + maxChartAreaWidth;
  				box.top = top;
  				box.bottom = top + box.height;
  
  				// Move to next point
  				top = box.bottom;
  
  			} else {
  
  				box.left = left;
  				box.right = left + box.width;
  				box.top = outerBoxSizes.top;
  				box.bottom = outerBoxSizes.top + maxChartAreaHeight;
  
  				// Move to next point
  				left = box.right;
  			}
  		}
  
  		helpers$1.each(leftBoxes.concat(topBoxes), placeBox);
  
  		// Account for chart width and height
  		left += maxChartAreaWidth;
  		top += maxChartAreaHeight;
  
  		helpers$1.each(rightBoxes, placeBox);
  		helpers$1.each(bottomBoxes, placeBox);
  
  		// Step 8
  		chart.chartArea = {
  			left: outerBoxSizes.left,
  			top: outerBoxSizes.top,
  			right: outerBoxSizes.left + maxChartAreaWidth,
  			bottom: outerBoxSizes.top + maxChartAreaHeight
  		};
  
  		// Step 9
  		helpers$1.each(chartAreaBoxes, function(box) {
  			box.left = chart.chartArea.left;
  			box.top = chart.chartArea.top;
  			box.right = chart.chartArea.right;
  			box.bottom = chart.chartArea.bottom;
  
  			box.update(maxChartAreaWidth, maxChartAreaHeight);
  		});
  	}