if ( bLabelShadowEnabled ) {   if ( bRenderAxisLabels )   { double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1 : dYTick2 + 1; for ( int i = 0; i < da.length; i++ ) { try { sText = ValueFormatter.format( cdt, ax.getFormatSpecifier( ), ax.getRunTimeContext( ).getLocale( ), sdf ); } catch ( ChartException dfex ) { DefaultLoggerImpl.instance( ).log( dfex ); sText = IConstants.NULL_STRING; } x = (int) da[i]; lo.set( x, y ); la.getCaption( ).setValue( sText ); tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION ); ipr.drawText( tre ); cdt = cdtAxisValue.forward( iUnit, iStep * ( i + 1 ) );    } } }
	public final void renderEachAxis( IPrimitiveRenderer ipr, Plot pl,			OneAxis ax, int iWhatToDraw ) throws ChartException	{		final RunTimeContext rtc = getRunTimeContext( );		final Axis axModel = ax.getModelAxis( );		final PlotWith2DAxes pwa = (PlotWith2DAxes) getComputations( );		final Insets insCA = pwa.getAxes( ).getInsets( );		final ScriptHandler sh = getRunTimeContext( ).getScriptHandler( );		double dLocation = ax.getAxisCoordinate( );		double dAngleInDegrees = ax.getLabel( )				.getCaption( )				.getFont( )				.getRotation( );		AutoScale sc = ax.getScale( );		IntersectionValue iv = ax.getIntersectionValue( );		int iMajorTickStyle = ax.getGrid( ).getTickStyle( IConstants.MAJOR );		int iMinorTickStyle = ax.getGrid( ).getTickStyle( IConstants.MINOR );		int iLabelLocation = ax.getLabelPosition( );		int iOrientation = ax.getOrientation( );		IDisplayServer xs = this.getDevice( ).getDisplayServer( );		double[] daEndPoints = sc.getEndPoints( );		double[] da = sc.getTickCordinates( );		double[] daMinor = sc.getMinorCoordinates( ax.getGrid( )				.getMinorCountPerMajor( ) );		String sText = null;		boolean bLabelShadowEnabled = ( ax.getLabel( ).getShadowColor( ) != null );		int iDimension = pwa.getDimension( );		double dSeriesThickness = pwa.getSeriesThickness( );		final NumberDataElement nde = NumberDataElementImpl.create( 0 );		final FormatSpecifier fs = ax.getModelAxis( ).getFormatSpecifier( );		DecimalFormat df = null;		LineAttributes lia = ax.getLineAttributes( );		LineAttributes liaMajorTick = ax.getGrid( )				.getTickAttributes( IConstants.MAJOR );		LineAttributes liaMinorTick = ax.getGrid( )				.getTickAttributes( IConstants.MINOR );		if ( !lia.isSetVisible( ) )		{			throw new ChartException( ChartException.RENDERING,					"exception.unset.axis.visibility", //$NON-NLS-1$					ResourceBundle.getBundle( Messages.ENGINE,							getRunTimeContext( ).getLocale( ) ) );		}		Label la = ax.getLabel( );		final boolean bRenderAxisLabels = ( ( iWhatToDraw & IConstants.LABELS ) == IConstants.LABELS && la.isVisible( ) );		Location lo = LocationImpl.create( 0, 0 );		final TransformationEvent trae = (TransformationEvent) ( (EventObjectCache) ipr ).getEventObject( pl,				TransformationEvent.class );		final TextRenderEvent tre = (TextRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,				TextRenderEvent.class );		tre.setLabel( la );		tre.setTextPosition( iLabelLocation );		tre.setLocation( lo );		final LineRenderEvent lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,				LineRenderEvent.class );		lre.setLineAttributes( lia );		lre.setStart( LocationImpl.create( 0, 0 ) );		lre.setEnd( LocationImpl.create( 0, 0 ) );		if ( iOrientation == IConstants.VERTICAL )		{			int y;			double dX = dLocation;			if ( iv != null					&& iv.getType( ) == IntersectionValue.MAX					&& iDimension == IConstants.TWO_5_D )			{				trae.setTransform( TransformationEvent.TRANSLATE );				trae.setTranslation( dSeriesThickness, -dSeriesThickness );				ipr.applyTransformation( trae );			}			double dXTick1 = ( ( iMajorTickStyle & IConstants.TICK_LEFT ) == IConstants.TICK_LEFT ) ? ( dX - IConstants.TICK_SIZE )					: dX, dXTick2 = ( ( iMajorTickStyle & IConstants.TICK_RIGHT ) == IConstants.TICK_RIGHT ) ? dX					+ IConstants.TICK_SIZE					: dX;			if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS					&& lia.isVisible( ) )			{				final double dStart = daEndPoints[0] + insCA.getBottom( ), dEnd = daEndPoints[1]						- insCA.getTop( );				if ( iv != null						&& iv.getType( ) == IntersectionValue.VALUE						&& iDimension == IConstants.TWO_5_D )				{					final Location[] loa = new Location[4];					loa[0] = LocationImpl.create( dX, dStart );					loa[1] = LocationImpl.create( dX + dSeriesThickness, dStart							- dSeriesThickness );					loa[2] = LocationImpl.create( dX + dSeriesThickness, dEnd							- dSeriesThickness );					loa[3] = LocationImpl.create( dX, dEnd );					final PolygonRenderEvent pre = (PolygonRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,							PolygonRenderEvent.class );					pre.setPoints( loa );					pre.setBackground( ColorDefinitionImpl.create( 255,							255,							255,							127 ) );					pre.setOutline( lia );					ipr.fillPolygon( pre );				}				lre.setLineAttributes( lia );				lre.getStart( ).set( dX, dStart );				lre.getEnd( ).set( dX, dEnd );				ipr.drawLine( lre );			}			if ( ( sc.getType( ) & IConstants.TEXT ) == IConstants.TEXT					|| sc.isCategoryScale( ) )			{				double dAngleInRadians = ( -dAngleInDegrees * Math.PI ) / 180;				double dSineTheta = Math.abs( Math.sin( dAngleInRadians ) );				double dCosTheta = Math.abs( Math.cos( dAngleInRadians ) );				double dOffset = 0, dW, dH, dHCosTheta;				double dUnitSize = sc.getUnitSize( );				DataSetIterator dsi = sc.getData( );				final int iDateTimeUnit = ( sc.getType( ) == IConstants.DATE_TIME ) ? CDateTime.computeUnit( dsi )						: IConstants.UNDEFINED;				final ITextMetrics itmText = xs.getTextMetrics( la );				if ( dAngleInDegrees == 90 || dAngleInDegrees == 0 )				{					dOffset = -dUnitSize / 2;				}				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1							: dXTick2 + 1;					dsi.reset( );					for ( int i = 0; i < da.length - 1; i++ )					{						la.getCaption( )								.setValue( sc.formatCategoryValue( sc.getType( ),										dsi.next( ),										iDateTimeUnit ) );						itmText.reuse( la ); // RECYCLED						dH = itmText.getFullHeight( );						dW = itmText.getFullWidth( );						dHCosTheta = dH * dCosTheta;						if ( dAngleInDegrees > 0 && dAngleInDegrees < 90 )						{							if ( iLabelLocation == IConstants.LEFT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dW										* dSineTheta;							}							else if ( iLabelLocation == IConstants.RIGHT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dHCosTheta;							}						}						else if ( dAngleInDegrees < 0 && dAngleInDegrees > -90 )						{							if ( iLabelLocation == IConstants.LEFT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dHCosTheta;							}							else if ( iLabelLocation == IConstants.RIGHT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dW										* dSineTheta;							}						}						else if ( dAngleInDegrees == 0								|| dAngleInDegrees == 90								|| dAngleInDegrees == -90 )						{							dOffset = -dUnitSize / 2;						}						y = (int) da[i];						if ( ( iWhatToDraw & IConstants.LABELS ) == IConstants.LABELS								&& la.isVisible( ) )						{							lo.set( x, y + dOffset );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );						}					}				}				double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1						: dXTick2 + 1;				dsi.reset( );				for ( int i = 0; i < da.length - 1; i++ )				{					if ( bRenderAxisLabels ) // PERFORM COMPUTATIONS ONLY IF											 // AXIS LABEL IS VISIBLE					{						la.getCaption( )								.setValue( sc.formatCategoryValue( sc.getType( ),										dsi.next( ),										iDateTimeUnit ) );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						itmText.reuse( la ); // RECYCLED						dH = itmText.getFullHeight( );						dW = itmText.getFullWidth( );						dHCosTheta = dH * dCosTheta;						if ( dAngleInDegrees > 0 && dAngleInDegrees < 90 )						{							if ( iLabelLocation == IConstants.LEFT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dW										* dSineTheta;							}							else if ( iLabelLocation == IConstants.RIGHT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dHCosTheta;							}						}						else if ( dAngleInDegrees < 0 && dAngleInDegrees > -90 )						{							if ( iLabelLocation == IConstants.LEFT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dHCosTheta;							}							else if ( iLabelLocation == IConstants.RIGHT )							{								dOffset = ( dHCosTheta + dW * dSineTheta - dUnitSize )										/ 2										- dW										* dSineTheta;							}						}						else if ( dAngleInDegrees == 0								|| dAngleInDegrees == 90								|| dAngleInDegrees == -90 )						{							dOffset = -dUnitSize / 2;						}					}					y = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dXMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_LEFT ) == IConstants.TICK_LEFT ) ? ( dX - IConstants.TICK_SIZE )								: dX, dXMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_RIGHT ) == IConstants.TICK_RIGHT ) ? dX								+ IConstants.TICK_SIZE								: dX;						if ( dXMinorTick1 != dXMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( dXMinorTick1,											y - daMinor[k] ) );									lreMinor.setEnd( LocationImpl.create( dXMinorTick2,											y - daMinor[k] ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dXTick1 != dXTick2 )						{							lre.setLineAttributes( liaMajorTick );							lre.getStart( ).set( dXTick1, y );							lre.getEnd( ).set( dXTick2, y );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.setStart( LocationImpl.create( dX, y ) );								lre.setEnd( LocationImpl.create( dX										+ dSeriesThickness, y										- dSeriesThickness ) );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels ) // RENDER AXIS LABELS ONLY IF											 // REQUESTED					{						lo.set( x, y + dOffset );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}				}				y = (int) da[da.length - 1];				if ( dXTick1 != dXTick2 )				{					lre.setLineAttributes( liaMajorTick );					lre.getStart( ).set( dXTick1, y );					lre.getEnd( ).set( dXTick2, y );					ipr.drawLine( lre );					if ( iv != null							&& iDimension == IConstants.TWO_5_D							&& iv.getType( ) == IntersectionValue.VALUE )					{						lre.setStart( LocationImpl.create( dX, y ) );						lre.setEnd( LocationImpl.create( dX + dSeriesThickness,								y - dSeriesThickness ) );						ipr.drawLine( lre );					}				}				itmText.dispose( );// DISPOSED			}			else if ( ( sc.getType( ) & IConstants.LOGARITHMIC ) == IConstants.LOGARITHMIC )			{				double dAxisValue = Methods.asDouble( sc.getMinimum( ) )						.doubleValue( );				final double dAxisStep = Methods.asDouble( sc.getStep( ) )						.doubleValue( );				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					if ( ( iWhatToDraw & IConstants.LABELS ) == IConstants.LABELS							&& la.isVisible( ) )					{						double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1								: dXTick2 + 1;						for ( int i = 0; i < da.length; i++ )						{							if ( fs == null )							{								df = new DecimalFormat( sc.getNumericPattern( dAxisValue ) );							}							nde.setValue( dAxisValue );							try							{								sText = ValueFormatter.format( nde,										ax.getFormatSpecifier( ),										ax.getRunTimeContext( ).getLocale( ),										df );							}							catch ( ChartException dfex )							{								DefaultLoggerImpl.instance( ).log( dfex );								sText = IConstants.NULL_STRING;							}							y = (int) da[i];							lo.set( x, y );							la.getCaption( ).setValue( sText );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );							dAxisValue *= dAxisStep;						}					}				}				dAxisValue = Methods.asDouble( sc.getMinimum( ) ).doubleValue( ); // RESET				double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1						: dXTick2 + 1;				for ( int i = 0; i < da.length; i++ )				{					if ( bRenderAxisLabels ) // PERFORM COMPUTATIONS ONLY IF											 // AXIS LABEL IS VISIBLE					{						if ( fs == null )						{							df = new DecimalFormat( sc.getNumericPattern( dAxisValue ) );						}						nde.setValue( dAxisValue );						try						{							sText = ValueFormatter.format( nde,									fs,									ax.getRunTimeContext( ).getLocale( ),									df );						}						catch ( ChartException dfex )						{							DefaultLoggerImpl.instance( ).log( dfex );							sText = IConstants.NULL_STRING;						}					}					y = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dXMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_LEFT ) == IConstants.TICK_LEFT ) ? ( dX - IConstants.TICK_SIZE )								: dX, dXMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_RIGHT ) == IConstants.TICK_RIGHT ) ? dX								+ IConstants.TICK_SIZE								: dX;						if ( dXMinorTick1 != dXMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( dXMinorTick1,											y - daMinor[k] ) );									lreMinor.setEnd( LocationImpl.create( dXMinorTick2,											y - daMinor[k] ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dXTick1 != dXTick2 )						{							lre.setLineAttributes( liaMajorTick );							lre.getStart( ).set( dXTick1, y );							lre.getEnd( ).set( dXTick2, y );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.setLineAttributes( lia );								lre.setStart( LocationImpl.create( dX, y ) );								lre.setEnd( LocationImpl.create( dX										+ dSeriesThickness, y										- dSeriesThickness ) );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels ) // RENDER LABELS ONLY IF REQUESTED					{						lo.set( x, y );						la.getCaption( ).setValue( sText );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}					dAxisValue *= dAxisStep;				}			}			else if ( ( sc.getType( ) & IConstants.LINEAR ) == IConstants.LINEAR )			{				double dAxisValue = Methods.asDouble( sc.getMinimum( ) )						.doubleValue( );				final double dAxisStep = Methods.asDouble( sc.getStep( ) )						.doubleValue( );				if ( fs == null )				{					df = new DecimalFormat( sc.getNumericPattern( ) );				}				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					if ( bRenderAxisLabels )					{						double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1								: dXTick2 + 1;						for ( int i = 0; i < da.length; i++ )						{							nde.setValue( dAxisValue );							try							{								sText = ValueFormatter.format( nde,										fs,										null,										df ); // TBD: SET LOCALE CORRECTLY							}							catch ( ChartException dfex )							{								DefaultLoggerImpl.instance( ).log( dfex );								sText = IConstants.NULL_STRING;							}							y = (int) da[i];							lo.set( x, y );							la.getCaption( ).setValue( sText );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );							dAxisValue += dAxisStep;						}					}				}				dAxisValue = Methods.asDouble( sc.getMinimum( ) ).doubleValue( ); // RESET				double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1						: dXTick2 + 1;				for ( int i = 0; i < da.length; i++ )				{					nde.setValue( dAxisValue );					try					{						sText = ValueFormatter.format( nde,								fs,								ax.getRunTimeContext( ).getLocale( ),								df );					}					catch ( ChartException dfex )					{						DefaultLoggerImpl.instance( ).log( dfex );						sText = IConstants.NULL_STRING;					}					y = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dXMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_LEFT ) == IConstants.TICK_LEFT ) ? ( dX - IConstants.TICK_SIZE )								: dX, dXMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_RIGHT ) == IConstants.TICK_RIGHT ) ? dX								+ IConstants.TICK_SIZE								: dX;						if ( dXMinorTick1 != dXMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( dXMinorTick1,											y - daMinor[k] ) );									lreMinor.setEnd( LocationImpl.create( dXMinorTick2,											y - daMinor[k] ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dXTick1 != dXTick2 )						{							lre.setLineAttributes( liaMajorTick );							lre.getStart( ).set( dXTick1, y );							lre.getEnd( ).set( dXTick2, y );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.setLineAttributes( lia );								lre.setStart( LocationImpl.create( dX, y ) );								lre.setEnd( LocationImpl.create( dX										+ dSeriesThickness, y										- dSeriesThickness ) );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels )					{						lo.set( x, y );						la.getCaption( ).setValue( sText );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}					dAxisValue += dAxisStep;				}			}			else if ( ( sc.getType( ) & IConstants.DATE_TIME ) == IConstants.DATE_TIME )			{				CDateTime cdt, cdtAxisValue = Methods.asDateTime( sc.getMinimum( ) );				final int iUnit = Methods.asInteger( sc.getUnit( ) );				final int iStep = Methods.asInteger( sc.getStep( ) );				SimpleDateFormat sdf = null;				if ( fs == null )				{					sdf = new SimpleDateFormat( CDateTime.getPreferredFormat( iUnit ) );				}				cdt = cdtAxisValue;				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					if ( bRenderAxisLabels )					{						double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1								: dXTick2 + 1;						for ( int i = 0; i < da.length; i++ )						{							try							{								sText = ValueFormatter.format( cdt,										ax.getFormatSpecifier( ),										ax.getRunTimeContext( ).getLocale( ),										sdf );							}							catch ( ChartException dfex )							{								DefaultLoggerImpl.instance( ).log( dfex );								sText = IConstants.NULL_STRING;							}							y = (int) da[i];							lo.set( x, y );							la.getCaption( ).setValue( sText );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );							cdt = cdtAxisValue.forward( iUnit, iStep * ( i + 1 ) ); // ALWAYS																					// W.R.T																					// START																					// VALUE						}					}				}				double x = ( iLabelLocation == IConstants.LEFT ) ? dXTick1 - 1						: dXTick2 + 1;				for ( int i = 0; i < da.length; i++ )				{					try					{						sText = ValueFormatter.format( cdt,								ax.getFormatSpecifier( ),								ax.getRunTimeContext( ).getLocale( ),								sdf );					}					catch ( ChartException dfex )					{						DefaultLoggerImpl.instance( ).log( dfex );						sText = IConstants.NULL_STRING;					}					y = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dXMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_LEFT ) == IConstants.TICK_LEFT ) ? ( dX - IConstants.TICK_SIZE )								: dX, dXMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_RIGHT ) == IConstants.TICK_RIGHT ) ? dX								+ IConstants.TICK_SIZE								: dX;						if ( dXMinorTick1 != dXMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( dXMinorTick1,											y - daMinor[k] ) );									lreMinor.setEnd( LocationImpl.create( dXMinorTick2,											y - daMinor[k] ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dXTick1 != dXTick2 )						{							lre.setLineAttributes( liaMajorTick );							lre.getStart( ).set( dXTick1, y );							lre.getEnd( ).set( dXTick2, y );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.setStart( LocationImpl.create( dX, y ) );								lre.setEnd( LocationImpl.create( dX										+ dSeriesThickness, y										- dSeriesThickness ) );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels )					{						lo.set( x, y );						la.getCaption( ).setValue( sText );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}					cdt = cdtAxisValue.forward( iUnit, iStep * ( i + 1 ) ); // ALWAYS																			// W.R.T																			// START																			// VALUE				}			}			la = ax.getTitle( ); // TEMPORARILY USE FOR AXIS TITLE			if ( la.isVisible( ) )			{				ScriptHandler.callFunction( sh,						ScriptHandler.BEFORE_DRAW_AXIS_TITLE,						axModel,						la );				getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_TITLE,						la );				final String sRestoreValue = la.getCaption( ).getValue( );				la.getCaption( )						.setValue( rtc.externalizedMessage( sRestoreValue ) );				BoundingBox bb = null;				try				{					bb = Methods.computeBox( xs,							ax.getTitlePosition( ),							la,							0,							0 );				}				catch ( IllegalArgumentException uiex )				{					throw new ChartException( ChartException.RENDERING, uiex );				}				final Bounds bo = BoundsImpl.create( ax.getTitleCoordinate( ),						daEndPoints[1],						bb.getWidth( ),						daEndPoints[0] - daEndPoints[1] );				tre.setBlockBounds( bo );				tre.setLabel( la );				tre.setBlockAlignment( null );				tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );				ipr.drawText( tre );				la.getCaption( ).setValue( sRestoreValue );				ScriptHandler.callFunction( sh,						ScriptHandler.AFTER_DRAW_AXIS_TITLE,						axModel,						la );				getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_TITLE,						la );			}			la = ax.getLabel( );			if ( iv != null					&& iv.getType( ) == IntersectionValue.MAX					&& iDimension == IConstants.TWO_5_D )			{				trae.setTranslation( -dSeriesThickness, dSeriesThickness );				ipr.applyTransformation( trae );			}		}		else if ( iOrientation == IConstants.HORIZONTAL )		{			int x;			double dY = dLocation;			double dYTick1 = ( ( iMajorTickStyle & IConstants.TICK_ABOVE ) == IConstants.TICK_ABOVE ) ? ( dY - IConstants.TICK_SIZE )					: dY, dYTick2 = ( ( iMajorTickStyle & IConstants.TICK_BELOW ) == IConstants.TICK_BELOW ) ? dY					+ IConstants.TICK_SIZE					: dY;			if ( iv != null					&& iv.getType( ) == IntersectionValue.MAX					&& iDimension == IConstants.TWO_5_D )			{				trae.setTransform( TransformationEvent.TRANSLATE );				trae.setTranslation( dSeriesThickness, -dSeriesThickness );				ipr.applyTransformation( trae );			}			if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS					&& lia.isVisible( ) )			{				final double dStart = daEndPoints[0] - insCA.getLeft( ), dEnd = daEndPoints[1]						+ insCA.getRight( );				if ( iv != null						&& iv.getType( ) == IntersectionValue.VALUE						&& iDimension == IConstants.TWO_5_D )				{					final Location[] loa = new Location[4];					loa[0] = LocationImpl.create( dStart, dY );					loa[1] = LocationImpl.create( dStart + dSeriesThickness, dY							- dSeriesThickness );					loa[2] = LocationImpl.create( dEnd + dSeriesThickness, dY							- dSeriesThickness );					loa[3] = LocationImpl.create( dEnd, dY );					final PolygonRenderEvent pre = (PolygonRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,							PolygonRenderEvent.class );					pre.setPoints( loa );					pre.setBackground( ColorDefinitionImpl.create( 255,							255,							255,							127 ) );					pre.setOutline( lia );					ipr.fillPolygon( pre );				}				lre.setLineAttributes( lia );				lre.getStart( ).set( dStart, dY );				lre.getEnd( ).set( dEnd, dY );				ipr.drawLine( lre );			}			if ( ( sc.getType( ) & IConstants.TEXT ) == IConstants.TEXT					|| sc.isCategoryScale( ) )			{				double dAngleInRadians = ( -dAngleInDegrees * Math.PI ) / 180;				double dSineTheta = Math.abs( Math.sin( dAngleInRadians ) );				double dCosTheta = Math.abs( Math.cos( dAngleInRadians ) );				double dOffset = 0, dW, dH, dHSineTheta;				double dUnitSize = sc.getUnitSize( );				DataSetIterator dsi = sc.getData( );				final int iDateTimeUnit = ( sc.getType( ) == IConstants.DATE_TIME ) ? CDateTime.computeUnit( dsi )						: IConstants.UNDEFINED;				final ITextMetrics itmText = xs.getTextMetrics( la );				if ( dAngleInDegrees == 90 || dAngleInDegrees == 0 )				{					dOffset = dUnitSize / 2;				}				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					if ( bRenderAxisLabels ) // ONLY PROCESS IF AXES LABELS ARE											 // VISIBLE OR REQUESTED FOR					{						double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1								: dYTick2 + 1;						dsi.reset( );						for ( int i = 0; i < da.length - 1; i++ )						{							la.getCaption( )									.setValue( sc.formatCategoryValue( sc.getType( ),											dsi.next( ),											iDateTimeUnit ) );							itmText.reuse( la );// RECYCLED							dH = itmText.getFullHeight( );							dW = itmText.getFullWidth( );							dHSineTheta = dH * dSineTheta;							if ( dAngleInDegrees > 0 && dAngleInDegrees < 90 )							{								if ( iLabelLocation == IConstants.ABOVE )								{									dOffset = dUnitSize											/ 2											- ( dW * dCosTheta + dHSineTheta )											/ 2											+ dHSineTheta;								}								else if ( iLabelLocation == IConstants.BELOW )								{									dOffset = dUnitSize											+ dHSineTheta											- ( dUnitSize - dW * dCosTheta + dHSineTheta )											/ 2											- dHSineTheta;								}							}							else if ( dAngleInDegrees < 0									&& dAngleInDegrees > -90 )							{								if ( iLabelLocation == IConstants.ABOVE )								{									dOffset = dUnitSize											/ 2											- dHSineTheta											/ 2											+ ( dW * dCosTheta + dHSineTheta )											/ 2;								}								else if ( iLabelLocation == IConstants.BELOW )								{									dOffset = ( dUnitSize - dW * dCosTheta + dHSineTheta ) / 2;								}							}							else if ( dAngleInDegrees == 0									|| dAngleInDegrees == 90									|| dAngleInDegrees == -90 )							{								dOffset = dUnitSize / 2;							}							x = (int) da[i];							lo.set( x + dOffset, y );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );						}					}				}				double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1						: dYTick2 + 1;				dsi.reset( );				for ( int i = 0; i < da.length - 1; i++ )				{					x = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dYMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_ABOVE ) == IConstants.TICK_ABOVE ) ? ( dY - IConstants.TICK_SIZE )								: dY, dYMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_BELOW ) == IConstants.TICK_BELOW ) ? dY								+ IConstants.TICK_SIZE								: dY;						if ( dYMinorTick1 != -dYMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( x											+ daMinor[k], dYMinorTick1 ) );									lreMinor.setEnd( LocationImpl.create( x											+ daMinor[k], dYMinorTick2 ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dYTick1 != dYTick2 )						{							lre.setLineAttributes( liaMajorTick );							lre.getStart( ).set( x, dYTick1 );							lre.getEnd( ).set( x, dYTick2 );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.getStart( ).set( x, dY );								lre.getEnd( ).set( x + dSeriesThickness,										dY - dSeriesThickness );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels ) // OPTIMIZED: ONLY PROCESS IF AXES											 // LABELS ARE VISIBLE OR REQUESTED											 // FOR					{						la.getCaption( )								.setValue( sc.formatCategoryValue( sc.getType( ),										dsi.next( ),										iDateTimeUnit ) );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						itmText.reuse( la );// RECYCLED						dH = itmText.getFullHeight( );						dW = itmText.getFullWidth( );						dHSineTheta = dH * dSineTheta;						if ( dAngleInDegrees > 0 && dAngleInDegrees < 90 )						{							if ( iLabelLocation == IConstants.ABOVE )							{								dOffset = dUnitSize										/ 2										- ( dW * dCosTheta + dHSineTheta )										/ 2										+ dHSineTheta;							}							else if ( iLabelLocation == IConstants.BELOW )							{								dOffset = dUnitSize										+ dHSineTheta										- ( dUnitSize - dW * dCosTheta + dHSineTheta )										/ 2										- dHSineTheta;							}						}						else if ( dAngleInDegrees < 0 && dAngleInDegrees > -90 )						{							if ( iLabelLocation == IConstants.ABOVE )							{								dOffset = dUnitSize										/ 2										- dHSineTheta										/ 2										+ ( dW * dCosTheta + dHSineTheta )										/ 2;							}							else if ( iLabelLocation == IConstants.BELOW )							{								dOffset = ( dUnitSize - dW * dCosTheta + dHSineTheta ) / 2;							}						}						else if ( dAngleInDegrees == 0								|| dAngleInDegrees == 90								|| dAngleInDegrees == -90 )						{							dOffset = dUnitSize / 2;						}						lo.set( x + dOffset, y );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}				}				// ONE LAST TICK				x = (int) da[da.length - 1];				if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )				{					if ( dYTick1 != dYTick2 )					{						lre.setLineAttributes( liaMajorTick );						lre.getStart( ).set( x, dYTick1 );						lre.getEnd( ).set( x, dYTick2 );						ipr.drawLine( lre );						if ( iv != null								&& iDimension == IConstants.TWO_5_D								&& iv.getType( ) == IntersectionValue.VALUE )						{							lre.getStart( ).set( x, dY );							lre.getEnd( ).set( x + dSeriesThickness,									dY - dSeriesThickness );							ipr.drawLine( lre );						}					}				}				itmText.dispose( ); // DISPOSED			}			else if ( ( sc.getType( ) & IConstants.LINEAR ) == IConstants.LINEAR )			{				double dAxisValue = Methods.asDouble( sc.getMinimum( ) )						.doubleValue( );				final double dAxisStep = Methods.asDouble( sc.getStep( ) )						.doubleValue( );				if ( fs == null )				{					df = new DecimalFormat( sc.getNumericPattern( ) );				}				// TODO: CACHE COMPUTED VALUES FOR REUSE IN 2ND LOOP				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					if ( bRenderAxisLabels ) // OPTIMIZED: ONLY PROCESS IF AXES											 // LABELS ARE VISIBLE OR REQUESTED											 // FOR					{						double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1								: dYTick2 + 1;						for ( int i = 0; i < da.length; i++ )						{							nde.setValue( dAxisValue );							try							{								sText = ValueFormatter.format( nde,										ax.getFormatSpecifier( ),										ax.getRunTimeContext( ).getLocale( ),										df );							}							catch ( ChartException dfex )							{								DefaultLoggerImpl.instance( ).log( dfex );								sText = IConstants.NULL_STRING;							}							x = (int) da[i];							lo.set( x, y );							la.getCaption( ).setValue( sText );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );							dAxisValue += dAxisStep;						}					}				}				dAxisValue = Methods.asDouble( sc.getMinimum( ) ).doubleValue( ); // RESET				double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1						: dYTick2 + 1;				for ( int i = 0; i < da.length; i++ )				{					x = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dYMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_ABOVE ) == IConstants.TICK_ABOVE ) ? ( dY - IConstants.TICK_SIZE )								: dY, dYMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_BELOW ) == IConstants.TICK_BELOW ) ? dY								+ IConstants.TICK_SIZE								: dY;						if ( dYMinorTick1 != -dYMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( x											+ daMinor[k], dYMinorTick1 ) );									lreMinor.setEnd( LocationImpl.create( x											+ daMinor[k], dYMinorTick2 ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dYTick1 != dYTick2 )						{							lre.setLineAttributes( liaMajorTick );							lre.getStart( ).set( x, dYTick1 );							lre.getEnd( ).set( x, dYTick2 );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.getStart( ).set( x, dY );								lre.getEnd( ).set( x + dSeriesThickness,										dY - dSeriesThickness );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels ) // OPTIMIZED: ONLY PROCESS IF AXES											 // LABELS ARE VISIBLE OR REQUESTED											 // FOR					{						nde.setValue( dAxisValue );						try						{							sText = ValueFormatter.format( nde,									ax.getFormatSpecifier( ),									ax.getRunTimeContext( ).getLocale( ),									df );						}						catch ( ChartException dfex )						{							DefaultLoggerImpl.instance( ).log( dfex );							sText = IConstants.NULL_STRING;						}						lo.set( x, y );						la.getCaption( ).setValue( sText );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}					dAxisValue += dAxisStep;				}			}			else if ( ( sc.getType( ) & IConstants.LOGARITHMIC ) == IConstants.LOGARITHMIC )			{				double dAxisValue = Methods.asDouble( sc.getMinimum( ) )						.doubleValue( );				final double dAxisStep = Methods.asDouble( sc.getStep( ) )						.doubleValue( );				// TODO: CACHE COMPUTED VALUES FOR REUSE IN 2ND LOOP				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					if ( bRenderAxisLabels ) // OPTIMIZED: ONLY PROCESS IF AXES											 // LABELS ARE VISIBLE OR REQUESTED											 // FOR					{						double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1								: dYTick2 + 1;						for ( int i = 0; i < da.length; i++ )						{							if ( fs == null )							{								df = new DecimalFormat( sc.getNumericPattern( dAxisValue ) );							}							nde.setValue( dAxisValue );							try							{								sText = ValueFormatter.format( nde,										ax.getFormatSpecifier( ),										ax.getRunTimeContext( ).getLocale( ),										df );							}							catch ( ChartException dfex )							{								DefaultLoggerImpl.instance( ).log( dfex );								sText = IConstants.NULL_STRING;							}							x = (int) da[i];							lo.set( x, y );							la.getCaption( ).setValue( sText );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );							dAxisValue *= dAxisStep;						}					}				}				dAxisValue = Methods.asDouble( sc.getMinimum( ) ).doubleValue( ); // RESET				double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1						: dYTick2 + 1;				for ( int i = 0; i < da.length; i++ )				{					x = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dYMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_ABOVE ) == IConstants.TICK_ABOVE ) ? ( dY - IConstants.TICK_SIZE )								: dY, dYMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_BELOW ) == IConstants.TICK_BELOW ) ? dY								+ IConstants.TICK_SIZE								: dY;						if ( dYMinorTick1 != -dYMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( x											+ daMinor[k], dYMinorTick1 ) );									lreMinor.setEnd( LocationImpl.create( x											+ daMinor[k], dYMinorTick2 ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dYTick1 != dYTick2 )						{							lre.setLineAttributes( lia );							lre.getStart( ).set( x, dYTick1 );							lre.getEnd( ).set( x, dYTick2 );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.getStart( ).set( x, dY );								lre.getEnd( ).set( x + dSeriesThickness,										dY - dSeriesThickness );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels ) // OPTIMIZED: ONLY PROCESS IF AXES											 // LABELS ARE VISIBLE OR REQUESTED											 // FOR					{						if ( fs == null )						{							df = new DecimalFormat( sc.getNumericPattern( dAxisValue ) );						}						nde.setValue( dAxisValue );						try						{							sText = ValueFormatter.format( nde,									ax.getFormatSpecifier( ),									ax.getRunTimeContext( ).getLocale( ),									df );						}						catch ( ChartException dfex )						{							DefaultLoggerImpl.instance( ).log( dfex );							sText = IConstants.NULL_STRING;						}						lo.set( x, y );						la.getCaption( ).setValue( sText );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}					dAxisValue *= dAxisStep;				}			}			else if ( ( sc.getType( ) & IConstants.DATE_TIME ) == IConstants.DATE_TIME )			{				CDateTime cdt, cdtAxisValue = Methods.asDateTime( sc.getMinimum( ) );				final int iUnit = Methods.asInteger( sc.getUnit( ) );				final int iStep = Methods.asInteger( sc.getStep( ) );				SimpleDateFormat sdf = null;				if ( fs == null )				{					sdf = new SimpleDateFormat( CDateTime.getPreferredFormat( iUnit ) );				}				cdt = cdtAxisValue;				// TODO: CACHE COMPUTED VALUES FOR REUSE IN 2ND LOOP				if ( bLabelShadowEnabled )				{					// MUST RENDER SHADOWS IN A PREVIOUS LOOP TO ENABLE CORRECT					// Z-ORDERING					if ( bRenderAxisLabels ) // OPTIMIZED: ONLY PROCESS IF AXES											 // LABELS ARE VISIBLE OR REQUESTED											 // FOR					{						double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1								: dYTick2 + 1;						for ( int i = 0; i < da.length; i++ )						{							try							{								sText = ValueFormatter.format( cdt,										ax.getFormatSpecifier( ),										ax.getRunTimeContext( ).getLocale( ),										sdf );							}							catch ( ChartException dfex )							{								DefaultLoggerImpl.instance( ).log( dfex );								sText = IConstants.NULL_STRING;							}							x = (int) da[i];							lo.set( x, y );							la.getCaption( ).setValue( sText );							tre.setAction( TextRenderEvent.RENDER_SHADOW_AT_LOCATION );							ipr.drawText( tre );							cdt = cdtAxisValue.forward( iUnit, iStep * ( i + 1 ) ); // ALWAYS																					// W.R.T																					// START																					// VALUE						}					}				}				double y = ( iLabelLocation == IConstants.ABOVE ) ? dYTick1 - 1						: dYTick2 + 1;				for ( int i = 0; i < da.length; i++ )				{					x = (int) da[i];					if ( ( iWhatToDraw & IConstants.AXIS ) == IConstants.AXIS )					{						double dYMinorTick1 = ( ( iMinorTickStyle & IConstants.TICK_ABOVE ) == IConstants.TICK_ABOVE ) ? ( dY - IConstants.TICK_SIZE )								: dY, dYMinorTick2 = ( ( iMinorTickStyle & IConstants.TICK_BELOW ) == IConstants.TICK_BELOW ) ? dY								+ IConstants.TICK_SIZE								: dY;						if ( dYMinorTick1 != -dYMinorTick2 )						{							// RENDER THE MINOR TICKS FIRST (For ALL but the							// last Major tick)							if ( i != da.length - 1 )							{								LineRenderEvent lreMinor = null;								for ( int k = 0; k < daMinor.length - 1; k++ )								{									lreMinor = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( pl,											LineRenderEvent.class );									lreMinor.setLineAttributes( liaMinorTick );									lreMinor.setStart( LocationImpl.create( x											+ daMinor[k], dYMinorTick1 ) );									lreMinor.setEnd( LocationImpl.create( x											+ daMinor[k], dYMinorTick2 ) );									ipr.drawLine( lreMinor );								}							}						}						if ( dYTick1 != dYTick2 )						{							lre.setLineAttributes( liaMajorTick );							lre.getStart( ).set( x, dYTick1 );							lre.getEnd( ).set( x, dYTick2 );							ipr.drawLine( lre );							if ( iv != null									&& iDimension == IConstants.TWO_5_D									&& iv.getType( ) == IntersectionValue.VALUE )							{								lre.getStart( ).set( x, dY );								lre.getEnd( ).set( x + dSeriesThickness,										dY - dSeriesThickness );								ipr.drawLine( lre );							}						}					}					if ( bRenderAxisLabels ) // OPTIMIZED: ONLY PROCESS IF AXES											 // LABELS ARE VISIBLE OR REQUESTED											 // FOR					{						try						{							sText = ValueFormatter.format( cdt,									ax.getFormatSpecifier( ),									ax.getRunTimeContext( ).getLocale( ),									sdf );						}						catch ( ChartException dfex )						{							DefaultLoggerImpl.instance( ).log( dfex );							sText = IConstants.NULL_STRING;						}						lo.set( x, y );						la.getCaption( ).setValue( sText );						tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );						ScriptHandler.callFunction( sh,								ScriptHandler.BEFORE_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,								la );						ipr.drawText( tre );						ScriptHandler.callFunction( sh,								ScriptHandler.AFTER_DRAW_AXIS_LABEL,								axModel,								la );						getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,								la );					}					cdt = cdtAxisValue.forward( iUnit, iStep * ( i + 1 ) ); // ALWAYS																			// W.R.T																			// START																			// VALUE				}			}			// RENDER THE AXIS TITLE			la = ax.getTitle( ); // TEMPORARILY USE FOR AXIS TITLE			if ( la.isVisible( ) )			{				ScriptHandler.callFunction( sh,						ScriptHandler.BEFORE_DRAW_AXIS_TITLE,						axModel,						la );				getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_AXIS_TITLE,						la );				final String sRestoreValue = la.getCaption( ).getValue( );				la.getCaption( )						.setValue( rtc.externalizedMessage( sRestoreValue ) ); // EXTERNALIZE				BoundingBox bb = null;				try				{					bb = Methods.computeBox( xs,							ax.getTitlePosition( ),							la,							0,							0 );				}				catch ( IllegalArgumentException uiex )				{					throw new ChartException( ChartException.RENDERING, uiex );				}				final Bounds bo = BoundsImpl.create( daEndPoints[0],						ax.getTitleCoordinate( ),						daEndPoints[1] - daEndPoints[0],						bb.getHeight( ) );				tre.setBlockBounds( bo );				tre.setLabel( la );				tre.setBlockAlignment( null );				tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );				ipr.drawText( tre );				la.getCaption( ).setValue( sRestoreValue ); // RESTORE				ScriptHandler.callFunction( sh,						ScriptHandler.AFTER_DRAW_AXIS_TITLE,						axModel,						la );				getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_AXIS_TITLE,						la );			}			la = ax.getLabel( ); // RESTORE BACK TO AXIS LABEL			if ( iv != null					&& iv.getType( ) == IntersectionValue.MAX					&& iDimension == IConstants.TWO_5_D )			{				trae.setTranslation( -dSeriesThickness, dSeriesThickness );				ipr.applyTransformation( trae );			}		}	}