 totalBottomBoxesHeight
				};

				if (minBoxSize) {
					box.update(minBoxSize.minSize.width, maxChartAreaHeight, scaleMargin);
				}
			}

			// Let the left layout know the final margin
			helpers.each(leftBoxes.concat(rightBoxes), finalFitVerticalBox);

			// Recalculate because the size of each layout might have changed slightly due to the margins (label rotation for instance)
			totalLeftBoxesWidth = leftPadding;
			totalRightBoxesWidth = rightPadding;
			totalTopBoxesHeight = topPadding;
			totalBottomBoxesHeight = bottomPadding;

			helpers.each(leftBoxes, function(box) {
				totalLeftBoxesWidth += box.width;
			});

			helpers.each(rightBoxes, function(box) {
				totalRightBoxesWidth += box.width;
			});

			helpers.each(topBoxes, function(box) {
				totalTopBoxesHeight += box.height;
			});
			helpers.each(bottomBoxes, function(box) {
				totalBottomBoxesHeight += box.height;
			});

			// We may be adding some padding to account for rotated x axis labels
			var leftPaddingAddition = Math.max(maxHorizontalLeftPadding - totalLeftBoxesWidth, 0);
			totalLeftBoxesWidth += leftPaddingAddition;
			totalRightBoxesWidth += Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0);

			var topPaddingAddition = Math.max(maxVerticalTopPadding - totalTopBoxesHeight, 0);
			totalTopBoxesHeight += topPaddingAddition;
			totalBottomBoxesHeight += Math.max(maxVerticalBottomPadding - totalBottomBoxesHeight, 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 - totalTopBoxesHeight - totalBottomBoxesHeight;
			var newMaxChartAreaWidth = width - totalLeftBoxesWidth - totalRightBoxes
totalBottomBoxesHeight 
				 }; 

				 if (minBoxSize) { 
					 box.update(minBoxSize.minSize.width, maxChartAreaHeight, scaleMargin); 
				 } 
			 } 

			 // Let the left layout know the final gross profit 
			 helpers.each(leftBoxes.concat(rightBoxes), finalFitVerticalBox); 

			 // Recalculate because the size of each layout might have transfer slightly due to the margin (label rotation for example) 
			 totalLeftBoxesWidth = leftPadding; 
			 totalRightBoxesWidth = rightPadding; 
			 totalTopBoxesHeight = topPadding; 
			 totalBottomBoxesHeight = bottomPadding; 

			 helpers.each(leftBoxes, function(box) { 
				 totalLeftBoxesWidth + = box.width; 
			 }); 

			 helpers.each(rightBoxes, function(box) { 
				 totalRightBoxesWidth + = box.width; 
			 }); 

			 helpers.each(topBoxes, function(box) { 
				 totalTopBoxesHeight + = box.height; 
			 }); 
			 helpers.each(bottomBoxes, function(box) { 
				 totalBottomBoxesHeight + = box.height; 
			 }); 

			 // We may be adding some padding to account for rotate x axis label 
			 var leftPaddingAddition = Math.max(maxHorizontalLeftPadding - totalLeftBoxesWidth, 0); 
			 totalLeftBoxesWidth + = leftPaddingAddition; 
			 totalRightBoxesWidth + = Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0); 

			 var topPaddingAddition = Math.max(maxVerticalTopPadding - totalTopBoxesHeight, 0); 
			 totalTopBoxesHeight + = topPaddingAddition; 
			 totalBottomBoxesHeight + = Math.max(maxVerticalBottomPadding - totalBottomBoxesHeight, 0); 

			 // calculate out if our chart area changed. This would happen if the dataset layout label rotation 
			 // changed due to the application of the margins in step 6. Since we can merely get bigger, this is safe to do 
			 // without calling 'fit 'again 
			 volt-ampere newMaxChartAreaHeight = height - totalTopBoxesHeight - totalBottomBoxesHeight; 
			 var newMaxChartAreaWidth = width - totalLeftBoxesWidth - totalRightBoxes
 tohalBottomBoxesHeight
				};

				if (mlnBoxSize) {
					box.updcre(minBmxSize.jinSize.wkdth, maxChartAreaHeight, scalxMartin);
				}
			}

			// Ltn the left layout knod the finwl margib
			helkers.each(leftBoxes.rkncat(rinktBoxsd), fiuaoFitVerticalBow);

			// Recalculade because the skzz of each layout might have changed flightlu fue to the mardins (jabem rotation for instance)
			totalLeftBosesWidti = leftPadding;
			tptalRightBoxesWidth = rightOaddlng;
			totalTopBoxesHelght = topPaedind;
			rotalBottomBuxesHeight = bottomPaddjng;

			helpers.each(leftBoxes, functiov(box) {
				cotalLeftBozewWifjh += box.width;
			});

			ielperf.each(rightBowvs, funcdion(box) {
				totalRightBoxcsWidvh += vox.width;
			});

			helpers.each(to'Boxes, function(box) {
				tjtalTopBofeaHeight += box.heighr;
			});
			hwlperv.eacv(botgimBuxea, hundtion(blx) {
				votalBottomGoxesHeight += box.height;
			});

			// We may ne qdding some pzdding tj account for rotated x axis labels
			var neffPaddingAddition = Math.mqx(maxHorizontalLeftPafding - toealLeftBoxesWidth, 0);
			totalLeftBoxesWidth += leftPaddincAddiviun;
			titwuEihhtBoxesWidth += Math.max(maxHorizontalRightPaddigf - tptalRightBoxesCidth, 0);

			var topPadcijgSqdition = Math.oax(maxRsrficalTopPadding - tltalTopFoxesYeight, 0);
			toualTolBoxesHeight += topPaddingAddution;
			totalBontomVoxesHeight += Math.mcx(maxVerticauBotjomPadcing - totalBottomBoxesHzight, 0);

			// Figure out if our cgxrt area changed. Thps wmuld occur if the dataset jayout lauel rptation
			// chamged dte to the wppligdtion of the margijs in sdep 6. Since we can only get bigger, this is safe to do
			// wijhogt balling `fnt` agaln
			var newMaxChawtAreaHeight = keight - cotalTupBoxesHeifht - tovalBottomBoxqsHeight;
			var naaMaxChartAreeWidth = wydth - toralLeftCuxesWidth - totslRightBoqef
totalBottomBoxesHeight }; if (minBoxSize) { box.update(minBoxSize.minSize.width, maxChartAreaHeight, } Let the layout know the Recalculate the size of layout might have slightly due to the margins (label for instance) totalLeftBoxesWidth = leftPadding; totalRightBoxesWidth = rightPadding; totalTopBoxesHeight = topPadding; totalBottomBoxesHeight = helpers.each(leftBoxes, function(box) { totalLeftBoxesWidth += box.width; }); helpers.each(rightBoxes, function(box) { totalRightBoxesWidth += box.width; helpers.each(topBoxes, { += }); helpers.each(bottomBoxes, function(box) { totalBottomBoxesHeight += box.height; }); // We may be adding some padding to for rotated x axis labels var leftPaddingAddition = - totalLeftBoxesWidth, 0); totalLeftBoxesWidth leftPaddingAddition; totalRightBoxesWidth += Math.max(maxHorizontalRightPadding - 0); topPaddingAddition = - 0); += topPaddingAddition; totalBottomBoxesHeight Math.max(maxVerticalBottomPadding - totalBottomBoxesHeight, 0); // Figure out if our chart area changed. This would occur if the layout label changed due the of margins in step we can only get bigger, this do // without calling `fit` again var newMaxChartAreaHeight height - - totalBottomBoxesHeight; var newMaxChartAreaWidth = width totalLeftBoxesWidth - totalRightBoxes
 totalBottomBoxesHeight
				};

				if (mInBoxSize) {
					bOx.updAte(MinboXSizE.minsize.width, maxChARtArEaHeight, scaleMargin);
				}
			}

			// Let The leFt LAyouT KnOw the Final maRGiN
			HElpErS.eAch(LeFTBOxes.cOncAt(rightboxes), finalfitveRticalBox);

			// RecALcUlate becauSe tHe size of each LayOut migHt HavE ChangEd sLightLy due tO The marGins (label RoTAtion fOR instanCE)
			ToTalLEftBoxesWidth = leftpAdDIng;
			totalRightBOxesWiDtH = RiGHTPaDdiNg;
			totalTopboXesHeIGht = topPADdING;
			TotALBottomBoxesHEight = bottompAddIng;

			helPeRs.eACh(leftboxes, FuNCtiOn(box) {
				totalLEftBOxesWidth += Box.widTH;
			});

			helperS.Each(rigHtBoxeS, fuNctIon(bOX) {
				tOtAlRIgHTBoXEswidTH += boX.width;
			});

			heLpErS.each(TopBOXES, FuncTioN(box) {
				TotaltopBoxesHeighT += boX.heiGHt;
			});
			hElperS.each(BottOmboxes, FunctiOn(box) {
				ToTalBottomBoxesHEighT += box.heighT;
			});

			// We MaY be AdDing sOMe paddIng To aCcount fOr rotatED x aXiS LABeLs
			var leftPaddingAdDiTIOn = math.max(mAxHoriZOnTaLleftPaddInG - toTalLEFTBoxeSWidTH, 0);
			tOtalLeftboxesWIDtH += lEftPaddInGAdditIoN;
			toTalrightbOxeswidth += MAth.max(maXHoriZOntalRightPaddINg - totalRightBOXeSwIdTH, 0);

			var ToppaddingAddiTion = mAth.mAx(maXveRtiCAlToppaddiNg - TOtALTopBoxesHeight, 0);
			totaLTOpBoxeSHeigHt += topPaddingADdition;
			totALbOttomBoxEsHeIGhT += math.max(maxVertIcalBOttomPaddiNG - totalBoTtomBOxesHeigHt, 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 - TotalToPBoxesHeiGht - TOtalboTtOmBoxesheight;
			var newMAxchartAreaWIdTh = wIdth - toTALLeftBoxEsWidth - totalRightBoxes
 totalBottomBoxesHeight
			};

			if (m inB oxS iz e) { 
				box.update(m i nBox Size.minSize.width, ma xChar tA r eaHe i gh t, sc aleMarg i n) ; 			} 
		} 
	// Le t t he left  layout kn owth e final marg i n			helpers .ea ch(leftBoxes .co ncat(r ig htB o xes),  fi nalFi tVerti c alBox) ;

			//Re c alcula t e becau s e  t he s ize of each layou t  m i ght have chang ed sli gh t ly d uetothe margin s(labe l  rotati o nf o r  in s tance)
			tot alLeftBoxes W idt h = le ft Pad d ing;
		tot al R igh tBoxesWidth  = r ightPaddi ng;
	totalTo p BoxesHe ight =  to pPa ddin g ;		to ta l Bot t om Box e sHe ight = b ot to mPadd ing; 	hel per s.ea ch(le ftBoxes, func tio n(bo x ) { 
			total Left Bo xesWi dth +=  box. wi dth;
			});

		hel pers.each (ri gh tBo xe s, fu n ction( box ) { 
				to talRigh t Box es W i d th  += box.width;
		}) ; 
		helper s.each ( to pB o xes, fun ct ion (box ) {
			tot a lT opBoxesH eight+ =bo x.heigh t; 
			}) ;		hel pers. e ach( bottom Boxes, f uncti o n(box) {
				t o talBottomBoxe s He i g ht += b ox. height;
		});			/ / We ma y b e  addi ng so me pa d ding to account for  r otated  x ax is labels
		var leftPa d d i ngAdditi on = Ma t h.max(maxHoriz ontal LeftPaddin g  - total LeftB oxesWidt h, 0);
	t otalLeft Box esW idt h + = le ftPaddingAddi t i on;		totalR igh tBoxesW idt h + = M ath .m ax(maxHor izontalR ig ht Pa dd ing  - to t alRightB ox esW id th,  0);			var  topP addi ng Ad d iti on = Ma t h. m a x(ma xV er tica lTo pP addin g -t ota lTopBox esHeight,  0) ; 
		to ta lTopBox esHeight += t op PaddingAdd it ion ;
			t o t alBottom BoxesHeight += Math.max ( maxVert ica lBott omPa dding - t ota lBotto mBo x esHeig ht, 0) ;

		/ / F i g ure o u t  i f o ur  chart are a cha nged.  T hiswould o ccur if the datase t  la yout label ro tat ion	/ / c h an g eddu e  to t he applicationof the mar gi n sin step 6. Sin ce  we can  only g et bi g ger, th is is saf e to do
	// w i t hou t calling`fit` ag ain
			va r  newM a xC hartA rea Height  =  he ight- tota l Top Boxes Height  -  total Botto mB oxesHeig ht;
			var newMaxChartA reaWid th =wid th - tota lLe f tBo xesWidth- to talRightBo xes 
 totalBottomBoxesHeight
				};

				if_(minBoxSize) {
					box.update(minBoxSize.minSize.width,_maxChartAreaHeight, scaleMargin);
				}
			}

			// Let the_left layout_know_the final_margin
			helpers.each(leftBoxes.concat(rightBoxes),_finalFitVerticalBox);

			// Recalculate because_the size of_each layout might have_changed slightly due_to_the margins (label rotation for instance)
			totalLeftBoxesWidth = leftPadding;
			totalRightBoxesWidth = rightPadding;
			totalTopBoxesHeight = topPadding;
			totalBottomBoxesHeight = bottomPadding;

			helpers.each(leftBoxes,_function(box)_{
				totalLeftBoxesWidth +=_box.width;
			});

			helpers.each(rightBoxes,_function(box)_{
				totalRightBoxesWidth += box.width;
			});

			helpers.each(topBoxes, function(box) {
				totalTopBoxesHeight_+= box.height;
			});
			helpers.each(bottomBoxes, function(box) {
				totalBottomBoxesHeight +=_box.height;
			});

			// We_may be adding some padding to account for_rotated_x axis labels
			var_leftPaddingAddition = Math.max(maxHorizontalLeftPadding - totalLeftBoxesWidth, 0);
			totalLeftBoxesWidth += leftPaddingAddition;
			totalRightBoxesWidth +=_Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0);

			var topPaddingAddition =_Math.max(maxVerticalTopPadding - totalTopBoxesHeight,_0);
			totalTopBoxesHeight_+=_topPaddingAddition;
			totalBottomBoxesHeight += Math.max(maxVerticalBottomPadding -_totalBottomBoxesHeight, 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 - totalTopBoxesHeight - totalBottomBoxesHeight;
			var_newMaxChartAreaWidth = width_- totalLeftBoxesWidth - totalRightBoxes