Package org.jCharts.chartText

# Class TextTagGroup

java.lang.Object
org.jCharts.chartText.TextTagGroup

All Implemented Interfaces:
  `Serializable`, `HTMLTestable`

Direct Known Subclasses:
  `NumericTagGroup`

public class TextTagGroup extends Object implements HTMLTestable, Serializable

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`private ChartFont`
`chartFont`
`private FontRenderContext`
`fontRenderContext`
`private float`
`tallestLabel`
`private ArrayList`
`textTags`
`private float`
`totalLabelWidths`
`private float`
`widestLabel`

## Constructor Summary

Constructors
Constructor
Description
`TextTagGroup(ChartFont chartFont, FontRenderContext fontRenderContext)`
Constructor

## Method Summary

Modifier and Type
Method
Description
`void`
`addLabel(String label)`
`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 invalid input: '<' 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++; } /******************************************************************************************
`void`
`render(int index, Graphics2D g2d, float x, float y)`
Renders the text, at the position - renders from the top (instead of baseline)
`void`
`reverse()`
Horizontal plots render the data from top down so rendering alogorithm needs to get the labels in reverse order to make things easier.
`int`
`size()`
Returns the number of labels
`void`
`toHTML(HTMLGenerator htmlGenerator)`
Renders all the text in this group.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### widestLabel

private float widestLabel

### tallestLabel

private float tallestLabel

### totalLabelWidths

private float totalLabelWidths

### textTags

private ArrayList textTags

### chartFont

private ChartFont chartFont

### fontRenderContext

private FontRenderContext fontRenderContext

## Constructor Details

### TextTagGroup

public TextTagGroup(ChartFont chartFont, FontRenderContext fontRenderContext)
Constructor

Parameters:
  `chartFont` -
  `fontRenderContext` -

## Method Details

### addLabel

public void addLabel(String label)

Parameters:
  `label` -

### size

public int size()
Returns the number of labels

Returns:
  int

### reverse

public void reverse()
Horizontal plots render the data from top down so rendering alogorithm needs to get the labels in reverse order to make things easier.

### 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 invalid input: '<' 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

### render

public void render(int index, Graphics2D g2d, float x, float y)
Renders the text, at the position - renders from the top (instead of baseline)

Parameters:
  `index` -
  `g2d` -
  `x` -
  `y` -

### toHTML

public void toHTML(HTMLGenerator htmlGenerator)
Renders all the text in this group. public void renderTag( int index, Graphics2D g2d ) { TextTag tag; //Paint p = this.fontColor; g2d.setPaint( this. ); //g2d.setFont( (this.derivedFont == null) ? baseFont : derivedFont ); for( int i = 0; i invalid input: '<' group.size(); i++ ) { tag = ( TextTag ) group.get( i ); tag.render( g2d, p ); // Text tag sets the Paint every time if not null // So, we might save a small bit of time by changing // this to null after first time. p = null; } } /********************************************************************************************* Enables the testing routines to display the contents of this Object.

Specified by:
  `toHTML` in interface `HTMLTestable`
Parameters:
  `htmlGenerator` -