scModel.getMin( ), scModel.getMax( ), scModel.isSetStep( ) ? new Double( scModel.getStep( ) ) : null,
scModel,
	private final void updateOverlayScales( AllAxes aax, double dAxisStart,			double dAxisEnd, double dBlockStart, double dBlockLength )			throws ChartException, IllegalArgumentException	{		final Axis[] axa = ( (ChartWithAxesImpl) cwa ).getPrimaryBaseAxes( );		final Axis axPrimaryBase = axa[0];		final Axis[] axaOrthogonal = ( (ChartWithAxesImpl) cwa ).getOrthogonalAxes( axPrimaryBase,				false );		IntersectionValue iv;		AutoScale sc = null;		OneAxis oaxOverlay = null;		int iTickStyle, iAxisType, j, iTitleLocation;		int iOverlayCount = aax.getOverlayCount( );		int iOrientation = aax.getOrientation( );		double dStart, dEnd, dAxisLabelsThickness;		Label laAxisTitle;		Scale scModel;		Series[] sea = cwa.getSeries( IConstants.ORTHOGONAL );		Map seriesRenderingHints = rtc.getSeriesRenderers( );		// ITERATE THROUGH EACH OVERLAY ORTHOGONAL AXIS		for ( int i = 0; i < iOverlayCount; i++ )		{			// GO BACKWARDS TO ENSURE CORRECT RENDERING ORDER			j = iOverlayCount - i - 1;			// UPDATE A PREVIOUSLY DEFINED OVERLAY AXIS AUTO COMPUTE SCALE			oaxOverlay = aax.getOverlay( j );			iTickStyle = oaxOverlay.getCombinedTickStyle( );			iTitleLocation = oaxOverlay.getTitlePosition( );			laAxisTitle = oaxOverlay.getTitle( );			iAxisType = getAxisType( axaOrthogonal[j] );			scModel = axaOrthogonal[j].getScale( );			sc = AutoScale.computeScale( ids,					oaxOverlay,					new DataSetIterator( getMinMax( axaOrthogonal[j], iAxisType ),							iAxisType ),					iAxisType,					dAxisStart,					dAxisEnd,					scModel.getMin( ),					scModel.getMax( ),					scModel.isSetStep( ) ? new Double( scModel.getStep( ) )							: null,					axaOrthogonal[j].getFormatSpecifier( ),					rtc,					AUTO );			oaxOverlay.set( sc );			iv = oaxOverlay.getIntersectionValue( );			// UPDATE AXIS ENDPOINTS DUE TO ITS AXIS LABEL SHIFTS			dStart = sc.getStart( );			dEnd = sc.getEnd( );			sc.computeTicks( ids,					oaxOverlay.getLabel( ),					oaxOverlay.getLabelPosition( ),					iOrientation,					dStart,					dEnd,					true,					null );			if ( !sc.isStepFixed( ) )			{				final Object[] oaMinMax = sc.getMinMax( );				while ( !sc.checkFit( ids,						oaxOverlay.getLabel( ),						oaxOverlay.getLabelPosition( ) ) )				{					if ( !sc.zoomOut( ) )					{						break;					}					sc.updateAxisMinMax( oaMinMax[0], oaMinMax[1] );					sc.computeTicks( ids,							oaxOverlay.getLabel( ),							oaxOverlay.getLabelPosition( ),							iOrientation,							dStart,							dEnd,							true,							null );				}			}			dAxisLabelsThickness = sc.computeAxisLabelThickness( ids,					oaxOverlay.getLabel( ),					iOrientation );			// Compute axes decoration thickness, the value sequence is either			// [left,right] or			// [top, bottom]			double[] dDecorationThickness = {					0, 0			};			for ( int t = 0; t < sea.length; t++ )			{				LegendItemRenderingHints lirh = (LegendItemRenderingHints) seriesRenderingHints.get( sea[t] );				if ( lirh != null						&& lirh.getRenderer( ) instanceof AxesRenderer )				{					IAxesDecorator iad = ( (AxesRenderer) lirh.getRenderer( ) ).getAxesDecorator( oaxOverlay );					if ( iad != null )					{						double[] thickness = iad.computeDecorationThickness( ids,								oaxOverlay );						if ( thickness[0] > dDecorationThickness[0] )						{							dDecorationThickness[0] = thickness[0];						}						if ( thickness[1] > dDecorationThickness[1] )						{							dDecorationThickness[1] = thickness[1];						}					}				}			}			double dAxisTitleThickness = 0;			sc.resetShifts( );			if ( iOrientation == VERTICAL )			{				// COMPUTE THE THICKNESS OF THE AXIS INCLUDING AXIS LABEL BOUNDS				// AND AXIS-PLOT SPACING				double dX = 0, dX1 = 0, dX2 = 0;				final boolean bTicksLeft = ( iTickStyle & TICK_LEFT ) == TICK_LEFT;				final boolean bTicksRight = ( iTickStyle & TICK_RIGHT ) == TICK_RIGHT;				final double dAppliedYAxisPlotSpacing = dYAxisPlotSpacing;				if ( laAxisTitle.isVisible( ) )				{					final String sPreviousValue = laAxisTitle.getCaption( )							.getValue( );					laAxisTitle.getCaption( )							.setValue( rtc.externalizedMessage( sPreviousValue ) );					dAxisTitleThickness = computeBox( ids,							iTitleLocation,							laAxisTitle,							0,							0 ).getWidth( );					laAxisTitle.getCaption( ).setValue( sPreviousValue );				}				// COMPUTE VALUES FOR x1, x, x2				// x = HORIZONTAL LOCATION OF Y-AXIS ALONG PLOT				// x1 = LEFT EDGE OF Y-AXIS BAND (DUE TO AXIS LABELS, TICKS,				// SPACING)				// x2 = RIGHT EDGE OF Y-AXIS BAND (DUE TO AXIS LABELS, TICKS,				// SPACING)				if ( iv.getType( ) == IntersectionValue.MIN )				{					// NOTE: ENSURE CODE SYMMETRY WITH 'iaLabelPositions[i] ==					// RIGHT'					dX = dBlockStart;					dX -= dAppliedYAxisPlotSpacing;					dX1 = dX;					dX2 = dX;					if ( bTicksLeft )					{						dX1 -= TICK_SIZE;					}					if ( oaxOverlay.getLabelPosition( ) == LEFT )					{						dX1 -= Math.max( dAxisLabelsThickness,								dDecorationThickness[0] );						dX2 += Math.max( bTicksRight ? TICK_SIZE : 0,								dAppliedYAxisPlotSpacing );					}					else if ( oaxOverlay.getLabelPosition( ) == RIGHT )					{						dX1 -= dDecorationThickness[0];						dX2 += Math.max( ( bTicksRight ? TICK_SIZE : 0 )								+ dAxisLabelsThickness,								dAppliedYAxisPlotSpacing );					}					if ( iTitleLocation == LEFT )					{						dX1 -= dAxisTitleThickness;					}					else if ( iTitleLocation == RIGHT )					{						dX2 += dAxisTitleThickness;					}					// ENSURE THAT WE DON'T GO BEHIND THE LEFT PLOT BLOCK EDGE					if ( dX1 < dBlockStart )					{						final double dDelta = ( dBlockStart - dX1 );						dX1 = dBlockStart;						dX += dDelta;						dX2 += dDelta;					}					dBlockStart += ( dX2 - dX1 ); // SHIFT LEFT EDGE >>				}				else if ( iv.getType( ) == IntersectionValue.MAX )				{					// NOTE: ENSURE CODE SYMMETRY WITH 'InsersectionValue.MIN'					dX = dBlockStart + dBlockLength;					dX += dAppliedYAxisPlotSpacing;					dX1 = dX;					dX2 = dX;					if ( bTicksRight )					{						dX2 += TICK_SIZE;					}					if ( oaxOverlay.getLabelPosition( ) == RIGHT )					{						dX2 += Math.max( dAxisLabelsThickness,								dDecorationThickness[1] );						dX1 -= Math.max( bTicksLeft ? TICK_SIZE : 0,								dAppliedYAxisPlotSpacing );					}					else if ( oaxOverlay.getLabelPosition( ) == LEFT )					{						dX1 -= Math.max( ( bTicksLeft ? TICK_SIZE : 0 )								+ dAxisLabelsThickness,								dAppliedYAxisPlotSpacing );						dX2 += dDecorationThickness[1];					}					if ( iTitleLocation == LEFT )					{						dX1 -= dAxisTitleThickness;					}					else if ( iTitleLocation == RIGHT )					{						dX2 += dAxisTitleThickness;					}					// ENSURE THAT WE DON'T GO AHEAD OF THE RIGHT PLOT BLOCK					// EDGE					if ( dX2 > dBlockStart + dBlockLength )					{						final double dDelta = dX2								- ( dBlockStart + dBlockLength );						dX2 = dBlockStart + dBlockLength;						dX -= dDelta;						dX1 -= dDelta;					}				}				dBlockLength -= dX2 - dX1; // SHIFT RIGHT EDGE <<				double dDelta = 0;				if ( iv.getType( ) == IntersectionValue.MIN )				{					dDelta = -insCA.getLeft( );				}				else if ( iv.getType( ) == IntersectionValue.MAX )				{					dDelta = insCA.getRight( );				}				oaxOverlay.setAxisCoordinate( dX + dDelta );				// dX1<=>dX<=>dX2 INCORPORATES TITLE				oaxOverlay.setTitleCoordinate( ( iTitleLocation == LEFT ) ? dX1						+ dDelta						- 1 : dX2 + 1 - dAxisTitleThickness + dDelta );			}			else if ( iOrientation == HORIZONTAL )			{				// COMPUTE THE THICKNESS OF THE AXIS INCLUDING AXIS LABEL BOUNDS				// AND AXIS-PLOT SPACING				double dY = 0, dY1 = dY, dY2 = dY;				final boolean bTicksAbove = ( iTickStyle & TICK_ABOVE ) == TICK_ABOVE;				final boolean bTicksBelow = ( iTickStyle & TICK_BELOW ) == TICK_BELOW;				final double dAppliedXAxisPlotSpacing = dXAxisPlotSpacing;				if ( laAxisTitle.isVisible( ) )				{					final String sPreviousValue = laAxisTitle.getCaption( )							.getValue( );					laAxisTitle.getCaption( )							.setValue( rtc.externalizedMessage( sPreviousValue ) );					dAxisTitleThickness = computeBox( ids,							iTitleLocation,							laAxisTitle,							0,							0 ).getHeight( );					laAxisTitle.getCaption( ).setValue( sPreviousValue );				}				// COMPUTE VALUES FOR y1, y, y2				// y = VERTICAL LOCATION OF X-AXIS ALONG PLOT				// y1 = UPPER EDGE OF X-AXIS (DUE TO AXIS LABELS, TICKS,				// SPACING)				// y2 = LOWER EDGE OF X-AXIS (DUE TO AXIS LABELS, TICKS,				// SPACING)				if ( ( isRightToLeft( ) && iv.getType( ) == IntersectionValue.MIN )						|| ( !isRightToLeft( ) && iv.getType( ) == IntersectionValue.MAX ) ) // ABOVE				// THE				// PLOT				{					dY = dBlockStart;					dY -= dAppliedXAxisPlotSpacing;					dY1 = dY;					dY2 = dY;					if ( bTicksAbove )					{						dY1 -= TICK_SIZE;					}					if ( oaxOverlay.getLabelPosition( ) == ABOVE )					{						dY1 -= Math.max( dAxisLabelsThickness,								dDecorationThickness[0] );						dY2 += Math.max( bTicksBelow ? TICK_SIZE : 0,								dAppliedXAxisPlotSpacing );					}					else if ( oaxOverlay.getLabelPosition( ) == BELOW )					{						dY1 -= dDecorationThickness[0];						dY2 += Math.max( ( bTicksBelow ? TICK_SIZE : 0 )								+ dAxisLabelsThickness,								dAppliedXAxisPlotSpacing );					}					if ( iTitleLocation == ABOVE )					{						dY1 -= dAxisTitleThickness;					}					else if ( iTitleLocation == BELOW )					{						dY2 += dAxisTitleThickness;					}					// ENSURE THAT WE DON'T GO BEHIND THE LEFT PLOT BLOCK EDGE					if ( dY1 < dBlockStart )					{						final double dDelta = ( dBlockStart - dY1 );						dY1 = dBlockStart;						dY += dDelta;						dY2 += dDelta;					}					dBlockStart += ( dY2 - dY1 ); // SHIFT TOP EDGE >>				}				else if ( ( isRightToLeft( ) && iv.getType( ) == IntersectionValue.MAX )						|| ( !isRightToLeft( ) && iv.getType( ) == IntersectionValue.MIN ) ) // BELOW				// THE				// PLOT				{					// NOTE: ENSURE CODE SYMMETRY WITH 'InsersectionValue.MIN'					dY = dBlockStart + dBlockLength;					dY += dAppliedXAxisPlotSpacing;					dY1 = dY;					dY2 = dY;					if ( bTicksBelow )					{						dY2 += TICK_SIZE;					}					if ( oaxOverlay.getLabelPosition( ) == BELOW )					{						dY2 += Math.max( dAxisLabelsThickness,								dDecorationThickness[1] );						dY1 -= Math.max( bTicksAbove ? TICK_SIZE : 0,								dAppliedXAxisPlotSpacing );					}					else if ( oaxOverlay.getLabelPosition( ) == ABOVE )					{						dY1 -= Math.max( ( bTicksAbove ? TICK_SIZE : 0 )								+ dAxisLabelsThickness,								dAppliedXAxisPlotSpacing );						dY2 += dDecorationThickness[1];					}					if ( iTitleLocation == ABOVE )					{						dY1 -= dAxisTitleThickness;					}					else if ( iTitleLocation == BELOW )					{						dY2 += dAxisTitleThickness;					}					// ENSURE THAT WE DON'T GO AHEAD OF THE RIGHT PLOT BLOCK					// EDGE					if ( dY2 > dBlockStart + dBlockLength )					{						final double dDelta = dY2								- ( dBlockStart + dBlockLength );						dY2 = dBlockStart + dBlockLength;						dY -= dDelta;						dY1 -= dDelta;					}				}				double dDelta = 0;				if ( ( isRightToLeft( ) && iv.getType( ) == IntersectionValue.MIN )						|| ( !isRightToLeft( ) && iv.getType( ) == IntersectionValue.MAX ) )				{					dDelta = -insCA.getTop( );				}				else if ( ( isRightToLeft( ) && iv.getType( ) == IntersectionValue.MAX )						|| ( !isRightToLeft( ) && iv.getType( ) == IntersectionValue.MIN ) )				{					dDelta = insCA.getBottom( );				}				oaxOverlay.setAxisCoordinate( dY + dDelta );				oaxOverlay.setTitleCoordinate( ( iTitleLocation == ABOVE ) ? dY1						+ dDelta						- 1						: dY2 + 1 - dAxisTitleThickness + dDelta // dY1<=>dX<=>dY2				// INCORPORATES				// TITLE				);				dBlockLength -= ( dY2 - dY1 ); // SHIFT BOTTOM EDGE <<			}		}		aax.setBlockCordinates( dBlockStart, dBlockLength );	}