Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## vis.beans.plotter
Class PieChart

    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Container
                  |
                  +--javax.swing.JComponent
                        |
                        +--vis.beans.plotter.Viewport
                              |
                              +--vis.beans.plotter.PieChart

All Implemented Interfaces:
  java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextServiceRevokedListener, java.beans.beancontext.BeanContextServicesListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable

public class PieChart
extends Viewport
implements java.awt.print.Printable

Draws a pie chart.

Version:
  2.0 24 May 2000
Author:
  Larry Rodrigues
See Also:
  Serialized Form

Inner classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Inner classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Inner classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent`

Field Summary
`protected java.awt.Point` | `border`
`protected int[]` | `borderULHC` Upper left hand corner coordinate of the border.
`protected java.lang.Class` | `customizerClass` The customizer class
`protected boolean` | `enableDraw` Flag that indicates whether to redraw the plot.
`protected java.awt.Font` | `font` Font
`protected int` | `fontSize` Font size
`protected java.awt.Color` | `graphColor` Graph color
`protected int` | `graphHt` Width and height of the graph.
`protected int` | `graphNum` Current graph number.
`protected java.lang.String` | `graphTitle` Graph title.
`protected int` | `graphWid` Width and height of the graph.
`protected int` | `headerHt` Hieght of the header.
`protected java.awt.Point` | `headerPt` Position of the title.
`protected int` | `legBoxSize` Size of the legend box.
`protected int` | `legendGap` The gap between two legend strings.
`protected int` | `legendGapIncr` Legend gap increment
`protected boolean` | `legendOn` Legend on or off.
`protected int[]` | `legendPos` Legend position.
`protected int` | `legendPosXIncr` Legend position increment in X direction.
`protected int` | `legendPosYIncr` Legend position increment in Y direction.
`protected int[]` | `legendULHC` Upper left hand corner coordinate of the first legend string
`protected java.awt.Point` | `legPt` Absolute legend position, i.e.; legendPos+incr.
`protected int` | `maxPies` Maximum number of pies
`protected java.awt.Point` | `orig` Origin of the graph
`protected java.awt.FontMetrics` | `pFont` Font metrics
`protected int` | `pieCenterXIncr` Pie center X coordinate increment
`protected int` | `pieCenterYIncr` Pie center Y coordinate increment
`protected int` | `pieDiaIncr` Pie diameter increment
`protected java.lang.String` | `titleString` Plot title
`protected java.lang.Object` | `x` Object that holds an array of X axis values.
`protected double` | `xRange` X axis range of values i.e.; max - min.
`protected double` | `xScale` X axis scale factor.
`protected java.lang.String[]` | `xTextValues` X axis string values.
`protected java.lang.Object` | `y` Object that holds an array of Y axis values.
`protected double` | `yRange` Y axis range
`protected double` | `yScale` Y axis scale factor.

Fields inherited from class vis.beans.plotter.Viewport
`destGc, destImage, height, offScrGc, offScrImage, pixImage, plBeanContext, width, xMagFac, xScaleFac, yMagFac, yScaleFac`

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface java.awt.print.Printable
`NO_SUCH_PAGE, PAGE_EXISTS`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`PieChart()`

Method Summary
`void` | `addLegend(java.awt.Color col, java.lang.String str)` Adds a legend.
`void` | `addNotify()`
`void` | `createPlotTemplate()` Creates the plot template.
`void` | `draw()` Draws the pie chart on the viewport.
`void` | `drawPieChart(java.lang.Object xs, java.lang.Object y)` Draws the pie chart.
`void` | `drawPlot(java.lang.Object x, java.lang.Object y)`
`int[]` | `getBorderULHC()`
`int` | `getBorderULHC(int index)`
`java.lang.Class` | `getCustomizerClass()`
`java.awt.Color` | `getGraphColor()`
`java.lang.String` | `getGraphTitle()`
`int` | `getLegendGapIncr()`
`boolean` | `getLegendOn()`
`int[]` | `getLegendPos()`
`int` | `getLegendPos(int index)`
`int` | `getLegendPosXIncr()`
`int` | `getLegendPosYIncr()`
`int[]` | `getLegendULHC()`
`int` | `getLegendULHC(int index)`
`java.awt.Dimension` | `getMinimumSize()`
`java.awt.Graphics` | `getOffScrGc()`
`int` | `getPieCenterXIncr()`
`int` | `getPieCenterYIncr()`
`int` | `getPieDiaIncr()`
`java.lang.String` | `getTitleString()`
`protected void` | `launchCustomizer(java.lang.Class cl)`
`static java.lang.String` | `launchFileDialog()`
`void` | `plotPieChart(PlotEvent e)` Plots the pie chart.
`protected void` | `popupMenu(int x, int y)`
`int` | `print(java.awt.Graphics g, java.awt.print.PageFormat f, int pageIndex)`
`protected void` | `printPlot()`
`protected void` | `processMouseEvent(java.awt.event.MouseEvent e)`
`protected void` | `reset()` Resets the plot viewport.
`void` | `resetPieChart()` Resets the plot viewport.
`static java.lang.String` | `saveAsJPEG(java.awt.image.BufferedImage bi)`
`void` | `setBackground(java.awt.Color clr)` Sets the background color.
`void` | `setBorderULHC(int[] br)` Sets the upper left hand corner coordinate(ULHC) of the plot border.
`void` | `setBorderULHC(int index, int xy)` Sets one of the border ULHC coordinate which is an indexed property.
`void` | `setCustomizerClass(java.lang.Class cl)` Sets the customizer class.
`void` | `setFont(java.awt.Font fnt)` Sets the font.
`void` | `setForeground(java.awt.Color clr)` Sets the foreground color.
`void` | `setGraphColor(java.awt.Color col)` Sets the graph color.
`void` | `setGraphTitle(java.lang.String grTitle)` Sets the graph title.
`void` | `setLegendGapIncr(int incr)` Sets the legend gap increment property.
`void` | `setLegendOn(boolean onOff)` Sets the legend visibility on or of.
`void` | `setLegendPos(int[] pt)` Sets the legend position which is an indexed property.
`void` | `setLegendPos(int index, int xy)` Sets the legend position which is an indexed property.
`void` | `setLegendPosXIncr(int incr)` Sets the legend position increment in the X direction.
`void` | `setLegendPosYIncr(int num)` Sets the legend position increment in the Y direction.
`void` | `setLegendULHC(int[] pt)` This is an indexed propety that represents the legend position.
`void` | `setLegendULHC(int xy, int index)` This is a setter method that sets an element of the indexed property.
`protected void` | `setParams()` Sets the pie plot viewport related parameters.
`void` | `setPieCenterXIncr(int incr)` Sets the pie center x increment property.
`void` | `setPieCenterYIncr(int incr)` Sets the pie center y increment property.
`void` | `setPieDiaIncr(int incr)` Sets the pie diameter increment property.
`void` | `setTitleString(java.lang.String title)` Sets the plot title.
`void` | `setWidHt(int wd, int hgt)` Sets width and height.

Methods inherited from class vis.beans.plotter.Viewport
`addPropertyChangeListener, addVetoableChangeListener, createOffScrImage, getBeanContext, imagePaint, invokePrinterService, invokeSaveImageService, paintComponent, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, setOffScrGc`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### border

    protected java.awt.Point border

### orig

    protected java.awt.Point orig

  Origin of the graph

### headerPt

    protected java.awt.Point headerPt

  Position of the title.

### headerHt

    protected int headerHt

  Hieght of the header.

### xScale

    protected double xScale

  X axis scale factor.

### yScale

    protected double yScale

  Y axis scale factor.

### xRange

    protected double xRange

  X axis range of values i.e.; max - min.

### yRange

    protected double yRange

  Y axis range

### legBoxSize

    protected int legBoxSize

  Size of the legend box.

### legPt

    protected java.awt.Point legPt

  Absolute legend position, i.e.; legendPos+incr.

### x

    protected java.lang.Object x

  Object that holds an array of X axis values. The array type can be of any Java primitive type or String.

### y

    protected java.lang.Object y

  Object that holds an array of Y axis values. The array type can be of any Java primitive type.

### enableDraw

    protected boolean enableDraw

  Flag that indicates whether to redraw the plot.

### titleString

    protected java.lang.String titleString

  Plot title

### graphColor

    protected java.awt.Color graphColor

  Graph color

### font

    protected java.awt.Font font

  Font

### pFont

    protected java.awt.FontMetrics pFont

  Font metrics

### fontSize

    protected int fontSize

  Font size

### graphWid

    protected int graphWid

  Width and height of the graph.

### graphHt

    protected int graphHt

  Width and height of the graph.

### graphNum

    protected int graphNum

  Current graph number.

### graphTitle

    protected java.lang.String graphTitle

  Graph title.

### xTextValues

    protected java.lang.String[] xTextValues

  X axis string values.

### legendOn

    protected boolean legendOn

  Legend on or off. The default value is false.

### borderULHC

    protected int[] borderULHC

  Upper left hand corner coordinate of the border.

### legendPos

    protected int[] legendPos

  Legend position.

### legendPosXIncr

    protected int legendPosXIncr

  Legend position increment in X direction.

### legendPosYIncr

    protected int legendPosYIncr

  Legend position increment in Y direction.

### legendGap

    protected int legendGap

  The gap between two legend strings.

### legendGapIncr

    protected int legendGapIncr

  Legend gap increment

### customizerClass

    protected java.lang.Class customizerClass

  The customizer class

### maxPies

    protected int maxPies

  Maximum number of pies

### legendULHC

    protected int[] legendULHC

  Upper left hand corner coordinate of the first legend string

### pieDiaIncr

    protected int pieDiaIncr

  Pie diameter increment

### pieCenterXIncr

    protected int pieCenterXIncr

  Pie center X coordinate increment

### pieCenterYIncr

    protected int pieCenterYIncr

  Pie center Y coordinate increment

Constructor Detail

### PieChart

    public PieChart()

Method Detail

### addNotify

    public void addNotify()

  Overrides:
    `addNotify` in class `javax.swing.JComponent`

### setLegendULHC

    public void setLegendULHC(int[] pt)

  This is an indexed propety that represents the legend position. The first element holds the x coordinate and second the y coordinate.
  Parameters:
    `pt` - an array of size two which holds the upper left hand corner coordinate of the legend.

### setLegendULHC

    public void setLegendULHC(int xy,
                              int index)

  This is a setter method that sets an element of the indexed property.
  Parameters:
    `xy` - the x or y coordinate of the legend.
    `index` - the index of the property.

### getLegendULHC

    public int[] getLegendULHC()

  Returns:
    the legend position.

### getLegendULHC

    public int getLegendULHC(int index)

  Returns:
    an element (x or y coordinate) of the legend position property.

### setPieDiaIncr

    public void setPieDiaIncr(int incr)

  Sets the pie diameter increment property.
  Parameters:
    `incr` - the increment.

### getPieDiaIncr

    public int getPieDiaIncr()

  Returns:
    the pie diameter increment.

### setPieCenterXIncr

    public void setPieCenterXIncr(int incr)

  Sets the pie center x increment property.
  Parameters:
    `incr` - the increment.

### getPieCenterXIncr

    public int getPieCenterXIncr()

  Returns:
    the pie center x increment.

### setPieCenterYIncr

    public void setPieCenterYIncr(int incr)

  Sets the pie center y increment property.
  Parameters:
    `incr` - the increment.

### getPieCenterYIncr

    public int getPieCenterYIncr()

  Returns:
    the pie center y increment.

### setLegendGapIncr

    public void setLegendGapIncr(int incr)

  Sets the legend gap increment property.
  Parameters:
    `incr` - the increment.

### getLegendGapIncr

    public int getLegendGapIncr()

  Returns:
    the legend gap increment.

### setWidHt

    public void setWidHt(int wd,
                         int hgt)

  Sets width and height.
  Overrides:
    `setWidHt` in class `Viewport`
  Following copied from class: `vis.beans.plotter.Viewport`
  Parameters:
    `wd` - the width of the viewport.
    `ht` - the height of the viewport.

### setBackground

    public void setBackground(java.awt.Color clr)

  Sets the background color.
  Overrides:
    `setBackground` in class `javax.swing.JComponent`
  Parameters:
    `clr` - the color.

### setForeground

    public void setForeground(java.awt.Color clr)

  Sets the foreground color.
  Overrides:
    `setForeground` in class `javax.swing.JComponent`
  Parameters:
    `clr` - the color.

### setTitleString

    public void setTitleString(java.lang.String title)

  Sets the plot title.
  Parameters:
    `title` - the plot title.

### getTitleString

    public java.lang.String getTitleString()

  Returns:
    the plot title.

### setGraphTitle

    public void setGraphTitle(java.lang.String grTitle)

  Sets the graph title.
  Parameters:
    `grTitle` - the graph title.

### getGraphTitle

    public java.lang.String getGraphTitle()

  Returns:
    the graph title.

### setLegendOn

    public void setLegendOn(boolean onOff)

  Sets the legend visibility on or of.
  Parameters:
    `onOff` - the legend is on or off.

### getLegendOn

    public boolean getLegendOn()

  Returns:
    the legend on property.

### setFont

    public void setFont(java.awt.Font fnt)

  Sets the font.
  Overrides:
    `setFont` in class `javax.swing.JComponent`
  Parameters:
    `fnt` - the font.

### setGraphColor

    public void setGraphColor(java.awt.Color col)

  Sets the graph color.
  Parameters:
    `col` - the graph color.

### getGraphColor

    public java.awt.Color getGraphColor()

  Returns:
    the graph color.

### setBorderULHC

    public void setBorderULHC(int[] br)

  Sets the upper left hand corner coordinate(ULHC) of the plot border. This is an indexed property.
  Parameters:
    `br` - an array of size two that holds the x and y coordinates of upper left hand corner of the border.

### getBorderULHC

    public int[] getBorderULHC()

  Returns:
    the upper left hand coordinate of the plot border.

### setBorderULHC

    public void setBorderULHC(int index,
                              int xy)

  Sets one of the border ULHC coordinate which is an indexed property.
  Parameters:
    `index` - the index of the borderULHC index property.
    `xy` - the value corresponding to the index.

### getBorderULHC

    public int getBorderULHC(int index)

  Parameters:
    `index` - the index of the borderULHC property. It can be 0 or 1.
  Returns:
    the value at a given index.

### setLegendPos

    public void setLegendPos(int[] pt)

  Sets the legend position which is an indexed property.
  Parameters:
    `br` - an array of size two that holds the x and y coordinates of upper left hand corner of the border.

### setLegendPos

    public void setLegendPos(int index,
                             int xy)

  Sets the legend position which is an indexed property.
  Parameters:
    `index` - the index of the borderULHC index property.
    `xy` - the value corresponding to the index.

### getLegendPos

    public int[] getLegendPos()

  Returns:
    an array of int which is hold the X and Y coordinates of the legend position.

### getLegendPos

    public int getLegendPos(int index)

  Parameters:
    `index` - the index of the array.
  Returns:
    an element of the legend position index property.

### setLegendPosXIncr

    public void setLegendPosXIncr(int incr)

  Sets the legend position increment in the X direction.
  Parameters:
    `incr` - the increment.

### getLegendPosXIncr

    public int getLegendPosXIncr()

  Returns:
    the legend position x increment.

### setLegendPosYIncr

    public void setLegendPosYIncr(int num)

  Sets the legend position increment in the Y direction.
  Parameters:
    `incr` - the increment.

### getLegendPosYIncr

    public int getLegendPosYIncr()

  Returns:
    the legend position y increment.

### getMinimumSize

    public java.awt.Dimension getMinimumSize()

  Overrides:
    `getMinimumSize` in class `javax.swing.JComponent`

### getCustomizerClass

    public java.lang.Class getCustomizerClass()

  Returns:
    the customizer class.

### setCustomizerClass

    public void setCustomizerClass(java.lang.Class cl)

  Sets the customizer class.
  Parameters:
    `the` - customizer class.

### createPlotTemplate

    public void createPlotTemplate()

  Creates the plot template. This includes drawing the border and the plot title.

### setParams

    protected void setParams()

  Sets the pie plot viewport related parameters.

### addLegend

    public void addLegend(java.awt.Color col,
                          java.lang.String str)

  Adds a legend.
  Parameters:
    `col` - the color of the legend box.
    `str` - the legend string.

### resetPieChart

    public void resetPieChart()

  Resets the plot viewport.

### processMouseEvent

    protected void processMouseEvent(java.awt.event.MouseEvent e)

  Overrides:
    `processMouseEvent` in class `java.awt.Component`

### plotPieChart

    public void plotPieChart(PlotEvent e)

  Plots the pie chart. This is a target method for connecting to the Pie Chart bean through plot events.
  Parameters:
    `e` - the PlotEvent.

### getOffScrGc

    public java.awt.Graphics getOffScrGc()

### drawPieChart

    public void drawPieChart(java.lang.Object xs,
                             java.lang.Object y)

  Draws the pie chart.
  Parameters:
    `x` - the array of x values.
    `y` - the array of y values.

### drawPlot

    public void drawPlot(java.lang.Object x,
                         java.lang.Object y)

  Parameters:
    `x` - an array of x values. In this case, these are string values.
    `y` - an arrya of y values.

### draw

    public void draw()

  Draws the pie chart on the viewport.
  Overrides:
    `draw` in class `Viewport`

### print

    public int print(java.awt.Graphics g,
                     java.awt.print.PageFormat f,
                     int pageIndex)

  Specified by:
    `print` in interface `java.awt.print.Printable`

### reset

    protected void reset()

  Resets the plot viewport.

### popupMenu

    protected void popupMenu(int x,
                             int y)

### printPlot

    protected void printPlot()

### saveAsJPEG

    public static java.lang.String saveAsJPEG(java.awt.image.BufferedImage bi)

### launchFileDialog

    public static java.lang.String launchFileDialog()

### launchCustomizer

    protected void launchCustomizer(java.lang.Class cl)
                             throws java.lang.InstantiationException,
                                    java.lang.IllegalAccessException

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD