|
Chart Builder API (beta) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--oracle.ord.media.chart.Chart.ChartLabel
The ChartLabel
class supports writing text labels in the Chart.
Titles, subtitles, and footnotes are all created with ChartLabel
.
ChartLabel objects are accessed via the getTitle(), getSubtitle(),
and getFootnote() methods.
The most useful ChartLabel methods are the following:
setText()
setFont()
setAlignment()
A ChartLabel
can be aligned left, right or centered.
Centering has two options: CENTER and CENTER_PLOT.
By default, titles and subtitles are aligned CENTER_PLOT,
while footnotes are aligned LEFT.
This alignment can be altered with setAlignment()
.
setAlignment()
accepts
the following alignments: ChartLabel.LEFT, ChartLabel.RIGHT
, ChartLabel.CENTER
and ChartLabel.CENTER_PLOT
.
The height of the ChartLabel
's bounding box can be set
with setHeightFactor
. In addition, the y positioning of
the text string within the bounding box can be
controlled with setYOffset()
.
Field Summary | |
static int |
CENTER
Indicates that the label should be centered. |
static int |
CENTER_PLOT
Indicates that the label should be centered above the plot window. |
static int |
LEFT
Indicates that the label should be left justified. |
static int |
RIGHT
Indicates that the label should be right justified. |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary | |
void |
drawBuffer(java.awt.Graphics2D g2)
Render the chart into the buffered image associated with g2. |
int |
getAlignment()
Get the current alignment of this ChartLabel. |
java.awt.FontMetrics |
getFontMetrics()
|
int |
getHeight()
Get the height of the label. |
int |
getLineCount()
Return the number of lines in the ChartLabel. |
int |
getStringWidth()
Get the width of the chart label string. |
java.lang.String |
getText()
Get the text of this ChartLabel. |
void |
setAlignment(int alignment)
Set the alignment for this ChartLabel. |
void |
setFont(java.awt.Font f)
Set the ChartLabel font. |
void |
setFontMetrics(java.awt.Graphics2D g2)
|
void |
setForeground(java.awt.Color c)
Set the foreground color. |
void |
setHeightFactor(double heightFactor)
Set the amount of height of the area reserved for ChartLabel ,
expressed as a function of the font height of a ChartLabel . |
void |
setText(java.lang.String text)
Set the text for this ChartLabel to the specified text. |
void |
setText(java.lang.String[] text)
Set the text for this ChartLabel to the specified text array. |
void |
setWidth(int width)
Set the width of the retangular area bounding the ChartLabel. |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int CENTER_PLOT
Method Detail |
public int getHeight()
getHeight
in class java.awt.Component
public void setForeground(java.awt.Color c)
setForeground
in class java.awt.Component
public int getAlignment()
ChartLabel.LEFT
, ChartLabel.RIGHT
,
ChartLabel.CENTER
, and ChartLabel.CENTER_PLOT
.public void setAlignment(int alignment)
ChartLabel.LEFT
,
ChartLabel.RIGHT
, ChartLabel.CENTER
and ChartLabel.CENTER_PLOT
.alignment
- The alignment to be set.java.lang.IllegalArgumentException
- if an improper value for
alignment
is given.getAlignment()
public void setFontMetrics(java.awt.Graphics2D g2)
public int getLineCount()
public java.awt.FontMetrics getFontMetrics()
public void setFont(java.awt.Font f)
setFont
in class java.awt.Component
f
- The font.public void setWidth(int width)
public java.lang.String getText()
setText(java.lang.String)
public void setText(java.lang.String text)
text
- The text to be displayed.getText()
public void setText(java.lang.String[] text)
text[]
- The array of text to be displayed.public void setHeightFactor(double heightFactor)
ChartLabel
,
expressed as a function of the font height of a ChartLabel
.
Users can specify the height of the bounding box where the ChartLabel
is placed.
heightFactor
is expressed as a function of the
font height of a ChartLabel
.
For example, a heightFactor of 1.0 reserves only the necessary vertical
space to place the ChartLabel
text.
The default height factors are the following:
1.5 for titles, 1.25 for subtitles, 1.0 for footnotes.public int getStringWidth()
public void drawBuffer(java.awt.Graphics2D g2)
|
Chart Builder API (beta) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |