Chart Builder API (beta)

oracle.ord.media.chart.piechart
Class PieChartInteractive

java.lang.Object
  |
  +--java.awt.Component
        |
        +--oracle.ord.media.chart.Chart
              |
              +--oracle.ord.media.chart.legend.Legend
                    |
                    +--oracle.ord.media.chart.piechart.PieChart
                          |
                          +--oracle.ord.media.chart.piechart.PieChartInteractive
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class PieChartInteractive
extends PieChart

PieChartInteractive is a subclass of PieChart that is used to implement interactive pie charts. This class provides methods for determining mouse entry and exit of pie slices and methods for highlighting pie slices. These methods are most useful in Java Applets and Java Applications.

The methods getSliceEntered(int x, int y), getSliceExited(int x, int y), and getSliceIndex(int x, int y) are provided to support interactive applications. These calls enable one to detect mouse entry and exit from pie slices, and subsequently initiate actions triggered by the pie slice exit or entry.

getSliceEntered() returns true if the passed (x,y) coordinate triggers a pie slice entry. Likewise, getSliceExited() returns true if the passed (x,y) coordinate triggers a pie slice exit. getSliceIndex() is used to determine the index of the pie slice located at coordinate (x,y). The sliceIndex can be subsequently used to initiate chart actions, such as pie slice highlighting.

Pie slice highlighting may be triggered by pie slice events. setSliceHighlight(int sliceIndex, Color c) alters the color of the pie slice (identified by sliceIndex). setSliceUnHighlight() restores the highlighted pie slice to its original color. Note that for a given pie chart, at most one pie slice may be highlighted an any time.

Note that slice indexes are integer values starting at 0. For example, if the pie has three slices, it will have slice indexes 0, 1, and 2.

See Also:
Serialized Form

Inner classes inherited from class oracle.ord.media.chart.legend.Legend
Legend.LegendElement
 
Inner classes inherited from class oracle.ord.media.chart.Chart
Chart.ChartLabel
 
Fields inherited from class oracle.ord.media.chart.legend.Legend
DERIVED, EAST, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, USERDEFINED, WEST
 
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
 
Constructor Summary
PieChartInteractive()
          Constructor
 
Method Summary
 boolean getSliceEntered(int x, int y)
          Return true if the cursor has entered a pie slice.
 boolean getSliceExited(int x, int y)
          Return true if the cursor has exited a pie slice.
 int getSliceIndex(int x, int y)
          Return the index of the pie slice at location (x,y).
 void setSliceHighlight(int sliceIndex, java.awt.Color c)
          Highlight the pie slice corresponding to the specified index.
 void setSliceLabelHighlight(int sliceIndex, java.awt.Color c)
          Highlight the pie slice label corresponding to the specified index.
 void setSliceLabelUnHighlight()
          Remove the highlighting of the pie slice label for any and all pie slices.
 void setSliceUnHighlight()
          Remove the highlighting for any and all pie slices.
 
Methods inherited from class oracle.ord.media.chart.piechart.PieChart
drawBuffer, getConnectorStroke, getForeground, getImageMapCS, getImageMapSS, getPieSliceDesc, getPieStroke, paint, redrawBuffer, setAutoSliceColor, setBackgroundRectOff, setBounds, setBounds, setConnectorStroke, setDelimiter, setDelimiter, setDeriveLabelPct, setDeriveLabelPct, setDeriveLabelPct, setDeriveLabelVal, setDeriveLabelVal, setDeriveLabelVal, setEnableImageMapCS, setEnableImageMapCS, setEnableImageMapSS, setExternalLabelsOff, setFont, setForeground, setLabelInteriorPct, setLabelInteriorVal, setLastWordNewline, setPieStroke, setSeparateLine, setSeparateLine, setSeries, setSize, setSize, setStartAngle
 
Methods inherited from class oracle.ord.media.chart.legend.Legend
getLegendAlignment, getLegendBackground, getLegendDisable, getLegendDisplaySingleSeries, getLegendEdgeColor, getLegendEdgeDisable, getLegendForeground, getLegendInside, setLegendAlignment, setLegendBackground, setLegendDisable, setLegendDisplaySingleSeries, setLegendEdgeColor, setLegendEdgeDisable, setLegendFont, setLegendForeground, setLegendInside, setLegendOffsetX, setLegendOffsetY
 
Methods inherited from class oracle.ord.media.chart.Chart
getBackground, getBorderBottom, getBorderLeft, getBorderRight, getBorderTop, getEdgeColor, getFootnote, getHeight, getMinimumSize, getPreferredSize, getRenderingHintsChart, getSize, getSubtitle, getTitle, getVersion, getWidth, isSetRenderingHintsChart, setBackground, setBorderBottom, setBorderLeft, setBorderRight, setBorderTop, setEdgeColor, setRenderingHintsChart, setTitlesForeground
 
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, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getGraphics, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, 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, 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, setComponentOrientation, setCursor, setDropTarget, setEnabled, setLocale, setLocation, setLocation, setName, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PieChartInteractive

public PieChartInteractive()
Constructor
Method Detail

getSliceIndex

public int getSliceIndex(int x,
                         int y)
                  throws ChartException
Return the index of the pie slice at location (x,y). If coordinate (x,y) is contained in the slice, then the index of the slice is returned. Otherwise, -1 is returned.
Parameters:
x - The screen x coordinate.
y - The screen y coordinate.
Returns:
The index of the slice.
Throws:
ChartException - if the PieSliceDesc is undefined.

getSliceEntered

public boolean getSliceEntered(int x,
                               int y)
                        throws ChartException
Return true if the cursor has entered a pie slice. This method is typically used in the context of MouseMoved events in order to determine if the mouse has entered a pie slice. (Note that this call is provided because pie slices are not represented as individual Components.)
Parameters:
x - The screen x coordinate.
y - The screen y coordinate.
Returns:
True if the cursor has entered a new pie slice.
Throws:
ChartException - if the PieSliceDesc is undefined.
See Also:
getSliceExited(int, int)

getSliceExited

public boolean getSliceExited(int x,
                              int y)
                       throws ChartException
Return true if the cursor has exited a pie slice. This method is typically used in the context of MouseMoved events in order to determine if the mouse has exited a pie slice. (Note that this call is provided because pie slices are not represented as individual Components.)
Parameters:
x - The screen x coordinate.
y - The screen y coordinate.
Returns:
True if the cursor has exited a new pie slice.
Throws:
ChartException - if the PieSliceDesc is undefined.
See Also:
getSliceEntered(int, int)

setSliceUnHighlight

public void setSliceUnHighlight()
                         throws ChartException
Remove the highlighting for any and all pie slices.
See Also:
setSliceHighlight(int, Color)

setSliceLabelUnHighlight

public void setSliceLabelUnHighlight()
                              throws ChartException
Remove the highlighting of the pie slice label for any and all pie slices.
See Also:
setSliceLabelHighlight(int, Color)

setSliceHighlight

public void setSliceHighlight(int sliceIndex,
                              java.awt.Color c)
                       throws ChartException
Highlight the pie slice corresponding to the specified index.
Parameters:
sliceIndex - Index identifying the pie slice.
c - Color to set pie slice.
Returns:
The index of the pie slice. -1 is returned if the pie slice is undefined.
Throws:
ChartException - for an invalid pie slice index.
See Also:
setSliceUnHighlight()

setSliceLabelHighlight

public void setSliceLabelHighlight(int sliceIndex,
                                   java.awt.Color c)
                            throws ChartException
Highlight the pie slice label corresponding to the specified index.
Parameters:
sliceIndex - Index identifying the pie slice.
c - Color to set pie slice label.
Returns:
The index of the pie slice. -1 is returned if the pie slice is undefined.
Throws:
ChartException - for an invalid pie slice index.
See Also:
setSliceUnHighlight()

Chart Builder API (beta)