dExtraHeight = itm.getFullHeight( );
dExtraHeight = Math.max( itm.getFullHeight( ), dFHeightV );
	private double[] computeVerticalByTopBottomValue( IDisplayServer xs,			Chart cm, SeriesDefinition[] seda, RunTimeContext rtc,			ITextMetrics itm, Label la, LegendData legendData )			throws ChartException	{		double dWidth = 0, dHeight = 0;		double dW, dMaxW = 0, dColumnWidth;		double dRealHeight = 0, dExtraWidth = 0, dDeltaHeight;		ArrayList columnList = new ArrayList( );		// (VERTICAL => TB)		double dSeparatorThickness = legendData.dSeparatorThickness				+ legendData.dVerticalSpacing;		for ( int j = 0; j < seda.length; j++ )		{			List al = seda[j].getRunTimeSeries( );			FormatSpecifier fs = seda[j].getFormatSpecifier( );			boolean oneVisibleSerie = false;			for ( int i = 0; i < al.size( ); i++ )			{				Series se = (Series) al.get( i );				if ( se.isVisible( ) )				{					oneVisibleSerie = true;				}				else				{					continue;				}				Object obj = se.getSeriesIdentifier( );				String lgtext = rtc.externalizedMessage( String.valueOf( obj ) );				if ( fs != null )				{					try					{						lgtext = ValueFormatter.format( lgtext,								fs,								rtc.getULocale( ),								null );					}					catch ( ChartException e )					{						// ignore, use original text.					}				}				la.getCaption( ).setValue( lgtext );				itm.reuse( la, legendData.maxWrappingSize );				BoundingBox bb = null;				try				{					bb = Methods.computeBox( xs, IConstants.ABOVE, la, 0, 0 );				}				catch ( IllegalArgumentException uiex )				{					throw new ChartException( ChartEnginePlugin.ID,							ChartException.RENDERING,							uiex );				}				dW = bb.getWidth( );				double dFHeight = bb.getHeight( );				double dExtraHeight = 0;				String extraText = null;				double dExceedingSpace = dExtraWidth						+ dW						+ legendData.dHorizonalReservedSpace						- legendData.dAvailableWidth						- legendData.dSafeSpacing;				double[] newMetrics = checkEllipsisText( dExceedingSpace,						dW,						xs,						itm,						la,						legendData.dEllipsisWidth,						legendData.maxWrappingSize );				if ( newMetrics != null )				{					dW = newMetrics[0];					dFHeight = newMetrics[1];				}				dDeltaHeight = legendData.insCa.getTop( )						+ dFHeight						+ legendData.insCa.getBottom( );				if ( cm.getLegend( ).isShowValue( ) )				{					DataSetIterator dsiBase = null;					try					{						dsiBase = new DataSetIterator( se.getDataSet( ) );					}					catch ( Exception ex )					{						throw new ChartException( ChartEnginePlugin.ID,								ChartException.GENERATION,								ex );					}					// Use first value for each series.					if ( dsiBase.hasNext( ) )					{						obj = dsiBase.next( );						// Skip invalid data						while ( obj == null && dsiBase.hasNext( ) )						{							obj = dsiBase.next( );						}						String valueText = String.valueOf( obj );						if ( fs != null )						{							try							{								lgtext = ValueFormatter.format( obj,										fs,										rtc.getULocale( ),										null );							}							catch ( ChartException e )							{								// ignore, use original text.							}						}						Label seLabel = LabelImpl.copyInstance( se.getLabel( ) );						seLabel.getCaption( ).setValue( valueText );						itm.reuse( seLabel );						dW = Math.max( dW, itm.getFullWidth( ) );						dExtraHeight = itm.getFullHeight( );						extraText = seLabel.getCaption( ).getValue( );						dDeltaHeight += dExtraHeight + 2 * legendData.dScale;					}				}				if ( dHeight + dDeltaHeight > legendData.dAvailableHeight )				{					// check available bounds					dColumnWidth = dMaxW + legendData.dHorizonalReservedSpace;					if ( dExtraWidth + dColumnWidth > legendData.dAvailableWidth							+ legendData.dSafeSpacing )					{						dMaxW = -legendData.dHorizonalReservedSpace;						columnList.clear( );						break;					}					else					{						legendData.legendItems.addAll( columnList );						columnList.clear( );						dExtraWidth += dColumnWidth;						dExceedingSpace = dExtraWidth								+ dW								+ legendData.dHorizonalReservedSpace								- legendData.dAvailableWidth								- legendData.dSafeSpacing;						newMetrics = checkEllipsisText( dExceedingSpace,								dW,								xs,								itm,								la,								legendData.dEllipsisWidth,								legendData.maxWrappingSize );						if ( newMetrics != null )						{							dW = newMetrics[0];							dFHeight = newMetrics[1];							dDeltaHeight = legendData.insCa.getTop( )									+ dFHeight									+ legendData.insCa.getBottom( );						}						dMaxW = dW;						dRealHeight = Math.max( dRealHeight, dHeight );						dHeight = dDeltaHeight;					}				}				else				{					dMaxW = Math.max( dW, dMaxW );					dHeight += dDeltaHeight;				}				columnList.add( new LegendItemHints( LEGEND_ENTRY,						new Point( dExtraWidth, dHeight - dDeltaHeight ),						dW,						dFHeight,						la.getCaption( ).getValue( ),						dExtraHeight,						extraText ) );			}			// check available bounds			dColumnWidth = dMaxW + legendData.dHorizonalReservedSpace;			if ( dExtraWidth + dColumnWidth > legendData.dAvailableWidth					+ legendData.dSafeSpacing )			{				dMaxW = -legendData.dHorizonalReservedSpace;			}			else			{				legendData.legendItems.addAll( columnList );				// SETUP HORIZONTAL SEPARATOR SPACING				if ( oneVisibleSerie						&& j < seda.length - 1						&& ( cm.getLegend( ).getSeparator( ) == null || cm.getLegend( )								.getSeparator( )								.isVisible( ) ) )				{					dHeight += dSeparatorThickness;					legendData.legendItems.add( new LegendItemHints( LEGEND_SEPERATOR,							new Point( dExtraWidth, dHeight									- dSeparatorThickness									/ 2 ),							dMaxW									+ legendData.insCa.getLeft( )									+ legendData.insCa.getRight( )									+ ( 3 * legendData.dItemHeight )									/ 2,							0,							null,							0,							null ) );				}			}			columnList.clear( );		}		// LEFT INSETS + LEGEND ITEM WIDTH + HORIZONTAL SPACING + MAX		// ITEM WIDTH + RIGHT INSETS		dWidth = dMaxW + legendData.dHorizonalReservedSpace + dExtraWidth;		dHeight = Math.max( dRealHeight, dHeight );		return new double[]{				dWidth, dHeight		};	}