Chart Builder API (beta)

oracle.ord.media.chart
Class Chart.ChartLabel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--oracle.ord.media.chart.Chart.ChartLabel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Enclosing class:
Chart

public class Chart.ChartLabel
extends java.awt.Component

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:

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().

See Also:
Serialized Form

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

LEFT

public static final int LEFT
Indicates that the label should be left justified.

CENTER

public static final int CENTER
Indicates that the label should be centered.

RIGHT

public static final int RIGHT
Indicates that the label should be right justified.

CENTER_PLOT

public static final int CENTER_PLOT
Indicates that the label should be centered above the plot window.
Method Detail

getHeight

public int getHeight()
Get the height of the label.
Overrides:
getHeight in class java.awt.Component

setForeground

public void setForeground(java.awt.Color c)
Set the foreground color.
Overrides:
setForeground in class java.awt.Component

getAlignment

public int getAlignment()
Get the current alignment of this ChartLabel. Possible values are ChartLabel.LEFT, ChartLabel.RIGHT, ChartLabel.CENTER, and ChartLabel.CENTER_PLOT.

setAlignment

public void setAlignment(int alignment)
Set the alignment for this ChartLabel. Possible values are ChartLabel.LEFT, ChartLabel.RIGHT, ChartLabel.CENTER and ChartLabel.CENTER_PLOT.
Parameters:
alignment - The alignment to be set.
Throws:
java.lang.IllegalArgumentException - if an improper value for alignment is given.
See Also:
getAlignment()

setFontMetrics

public void setFontMetrics(java.awt.Graphics2D g2)

getLineCount

public int getLineCount()
Return the number of lines in the ChartLabel. INTERNAL ONLY ***

getFontMetrics

public java.awt.FontMetrics getFontMetrics()

setFont

public void setFont(java.awt.Font f)
Set the ChartLabel font.
Overrides:
setFont in class java.awt.Component
Parameters:
f - The font.

setWidth

public void setWidth(int width)
Set the width of the retangular area bounding the ChartLabel. INTERNAL ONLY ***

getText

public java.lang.String getText()
Get the text of this ChartLabel.
Returns:
the text of this ChartLabel.
See Also:
setText(java.lang.String)

setText

public void setText(java.lang.String text)
Set the text for this ChartLabel to the specified text.
Parameters:
text - The text to be displayed.
See Also:
getText()

setText

public void setText(java.lang.String[] text)
Set the text for this ChartLabel to the specified text array. Each entry in the array of Strings corresponds to a text string to be written on a separate line.
Parameters:
text[] - The array of text to be displayed.

setHeightFactor

public 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. 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.

getStringWidth

public int getStringWidth()
Get the width of the chart label string. INTERNAL ONLY ***

drawBuffer

public void drawBuffer(java.awt.Graphics2D g2)
Render the chart into the buffered image associated with g2.

Chart Builder API (beta)