double dW, dMaxW = 0;
double dW, dMaxW = 0, dMaxW2 = 0;
	final double computeAxisLabelThickness( IDisplayServer xs, Label la,			int iOrientation ) throws ChartException	{		if ( !la.isSetVisible( ) )		{			throw new ChartException( ChartEnginePlugin.ID,					ChartException.GENERATION,					"exception.unset.label.visibility", //$NON-NLS-1$					new Object[]{						la.getCaption( ).getValue( )					},					ResourceBundle.getBundle( Messages.ENGINE, rtc.getLocale( ) ) );		}		if ( !la.isVisible( ) )		{			return 0;		}		String sText;		double[] da = getTickCordinates( );		if ( iOrientation == VERTICAL )		{			double dW, dMaxW = 0;			if ( ( getType( ) & TEXT ) == TEXT || bCategoryScale )			{				final DataSetIterator dsi = getData( );				final int iDateTimeUnit = ( getType( ) == IConstants.DATE_TIME ) ? CDateTime.computeUnit( dsi )						: IConstants.UNDEFINED;				dsi.reset( );				while ( dsi.hasNext( ) )				{					la.getCaption( ).setValue( formatCategoryValue( getType( ),							dsi.next( ),							iDateTimeUnit ) );					dW = computeWidth( xs, la );					if ( dW > dMaxW )						dMaxW = dW;				}			}			else if ( ( getType( ) & LINEAR ) == LINEAR )			{				final NumberDataElement nde = NumberDataElementImpl.create( 0 );				double dAxisValue = asDouble( getMinimum( ) ).doubleValue( );				double dAxisStep = asDouble( getStep( ) ).doubleValue( );				DecimalFormat df = null;				if ( fs == null )				{					df = new DecimalFormat( getNumericPattern( ) );				}				for ( int i = 0; i < da.length; i++ )				{					nde.setValue( dAxisValue );					try					{						sText = ValueFormatter.format( nde,								fs,								rtc.getLocale( ),								df );					}					catch ( ChartException dfex )					{						logger.log( dfex );						sText = IConstants.NULL_STRING;					}					la.getCaption( ).setValue( sText );					dW = computeWidth( xs, la );					if ( dW > dMaxW )						dMaxW = dW;					dAxisValue += dAxisStep;				}			}			else if ( ( getType( ) & LOGARITHMIC ) == LOGARITHMIC )			{				final NumberDataElement nde = NumberDataElementImpl.create( 0 );				double dAxisValue = asDouble( getMinimum( ) ).doubleValue( );				double dAxisStep = asDouble( getStep( ) ).doubleValue( );				DecimalFormat df = null;				for ( int i = 0; i < da.length; i++ )				{					if ( fs == null )					{						df = new DecimalFormat( getNumericPattern( dAxisValue ) );					}					nde.setValue( dAxisValue );					try					{						sText = ValueFormatter.format( nde,								fs,								rtc.getLocale( ),								df );					}					catch ( ChartException dfex )					{						logger.log( dfex );						sText = IConstants.NULL_STRING;					}					la.getCaption( ).setValue( sText );					dW = computeWidth( xs, la );					if ( dW > dMaxW )						dMaxW = dW;					dAxisValue *= dAxisStep;				}			}			else if ( ( getType( ) & DATE_TIME ) == DATE_TIME )			{				CDateTime cdtAxisValue = asDateTime( getMinimum( ) );				int iStep = asInteger( getStep( ) );				int iUnit = asInteger( getUnit( ) );				SimpleDateFormat sdf = null;				if ( fs == null )				{					sdf = new SimpleDateFormat( CDateTime.getPreferredFormat( iUnit ) );				}				for ( int i = 0; i < da.length; i++ )				{					try					{						sText = ValueFormatter.format( cdtAxisValue,								fs,								rtc.getLocale( ),								sdf );					}					catch ( ChartException dfex )					{						logger.log( dfex );						sText = IConstants.NULL_STRING;					}					la.getCaption( ).setValue( sText );					dW = computeWidth( xs, la );					if ( dW > dMaxW )						dMaxW = dW;					cdtAxisValue = cdtAxisValue.forward( iUnit, iStep );				}			}			return dMaxW;		}		else if ( iOrientation == HORIZONTAL )		{			double dH, dMaxH = 0;			if ( ( getType( ) & TEXT ) == TEXT || bCategoryScale )			{				final DataSetIterator dsi = getData( );				final int iDateTimeUnit = ( getType( ) == IConstants.DATE_TIME ) ? CDateTime.computeUnit( dsi )						: IConstants.UNDEFINED;				dsi.reset( );				while ( dsi.hasNext( ) )				{					la.getCaption( ).setValue( formatCategoryValue( getType( ),							dsi.next( ),							iDateTimeUnit ) );					dH = computeHeight( xs, la );					if ( dH > dMaxH )					{						dMaxH = dH;					}				}			}			else if ( ( getType( ) & LINEAR ) == LINEAR )			{				final NumberDataElement nde = NumberDataElementImpl.create( 0 );				double dAxisValue = asDouble( getMinimum( ) ).doubleValue( );				final double dAxisStep = asDouble( getStep( ) ).doubleValue( );				DecimalFormat df = null;				if ( fs == null )				{					df = new DecimalFormat( getNumericPattern( ) );				}				for ( int i = 0; i < da.length; i++ )				{					nde.setValue( dAxisValue );					try					{						sText = ValueFormatter.format( nde,								fs,								rtc.getLocale( ),								df );					}					catch ( ChartException dfex )					{						logger.log( dfex );						sText = IConstants.NULL_STRING;					}					la.getCaption( ).setValue( sText );					dH = computeHeight( xs, la );					if ( dH > dMaxH )						dMaxH = dH;					dAxisValue += dAxisStep;				}			}			else if ( ( getType( ) & LOGARITHMIC ) == LOGARITHMIC )			{				final NumberDataElement nde = NumberDataElementImpl.create( 0 );				double dAxisValue = asDouble( getMinimum( ) ).doubleValue( );				final double dAxisStep = asDouble( getStep( ) ).doubleValue( );				DecimalFormat df = null;				for ( int i = 0; i < da.length; i++ )				{					if ( fs == null )					{						df = new DecimalFormat( getNumericPattern( dAxisValue ) );					}					nde.setValue( dAxisValue );					try					{						sText = ValueFormatter.format( nde,								fs,								rtc.getLocale( ),								df );					}					catch ( ChartException dfex )					{						logger.log( dfex );						sText = IConstants.NULL_STRING;					}					la.getCaption( ).setValue( sText );					dH = computeHeight( xs, la );					if ( dH > dMaxH )						dMaxH = dH;					dAxisValue *= dAxisStep;				}			}			else if ( ( getType( ) & DATE_TIME ) == DATE_TIME )			{				CDateTime cdtAxisValue = asDateTime( getMinimum( ) );				final int iStep = asInteger( getStep( ) );				final int iUnit = asInteger( getUnit( ) );				SimpleDateFormat sdf = null;				if ( fs == null )				{					sdf = new SimpleDateFormat( CDateTime.getPreferredFormat( iUnit ) );				}				for ( int i = 0; i < da.length; i++ )				{					try					{						sText = ValueFormatter.format( cdtAxisValue,								fs,								rtc.getLocale( ),								sdf );					}					catch ( ChartException dfex )					{						logger.log( dfex );						sText = IConstants.NULL_STRING;					}					la.getCaption( ).setValue( sText );					dH = computeHeight( xs, la );					if ( dH > dMaxH )						dMaxH = dH;					cdtAxisValue.forward( iUnit, iStep );				}			}			return dMaxH;		}		return 0;	}