example/public/ueditor/third-party/highcharts/highcharts.src.js
function () {
		var chart = this,
			spacing = chart.spacing,
			axisOffset,
			legend = chart.legend,
			margin = chart.margin,
			legendOptions = chart.options.legend,
			legendMargin = pick(legendOptions.margin, 10),
			legendX = legendOptions.x,
			legendY = legendOptions.y,
			align = legendOptions.align,
			verticalAlign = legendOptions.verticalAlign,
			titleOffset = chart.titleOffset;

		chart.resetMargins();
		axisOffset = chart.axisOffset;

		// Adjust for title and subtitle
		if (titleOffset && !defined(margin[0])) {
			chart.plotTop = mathMax(chart.plotTop, titleOffset + chart.options.title.margin + spacing[0]);
		}
		
		// Adjust for legend
		if (legend.display && !legendOptions.floating) {
			if (align === 'right') { // horizontal alignment handled first
				if (!defined(margin[1])) {
					chart.marginRight = mathMax(
						chart.marginRight,
						legend.legendWidth - legendX + legendMargin + spacing[1]
					);
				}
			} else if (align === 'left') {
				if (!defined(margin[3])) {
					chart.plotLeft = mathMax(
						chart.plotLeft,
						legend.legendWidth + legendX + legendMargin + spacing[3]
					);
				}

			} else if (verticalAlign === 'top') {
				if (!defined(margin[0])) {
					chart.plotTop = mathMax(
						chart.plotTop,
						legend.legendHeight + legendY + legendMargin + spacing[0]
					);
				}

			} else if (verticalAlign === 'bottom') {
				if (!defined(margin[2])) {
					chart.marginBottom = mathMax(
						chart.marginBottom,
						legend.legendHeight - legendY + legendMargin + spacing[2]
					);
				}
			}
		}

		// adjust for scroller
		if (chart.extraBottomMargin) {
			chart.marginBottom += chart.extraBottomMargin;
		}
		if (chart.extraTopMargin) {
			chart.plotTop += chart.extraTopMargin;
		}

		// pre-render axes to get labels offset width
		if (chart.hasCartesianSeries) {
			each(chart.axes, function (axis) {
				axis.getOffset();
			});
		}
		
		if (!defined(margin[3])) {
			chart.plotLeft += axisOffset[3];
		}
		if (!defined(margin[0])) {
			chart.plotTop += axisOffset[0];
		}
		if (!defined(margin[2])) {
			chart.marginBottom += axisOffset[2];
		}
		if (!defined(margin[1])) {
			chart.marginRight += axisOffset[1];
		}

		chart.setChartSize();

	}
function () {
		var chart = this,
			spacing = chart.spacing,
			axisOffset,
			legend = chart.legend,
			margin = chart.margin,
			legendOptions = chart.options.legend,
			legendMargin = pick(legendOptions.margin, 10),
			legendX = legendOptions.x,
			legendY = legendOptions.y,
			align = legendOptions.align,
			verticalAlign = legendOptions.verticalAlign,
			titleOffset = chart.titleOffset;

		chart.resetMargins();
		axisOffset = chart.axisOffset;

		// Adjust for title and subtitle
		if (titleOffset && !defined(margin[0])) {
			chart.plotTop = mathMax(chart.plotTop, titleOffset + chart.options.title.margin + spacing[0]);
		}
		
		// Adjust for legend
		if (legend.display && !legendOptions.floating) {
			if (align === 'right') { // horizontal alignment handled first
				if (!defined(margin[1])) {
					chart.marginRight = mathMax(
						chart.marginRight,
						legend.legendWidth - legendX + legendMargin + spacing[1]
					);
				}
			} else if (align === 'left') {
				if (!defined(margin[3])) {
					chart.plotLeft = mathMax(
						chart.plotLeft,
						legend.legendWidth + legendX + legendMargin + spacing[3]
					);
				}

			} else if (verticalAlign === 'top') {
				if (!defined(margin[0])) {
					chart.plotTop = mathMax(
						chart.plotTop,
						legend.legendHeight + legendY + legendMargin + spacing[0]
					);
				}

			} else if (verticalAlign === 'bottom') {
				if (!defined(margin[2])) {
					chart.marginBottom = mathMax(
						chart.marginBottom,
						legend.legendHeight - legendY + legendMargin + spacing[2]
					);
				}
			}
		}

		// adjust for scroller
		if (chart.extraBottomMargin) {
			chart.marginBottom += chart.extraBottomMargin;
		}
		if (chart.extraTopMargin) {
			chart.plotTop += chart.extraTopMargin;
		}

		// pre-render axes to get labels offset width
		if (chart.hasCartesianSeries) {
			each(chart.axes, function (axis) {
				axis.getOffset();
			});
		}
		
		if (!defined(margin[3])) {
			chart.plotLeft += axisOffset[3];
		}
		if (!defined(margin[0])) {
			chart.plotTop += axisOffset[0];
		}
		if (!defined(margin[2])) {
			chart.marginBottom += axisOffset[2];
		}
		if (!defined(margin[1])) {
			chart.marginRight += axisOffset[1];
		}

		chart.setChartSize();

	}
function ( ) { var chart = this , spacing = chart . spacing , axisOffset , legend = chart . legend , margin = chart . margin , legendOptions = chart . options . legend , legendMargin = pick ( legendOptions . margin , 10 ) , legendX = legendOptions . x , legendY = legendOptions . y , align = legendOptions . align , verticalAlign = legendOptions . verticalAlign , titleOffset = chart . titleOffset ; chart . resetMargins ( ) ; axisOffset = chart . axisOffset ; // Adjust for title and subtitle if ( titleOffset && ! defined ( margin [ 0 ] ) ) { chart . plotTop = mathMax ( chart . plotTop , titleOffset + chart . options . title . margin + spacing [ 0 ] ) ; } // Adjust for legend if ( legend . display && ! legendOptions . floating ) { if ( align === 'right' ) { // horizontal alignment handled first if ( ! defined ( margin [ 1 ] ) ) { chart . marginRight = mathMax ( chart . marginRight , legend . legendWidth - legendX + legendMargin + spacing [ 1 ] ) ; } } else if ( align === 'left' ) { if ( ! defined ( margin [ 3 ] ) ) { chart . plotLeft = mathMax ( chart . plotLeft , legend . legendWidth + legendX + legendMargin + spacing [ 3 ] ) ; } } else if ( verticalAlign === 'top' ) { if ( ! defined ( margin [ 0 ] ) ) { chart . plotTop = mathMax ( chart . plotTop , legend . legendHeight + legendY + legendMargin + spacing [ 0 ] ) ; } } else if ( verticalAlign === 'bottom' ) { if ( ! defined ( margin [ 2 ] ) ) { chart . marginBottom = mathMax ( chart . marginBottom , legend . legendHeight - legendY + legendMargin + spacing [ 2 ] ) ; } } } // adjust for scroller if ( chart . extraBottomMargin ) { chart . marginBottom += chart . extraBottomMargin ; } if ( chart . extraTopMargin ) { chart . plotTop += chart . extraTopMargin ; } // pre-render axes to get labels offset width if ( chart . hasCartesianSeries ) { each ( chart . axes , function ( axis ) { axis . getOffset ( ) ; } ) ; } if ( ! defined ( margin [ 3 ] ) ) { chart . plotLeft += axisOffset [ 3 ] ; } if ( ! defined ( margin [ 0 ] ) ) { chart . plotTop += axisOffset [ 0 ] ; } if ( ! defined ( margin [ 2 ] ) ) { chart . marginBottom += axisOffset [ 2 ] ; } if ( ! defined ( margin [ 1 ] ) ) { chart . marginRight += axisOffset [ 1 ] ; } chart . setChartSize ( ) ; }
Calculate margins by rendering axis labels in a preliminary position. Title,
subtitle and legend have already been rendered at this stage, but will be
moved into their final positions
Calculate margins by rendering axis labels in a preliminary position . Title subtitle and legend have already been rendered at this stage but will be moved into their final positions