## org.jCharts.chartData.processors
Class TextProcessor

    java.lang.Object
      org.jCharts.chartData.processors.TextProcessor

    public class TextProcessor

extends Object

Field Summary
`private float` `tallestLabel`
`private ArrayList` `textTags`
`private float` `totalLabelWidths`
`private float` `widestLabel`

Constructor Summary
`TextProcessor()` Constructor

Method Summary
`void` `addLabel(String label, Font font, FontRenderContext fontRenderContext)`
`float` `getTallestLabel()`
`TextTag` `getTextTag(int index)`
`float` `getTotalLabelWidths()`

`float`

`getWidestLabel()`
Calculates the width and height needed by the passed String when rendered // * @param iDataSeries / * @param font // * @param fontRenderContext public void processLabels( IDataSeries iDataSeries) { //LOOP for( int i = 0; i < iDataSeries.getNumberOfXAxisLabels(); i++ ) { this.axisLabelProcessor.processLabel( iDataSeries.getXAxisLabel( i ), axisLabelFont, fontRenderContext ); } TextLayout textLayout = new TextLayout( label, font, fontRenderContext ); //---WIDTH this.labelWidths[ counter ] = textLayout.getAdvance(); this.widestLabel = Math.max( this.labelWidths[ counter ], this.widestLabel ); this.totalLabelWidths += this.labelWidths[ counter ]; //---HEIGHT this.labelHeights[ counter ] = textLayout.getAscent() + textLayout.getDescent(); this.tallestLabel = Math.max( this.labelHeights[ counter ], this.tallestLabel ); //---need this to offset font rendering, as rendering is at the baseline not bottom or top, this.fontDescent = textLayout.getDescent(); this.counter++; } /******************************************************************************************

`int` `size()` Returns the number of labels

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### widestLabel

    private float widestLabel

### tallestLabel

    private float tallestLabel

### totalLabelWidths

    private float totalLabelWidths

### textTags

    private ArrayList textTags

Constructor Detail

### TextProcessor

    public TextProcessor()

  Constructor

Method Detail

### addLabel

    public void addLabel(String label,
                         Font font,
                         FontRenderContext fontRenderContext)

  Parameters:
    `label` -
    `font` -
    `fontRenderContext` -

### size

    public int size()

  Returns the number of labels

  Returns:
    int

### getWidestLabel

    public float getWidestLabel()

  Calculates the width and height needed by the passed String when rendered // * @param iDataSeries / * @param font // * @param fontRenderContext public void processLabels( IDataSeries iDataSeries) { //LOOP for( int i = 0; i < iDataSeries.getNumberOfXAxisLabels(); i++ ) { this.axisLabelProcessor.processLabel( iDataSeries.getXAxisLabel( i ), axisLabelFont, fontRenderContext ); } TextLayout textLayout = new TextLayout( label, font, fontRenderContext ); //---WIDTH this.labelWidths[ counter ] = textLayout.getAdvance(); this.widestLabel = Math.max( this.labelWidths[ counter ], this.widestLabel ); this.totalLabelWidths += this.labelWidths[ counter ]; //---HEIGHT this.labelHeights[ counter ] = textLayout.getAscent() + textLayout.getDescent(); this.tallestLabel = Math.max( this.labelHeights[ counter ], this.tallestLabel ); //---need this to offset font rendering, as rendering is at the baseline not bottom or top, this.fontDescent = textLayout.getDescent(); this.counter++; } /******************************************************************************************

### getTallestLabel

    public float getTallestLabel()

### getTotalLabelWidths

    public float getTotalLabelWidths()

### getTextTag

    public TextTag getTextTag(int index)

  Parameters:
    `index` -
  Returns:
    TextTag