|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jCharts.chartText.TextTagGroup
Field Summary | |
private ChartFont |
chartFont
|
private java.awt.font.FontRenderContext |
fontRenderContext
|
private float |
tallestLabel
|
private java.util.ArrayList |
textTags
|
private float |
totalLabelWidths
|
private float |
widestLabel
|
Constructor Summary | |
TextTagGroup(ChartFont chartFont,
java.awt.font.FontRenderContext fontRenderContext)
Constructor |
Method Summary | |
void |
addLabel(java.lang.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 < 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,
java.awt.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 Detail |
private float widestLabel
private float tallestLabel
private float totalLabelWidths
private java.util.ArrayList textTags
private ChartFont chartFont
private java.awt.font.FontRenderContext fontRenderContext
Constructor Detail |
public TextTagGroup(ChartFont chartFont, java.awt.font.FontRenderContext fontRenderContext)
chartFont
- fontRenderContext
- Method Detail |
public void addLabel(java.lang.String label)
label
- public int size()
public void reverse()
public float getWidestLabel()
public float getTallestLabel()
public float getTotalLabelWidths()
public TextTag getTextTag(int index)
index
-
public void render(int index, java.awt.Graphics2D g2d, float x, float y)
index
- g2d
- x
- y
- public void toHTML(HTMLGenerator htmlGenerator)
toHTML
in interface HTMLTestable
htmlGenerator
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |